Meaningful identifiers and other multi-token keywords
Dom DiSc
dominikus at scherkl.de
Tue Sep 24 22:03:46 UTC 2024
On Tuesday, 24 September 2024 at 20:37:36 UTC, Quirin Schroll
wrote:
> I want to suggest moving the parsing of scope guards and
> linkages to the lexer, i.e., if the lexer sees `scope`, `(`,
> any one of the identifiers `exit`, `success`, or `failure`, and
> `)`, that is a scope guard and is treated as a single token.
>
> The same with `extern(C)` – it will never be seen as anything
> but a linkage. It’s a multi-token keyword.
>
> Possibly, we can handle other cases alike, e.g. `static
> assert`, `static foreach`, and `auto ref`. By all accounts,
> their meaning isn’t derived from composing the semantics of the
> parts.
>
> What do you think?
I think this is a good idea. They are multi-token keywords just
to not occupy more words as keywords, but in fact could be
treated as single entities.
More information about the Digitalmars-d
mailing list