Repository navigation
fix: match a line continuation at the end of input in the scanner - #363
Open
WillLillis wants to merge 6 commits into
Open
WillLillis wants to merge 6 commits into
WillLillis wants to merge 6 commits into
Conversation
The `'\0'` alternative in `line_continuation` matched the end of input in some lex states and not others, so a trailing `\` was a line continuation in some places and an error in others. `eof()` cannot replace it, because an extra cannot end with `eof()`. The external scanner already reads a `\` before the end of input while it looks for the end of a line. List `line_continuation` as an external token, so that the scanner returns it there, after any indent, dedent or new line. The token itself now always ends with a new line.
`_simple_statement` and `_compound_statement` have been inlined since before the grammar had supertypes, so the parser never had either symbol to report as one.
The Node binding test requires tree-sitter, but it was only an optional peer dependency, which npm does not install.
This was referenced Dec 1, 2026
2 tasks done
clason
approved these changes
Dec 2, 2026
Contributor
|
Thanks for all those fixes on grammars, @WillLillis :) I think it should be possible for downstream grammars (starlark, snakemake) to switch to our version of the Python grammar, but I'd be happy to look into adapting our publishing workflow if that's not the case. |
This branch has not been deployed
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.
The
'\0'alternative inline_continuationmatched the end of inputin some lex states and not others, so a trailing
\was a linecontinuation in some places and an error in others. CPython rejects a
line continuation at the end of a file, so this drops the alternative.
This update is being done to account for tree-sitter/tree-sitter#6146.