Repository navigation
Don't assume that null characters mean EOF - #475
Merged
Merged
Conversation
maxbrunsfeld
force-pushed
the
null-characters
branch
from
October 31, 2019 20:49
b57c542 to
0d95596
Compare
maxbrunsfeld
force-pushed
the
null-characters
branch
from
October 31, 2019 21:14
0d95596 to
d3b7caa
Compare
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 #280
In an early design mistake years ago, I decided to make the Tree-sitter library communicate the EOF state to the generated lexing functions via a special lookahead character of
'\0'. This is bad because some source code files contain'\0'(null characters) within the source.In this PR, I'm introducing a new lexer method
eof()that indicates that the lexer has reached the end of the file. As with #334, generated parsers will not actually use this new method unless you generate them withtree-sitter generate --next-abi. This is to allow them to be used with earlier versions of the Tree-sitter library.Soon, (once Atom has been upgraded to use the newest version of the library), I'll change the default behavior of
tree-sitter generateto rely on the new API.