-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not lex ..
as a single DotDotToken
#75549
Conversation
…al-parsing-dotdot
@@ -3235,7 +3235,6 @@ private bool IsFieldDeclaration(bool isEvent, bool isGlobalScriptLevel) | |||
{ | |||
case SyntaxKind.DotToken: // Goo. explicit | |||
case SyntaxKind.ColonColonToken: // Goo:: explicit | |||
case SyntaxKind.DotDotToken: // Goo.. explicit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most parser code got simpler. Instead of dealing with DotDot as if it was an errant Dot that they need to split, tehy just handle 'dot' like normal. only the code that explicitly cares about a ..
token needs to handle and synthesize it.
…/roslyn into expressionParsing
@jcouv this is ready for another pass. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done with review pass (iteration 48)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM Thanks! (iteration 51)
Fixes #74456
Alternate approach to #75532.
The general idea here is to take the same approach parsing
..
as we do with>>
. Namely, instead of having the lexer lex out a combined token, which the parser would have to 'break up', we instead only have the lexer lex out two tokens, and we have the parser combine those tokens as needed when in a context where..
is legal (like a range-operator, slice-pattern, or collection-spread element).This is fairly simple to accomplish, and simplifies a bunch of parsing code that used to have to look for
.
or..
and break up the latter. It also fixes incremental parsing as we can treat..
exactly like>>
in the incremental parsing, marking it as a parser-fabricated token that should not then be returned when incrementally lexing.