@willbooster/tree-sitter-javascript 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/grammar.js CHANGED
@@ -912,10 +912,22 @@ module.exports = grammar({
912
912
  template_string: ($) =>
913
913
  seq(
914
914
  '`',
915
- repeat(choice(alias($._template_chars, $.string_fragment), $.escape_sequence, $.template_substitution)),
915
+ repeat(
916
+ choice(
917
+ alias($._template_chars, $.string_fragment),
918
+ $.escape_sequence,
919
+ alias($._invalid_template_escape, $.escape_sequence),
920
+ $.template_substitution
921
+ )
922
+ ),
916
923
  '`'
917
924
  ),
918
925
 
926
+ // Tagged templates allow `\x` and `\u` without the hex digits an escape_sequence needs (the cooked string is
927
+ // undefined). The lexer prefers the longer escape_sequence when the digits follow. Untagged templates reject these
928
+ // escapes, but the lexer cannot tell the two apart.
929
+ _invalid_template_escape: () => token.immediate(seq('\\', /[xu]/)),
930
+
919
931
  template_substitution: ($) => seq('${', $._expressions, '}'),
920
932
 
921
933
  regex: ($) =>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-javascript",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "JavaScript grammar for tree-sitter",
5
5
  "keywords": [
6
6
  "incremental",
Binary file
package/tree-sitter.json CHANGED
@@ -16,7 +16,7 @@
16
16
  }
17
17
  ],
18
18
  "metadata": {
19
- "version": "1.0.1",
19
+ "version": "1.0.2",
20
20
  "license": "MIT",
21
21
  "description": "JavaScript grammar for tree-sitter",
22
22
  "authors": [