Skip to content
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

Scanner usability updates #14

Merged
merged 2 commits into from
Dec 9, 2024
Merged

Scanner usability updates #14

merged 2 commits into from
Dec 9, 2024

Conversation

keidax
Copy link
Collaborator

@keidax keidax commented Dec 9, 2024

  • Replace ASSERT macro with regular assert(). assert is what the external scanners use in other tree-sitter projects.
  • Improve readability of debug logs by adding [LOG] to everything that comes from our scanner, instead of using ==>.
  • Clean up some redundant log statements that just showed the return value.
  • Move the pre- and post-scan logging into a separate method.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
TREE_SITTER_INTERNAL_BUILD is removed, so we can't rely on that flag to
decide if assertions should `abort()`. Instead, just switch to the
standard `assert` macro, since other parsers use that.

See tree-sitter/tree-sitter#3228 (comment)
and https://github.com/tree-sitter/tree-sitter-ruby/blob/71bd32fb7607035768799732addba884a37a6210/src/scanner.c#L160

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
We can get rid of logs that just say "returning <SYMBOL>". These values
show up in the debug output like:
    lexed_lookahead sym:<symbol>, size:3
@nobodywasishere nobodywasishere merged commit 567af74 into main Dec 9, 2024
2 checks passed
@nobodywasishere nobodywasishere deleted the scanner-updates branch December 9, 2024 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants