Skip to content

Commit

Permalink
Include non-escaped string literal content in the parse tree
Browse files Browse the repository at this point in the history
  • Loading branch information
hvitved committed May 6, 2024
1 parent 80e623c commit dcf50ef
Show file tree
Hide file tree
Showing 8 changed files with 380 additions and 383 deletions.
3 changes: 3 additions & 0 deletions bindings/rust/build.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,16 @@ module.exports = grammar({

string: $ => choice(
seq('"', '"'),
seq('"', $.string_content, '"'),
seq('"', $._string_content, '"'),
),

string_content: $ => repeat1(choice(
token.immediate(prec(1, /[^\\"\n]+/)),
_string_content: $ => repeat1(choice(
$.string_content,
$.escape_sequence,
)),

string_content: _ => token.immediate(prec(1, /[^\\"\n]+/)),

escape_sequence: _ => token.immediate(seq(
'\\',
/(\"|\\|\/|b|f|n|r|t|u)/,
Expand Down
68 changes: 26 additions & 42 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 15 additions & 11 deletions src/grammar.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 8 additions & 15 deletions src/node-types.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit dcf50ef

Please sign in to comment.