tree-sitter-ruby icon indicating copy to clipboard operation
tree-sitter-ruby copied to clipboard

Parser improvments: quoted heredocs and short-hand interpolations

Open aibaars opened this issue 3 years ago • 0 comments

I auto-formatted src/scanner.cc in https://github.com/tree-sitter/tree-sitter-ruby/commit/ef073f7e70a1f41168f6c4740e2716c681cf484d?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:

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

aibaars avatar Aug 02 '22 11:08 aibaars