Date: Fri, 6 Oct 2023 18:24:06 +0200
On 06/10/2023 18.11, Aaron Ballman via Liaison wrote:
> On Fri, Oct 6, 2023 at 9:58 AM Timur Doumler <cpp_at_[hidden]> wrote:
>>
>> Thanks Aaron,
>>
>>> On 6 Oct 2023, at 16:53, Aaron Ballman <aaron_at_[hidden]> wrote:
>>> C23 Footnote 186: Standard attributes specified by this document can
>>> be parsed but ignored by an implementation without changing the
>>> semantics of a correct program; the same is not true for attributes
>>> not specified by this document.
>>
>> Interesting. It seems a bit ambiguous to me what "parsed but ignored" actually means. If we go with the P2935 (attribute-like) syntax for Contracts and you end up having something like this:
>>
>> [[ assert: x != 0 ]];
>>
>> Does "parse" mean that you have to actually parse `x != 0` as an expression, since the grammar for contracts says that the thing after the colon is an expression? Or does "when you see `[[`, skip every token until you reach the matching `]]` " also count as "parse"?
>
> It's a footnote, so we're a bit imprecise with the wording of it. But
> the intent here is "parse" means "lex and eat tokens until the closing
> ]], paying attention to balance (, [, and { with ), ], and }". It's
> "parsing" because of the balanced tokens and needing to find the
> closing ]]. But the goal is for it to be a valid implementation to see
> [[, eat balanced tokens until the closing ]], and drop everything on
> the floor.
That's not what the normative text says, though.
C23 6.7.12p2 still says you need to parse the basic
structure of attributes. For example, a ":" appearing
as an attribute-token is required to be diagnosed as
ill-formed.
Jens
> On Fri, Oct 6, 2023 at 9:58 AM Timur Doumler <cpp_at_[hidden]> wrote:
>>
>> Thanks Aaron,
>>
>>> On 6 Oct 2023, at 16:53, Aaron Ballman <aaron_at_[hidden]> wrote:
>>> C23 Footnote 186: Standard attributes specified by this document can
>>> be parsed but ignored by an implementation without changing the
>>> semantics of a correct program; the same is not true for attributes
>>> not specified by this document.
>>
>> Interesting. It seems a bit ambiguous to me what "parsed but ignored" actually means. If we go with the P2935 (attribute-like) syntax for Contracts and you end up having something like this:
>>
>> [[ assert: x != 0 ]];
>>
>> Does "parse" mean that you have to actually parse `x != 0` as an expression, since the grammar for contracts says that the thing after the colon is an expression? Or does "when you see `[[`, skip every token until you reach the matching `]]` " also count as "parse"?
>
> It's a footnote, so we're a bit imprecise with the wording of it. But
> the intent here is "parse" means "lex and eat tokens until the closing
> ]], paying attention to balance (, [, and { with ), ], and }". It's
> "parsing" because of the balanced tokens and needing to find the
> closing ]]. But the goal is for it to be a valid implementation to see
> [[, eat balanced tokens until the closing ]], and drop everything on
> the floor.
That's not what the normative text says, though.
C23 6.7.12p2 still says you need to parse the basic
structure of attributes. For example, a ":" appearing
as an attribute-token is required to be diagnosed as
ill-formed.
Jens
Received on 2023-10-06 16:24:09