tree-sitter-ucode 0.1.0 → 0.2.0

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/src/scanner.c CHANGED
@@ -33,6 +33,9 @@ static bool scan_template_chars(TSLexer *lexer) {
33
33
  }
34
34
  }
35
35
 
36
+ // Implements the three ASI rules from ECMA-262 §12.10 (Automatic Semicolon
37
+ // Insertion): insert before a token that the grammar doesn't allow if (1) a
38
+ // line terminator precedes it, (2) it is `}`, or (3) the input is exhausted.
36
39
  static bool scan_automatic_semicolon(TSLexer *lexer) {
37
40
  lexer->result_symbol = AUTOMATIC_SEMICOLON;
38
41
  lexer->mark_end(lexer);
@@ -57,8 +60,7 @@ static bool scan_automatic_semicolon(TSLexer *lexer) {
57
60
  }
58
61
 
59
62
  // Skip inline whitespace (any Unicode space that is not a line terminator)
60
- if (lexer->lookahead != '\r' && lexer->lookahead != 0x2028 && lexer->lookahead != 0x2029 &&
61
- iswspace(lexer->lookahead)) {
63
+ if (iswspace(lexer->lookahead)) {
62
64
  skip(lexer);
63
65
  continue;
64
66
  }
@@ -141,10 +143,9 @@ static bool scan_automatic_semicolon(TSLexer *lexer) {
141
143
  break;
142
144
  }
143
145
 
144
- // These tokens can never start a new statement continuation:
145
- // they must be a new statement, so ASI applies
146
+ // Tokens that can continue the prior expression suppress ASI;
147
+ // anything else (identifier, keyword, number, …) gets one inserted.
146
148
  switch (lexer->lookahead) {
147
- // Things that could continue the expression — no ASI
148
149
  case '(': case '[': case '`':
149
150
  case '.': case ',': case ';':
150
151
  case '+': case '-': case '*': case '%':
package/tmpl/grammar.js CHANGED
@@ -36,7 +36,7 @@ module.exports = grammar({
36
36
  ],
37
37
 
38
38
  // The template scanner handles all whitespace explicitly; no implicit extras.
39
- extras: $ => [],
39
+ extras: _ => [],
40
40
 
41
41
  rules: {
42
42
  document: $ => repeat(choice(
package/tmpl/src/parser.c CHANGED
@@ -696,7 +696,7 @@ TS_PUBLIC const TSLanguage *tree_sitter_ucode_tmpl(void) {
696
696
  .max_reserved_word_set_size = 0,
697
697
  .metadata = {
698
698
  .major_version = 0,
699
- .minor_version = 1,
699
+ .minor_version = 2,
700
700
  .patch_version = 0,
701
701
  },
702
702
  };
Binary file
Binary file
package/tree-sitter.json CHANGED
@@ -41,7 +41,7 @@
41
41
  }
42
42
  ],
43
43
  "metadata": {
44
- "version": "0.1.0",
44
+ "version": "0.2.0",
45
45
  "license": "MIT",
46
46
  "description": "Ucode grammar for tree-sitter",
47
47
  "links": {