Skip to content

parser: support verbatim identifiers - #80

Merged
rameel merged 2 commits into
mainfrom
parser/verbatim-identifiers
Nov 24, 2026
Merged

rameel merged 2 commits into
mainfrom
parser/verbatim-identifiers

Conversation

@rameel

@rameel rameel commented Nov 24, 2026

Copy link
Copy Markdown
Owner

The keywords true, false, and null could not be used as names. A member named after one of them was reachable only through another case, as in x.True, which works only because DefaultBinder ignores case. With a case-sensitive binder, it was not reachable at all, and x.@true, as written in C#, was a syntax error.

As in C#, a name prefixed with @ is now an identifier even if it is a keyword, wherever an identifier is expected, as in @true, x.@null, and 1 :> @long:

identifier
  = "@"? identifier_start identifier_body*
  ;

The prefix is not part of the name, so error messages show the name without it, as the C# compiler does: @true without such a member gives Cannot resolve symbol 'true'. Expr.ToString() prefixes a keyword name with @, so x.@null prints as x.@null and parses back to the same tree.

The keywords true, false, and null could not be used as names. A member
named after one of them was reachable only through another case, as in
x.True, which works only because DefaultBinder ignores case; x.@true,
as written in C#, was a syntax error.

As in C#, a name prefixed with @ is now an identifier even if it is a
keyword, wherever an identifier is expected, as in @true, x.@null, and
1 :> @long:

    identifier
      = "@"? identifier_start identifier_body*
      ;

The prefix is not part of the name, so error messages show the name
without it, as the C# compiler does. Expr.ToString prefixes a keyword
name with @, so x.@null prints as x.@null and parses back to the same
tree.
@rameel
rameel merged commit eef2360 into main Nov 24, 2026
1 check passed
@rameel
rameel deleted the parser/verbatim-identifiers branch November 24, 2026 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant