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

Parser improvments: quoted heredocs and short-hand interpolations #225

Merged
merged 5 commits into from
Aug 24, 2022

Conversation

aibaars
Copy link
Contributor

@aibaars aibaars commented Aug 2, 2022

I auto-formatted src/scanner.cc in 293179e?w=1 . It's probably easiest to review on a commit-by-commit basis.

This pull request changes the scanner to no longer recognize interpolations and escape sequences in single quoted heredocs:

<<'EOF'
This is \not\ an interpolation: #{foo}
EOF

In addition it adds support for "short-hand" string interpolations of global, class, and instance variables, e.g:

"value: #@value"

Checklist:

  • All tests pass in CI.
  • There are sufficient tests for the new fix/feature.
  • Grammar rules have not been renamed unless absolutely necessary.
  • The conflicts section hasn't grown too much.
  • The parser size hasn't grown too much (check the value of STATE_COUNT in src/parser.c).

@aibaars aibaars force-pushed the parser-improvments branch from ac21ef9 to b38ceb5 Compare August 23, 2022 18:22
Copy link
Contributor

@hendrikvanantwerpen hendrikvanantwerpen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Just two small suggestions below.

grammar.js Show resolved Hide resolved
src/scanner.cc Show resolved Hide resolved
@aibaars aibaars merged commit 8a09e7e into tree-sitter:master Aug 24, 2022
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.

2 participants