-
Notifications
You must be signed in to change notification settings - Fork 20
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
Remove EndOfFileTrivia
and always collect trivia after top-level parsing
#733
Remove EndOfFileTrivia
and always collect trivia after top-level parsing
#733
Conversation
|
...testing/snapshots/cst_output/TrailingTrivia/only_single_comment/generated/0.4.11-success.yml
Outdated
Show resolved
Hide resolved
...hots/cst_output/UsingDeconstructionSymbol/single_id_as_operator/generated/0.8.13-failure.yml
Outdated
Show resolved
Hide resolved
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.
Left a few questions/concerns
@@ -0,0 +1,2 @@ | |||
// first |
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.
nit: are the whitespaces intended here? I wonder if we should update the name of the test if so.
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.
I wanted to say that only a single comment is collected from the two; I've changed this to only_until_newline
to better convey the meaning that we should only collect... well, until the newline, as part of the trailing trivia.
Checks boxes in #640 #638
This adapts
ParserFunction
to always attempt parsing the leading trivia after we had a succesful match. This has a nice side benefit of not overwriting tokens that would allow for more progress when collecting the final trivia (unlike previous [AttemptedParseRule, EndOfFileTrivia] sequence).I'm not so happy with the resulting tree shape, however; IMO we should either:
Otherwise, a lone, final LeadingTrivia child belonging to the rule node seems misplaced and it's not intuitive for me to find the remaining trivia in that place. I'm open for other suggestions!