Do not lex .. as a single DotDotToken#75549
Merged
CyrusNajmabadi merged 51 commits intodotnet:mainfrom Oct 25, 2024
Merged
Conversation
…al-parsing-dotdot
CyrusNajmabadi
commented
Oct 17, 2024
CyrusNajmabadi
commented
Oct 17, 2024
| { | ||
| case SyntaxKind.DotToken: // Goo. explicit | ||
| case SyntaxKind.ColonColonToken: // Goo:: explicit | ||
| case SyntaxKind.DotDotToken: // Goo.. explicit |
Contributor
Author
There was a problem hiding this comment.
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
Contributor
Author
|
@jcouv this is ready for another pass. |
jcouv
reviewed
Oct 23, 2024
Member
jcouv
left a comment
There was a problem hiding this comment.
Done with review pass (iteration 48)
This was referenced Oct 29, 2024
Merged
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.