tree-sitter-ucode 0.1.0 → 0.1.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
@@ -4,7 +4,7 @@
4
4
  *
5
5
  * Based on tree-sitter-javascript (MIT, Max Brunsfeld, Amaan Qureshi).
6
6
  * Ucode is an ECMAScript-like language for OpenWrt system scripting.
7
- * See linter/diff-to-js.md for a full list of syntax differences from JS.
7
+ * See README.md for a full list of syntax differences from JavaScript.
8
8
  */
9
9
 
10
10
  /// <reference types="tree-sitter-cli/dsl" />
@@ -54,7 +54,7 @@ module.exports = grammar({
54
54
  'try',
55
55
  'while',
56
56
  ],
57
- properties: $ => [],
57
+ properties: _ => [],
58
58
  },
59
59
 
60
60
  supertypes: $ => [
@@ -84,7 +84,6 @@ module.exports = grammar({
84
84
  'binary_times',
85
85
  'binary_plus',
86
86
  'binary_shift',
87
- 'binary_compare',
88
87
  'binary_relation',
89
88
  'binary_equality',
90
89
  'bitwise_and',
@@ -106,16 +105,11 @@ module.exports = grammar({
106
105
  ],
107
106
 
108
107
  conflicts: $ => [
109
- [$.primary_expression, $._property_name],
110
- [$.primary_expression, $.arrow_function],
111
- [$.primary_expression, $.arrow_function, $._property_name],
112
108
  [$.primary_expression, $.formal_parameters],
113
109
  [$.primary_expression, $._for_header],
114
110
  [$.variable_declarator, $._for_header],
115
111
  [$.assignment_expression, $.pattern],
116
112
  [$.labeled_statement, $._property_name],
117
- [$.computed_property_name, $.array],
118
- [$.binary_expression, $._initializer],
119
113
  ],
120
114
 
121
115
  word: $ => $.identifier,
@@ -325,36 +319,12 @@ module.exports = grammar({
325
319
  ),
326
320
 
327
321
  for_statement: $ => seq(
328
- 'for',
329
- '(',
330
- choice(
331
- field('initializer', $.lexical_declaration),
332
- seq(field('initializer', $._expressions), ';'),
333
- field('initializer', $.empty_statement),
334
- ),
335
- field('condition', choice(
336
- seq($._expressions, ';'),
337
- $.empty_statement,
338
- )),
339
- field('increment', optional($._expressions)),
340
- ')',
322
+ forHeader($),
341
323
  field('body', $.statement),
342
324
  ),
343
325
 
344
326
  for_alt_statement: $ => seq(
345
- 'for',
346
- '(',
347
- choice(
348
- field('initializer', $.lexical_declaration),
349
- seq(field('initializer', $._expressions), ';'),
350
- field('initializer', $.empty_statement),
351
- ),
352
- field('condition', choice(
353
- seq($._expressions, ';'),
354
- $.empty_statement,
355
- )),
356
- field('increment', optional($._expressions)),
357
- ')',
327
+ forHeader($),
358
328
  ':',
359
329
  field('body', repeat($.statement)),
360
330
  'endfor',
@@ -680,7 +650,7 @@ module.exports = grammar({
680
650
  field('body', $.statement_block),
681
651
  )),
682
652
 
683
- // Named function declaration with brace body
653
+ // Function declaration brace body or alternative colon/endfunction syntax
684
654
  function_declaration: $ => prec.right('declaration', seq(
685
655
  'function',
686
656
  field('name', $.identifier),
@@ -765,7 +735,7 @@ module.exports = grammar({
765
735
  /x[0-9a-fA-F]{2}/,
766
736
  /u[0-9a-fA-F]{4}/,
767
737
  /u\{[0-9a-fA-F]+\}/,
768
- /[\r?][\n\u2028\u2029]/,
738
+ /\r[\n\u2028\u2029]/,
769
739
  ),
770
740
  )),
771
741
 
@@ -894,6 +864,24 @@ module.exports = grammar({
894
864
  },
895
865
  });
896
866
 
867
+ function forHeader($) {
868
+ return seq(
869
+ 'for',
870
+ '(',
871
+ choice(
872
+ field('initializer', $.lexical_declaration),
873
+ seq(field('initializer', $._expressions), ';'),
874
+ field('initializer', $.empty_statement),
875
+ ),
876
+ field('condition', choice(
877
+ seq($._expressions, ';'),
878
+ $.empty_statement,
879
+ )),
880
+ field('increment', optional($._expressions)),
881
+ ')',
882
+ );
883
+ }
884
+
897
885
  function commaSep1(rule) {
898
886
  return seq(rule, repeat(seq(',', rule)));
899
887
  }
package/package.json CHANGED
@@ -1,8 +1,11 @@
1
1
  {
2
2
  "name": "tree-sitter-ucode",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Ucode grammar for tree-sitter",
5
- "repository": "https://github.com/m00qek/tree-sitter-ucode",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/m00qek/tree-sitter-ucode.git"
8
+ },
6
9
  "license": "MIT",
7
10
  "main": "bindings/node",
8
11
  "types": "bindings/node",
package/src/grammar.json CHANGED
@@ -862,96 +862,101 @@
862
862
  "type": "SEQ",
863
863
  "members": [
864
864
  {
865
- "type": "STRING",
866
- "value": "for"
867
- },
868
- {
869
- "type": "STRING",
870
- "value": "("
871
- },
872
- {
873
- "type": "CHOICE",
865
+ "type": "SEQ",
874
866
  "members": [
875
867
  {
876
- "type": "FIELD",
877
- "name": "initializer",
878
- "content": {
879
- "type": "SYMBOL",
880
- "name": "lexical_declaration"
881
- }
868
+ "type": "STRING",
869
+ "value": "for"
882
870
  },
883
871
  {
884
- "type": "SEQ",
872
+ "type": "STRING",
873
+ "value": "("
874
+ },
875
+ {
876
+ "type": "CHOICE",
885
877
  "members": [
886
878
  {
887
879
  "type": "FIELD",
888
880
  "name": "initializer",
889
881
  "content": {
890
882
  "type": "SYMBOL",
891
- "name": "_expressions"
883
+ "name": "lexical_declaration"
892
884
  }
893
885
  },
894
886
  {
895
- "type": "STRING",
896
- "value": ";"
887
+ "type": "SEQ",
888
+ "members": [
889
+ {
890
+ "type": "FIELD",
891
+ "name": "initializer",
892
+ "content": {
893
+ "type": "SYMBOL",
894
+ "name": "_expressions"
895
+ }
896
+ },
897
+ {
898
+ "type": "STRING",
899
+ "value": ";"
900
+ }
901
+ ]
902
+ },
903
+ {
904
+ "type": "FIELD",
905
+ "name": "initializer",
906
+ "content": {
907
+ "type": "SYMBOL",
908
+ "name": "empty_statement"
909
+ }
897
910
  }
898
911
  ]
899
912
  },
900
913
  {
901
914
  "type": "FIELD",
902
- "name": "initializer",
915
+ "name": "condition",
903
916
  "content": {
904
- "type": "SYMBOL",
905
- "name": "empty_statement"
917
+ "type": "CHOICE",
918
+ "members": [
919
+ {
920
+ "type": "SEQ",
921
+ "members": [
922
+ {
923
+ "type": "SYMBOL",
924
+ "name": "_expressions"
925
+ },
926
+ {
927
+ "type": "STRING",
928
+ "value": ";"
929
+ }
930
+ ]
931
+ },
932
+ {
933
+ "type": "SYMBOL",
934
+ "name": "empty_statement"
935
+ }
936
+ ]
906
937
  }
907
- }
908
- ]
909
- },
910
- {
911
- "type": "FIELD",
912
- "name": "condition",
913
- "content": {
914
- "type": "CHOICE",
915
- "members": [
916
- {
917
- "type": "SEQ",
938
+ },
939
+ {
940
+ "type": "FIELD",
941
+ "name": "increment",
942
+ "content": {
943
+ "type": "CHOICE",
918
944
  "members": [
919
945
  {
920
946
  "type": "SYMBOL",
921
947
  "name": "_expressions"
922
948
  },
923
949
  {
924
- "type": "STRING",
925
- "value": ";"
950
+ "type": "BLANK"
926
951
  }
927
952
  ]
928
- },
929
- {
930
- "type": "SYMBOL",
931
- "name": "empty_statement"
932
- }
933
- ]
934
- }
935
- },
936
- {
937
- "type": "FIELD",
938
- "name": "increment",
939
- "content": {
940
- "type": "CHOICE",
941
- "members": [
942
- {
943
- "type": "SYMBOL",
944
- "name": "_expressions"
945
- },
946
- {
947
- "type": "BLANK"
948
953
  }
949
- ]
950
- }
951
- },
952
- {
953
- "type": "STRING",
954
- "value": ")"
954
+ },
955
+ {
956
+ "type": "STRING",
957
+ "value": ")"
958
+ }
959
+ ]
955
960
  },
956
961
  {
957
962
  "type": "FIELD",
@@ -967,96 +972,101 @@
967
972
  "type": "SEQ",
968
973
  "members": [
969
974
  {
970
- "type": "STRING",
971
- "value": "for"
972
- },
973
- {
974
- "type": "STRING",
975
- "value": "("
976
- },
977
- {
978
- "type": "CHOICE",
975
+ "type": "SEQ",
979
976
  "members": [
980
977
  {
981
- "type": "FIELD",
982
- "name": "initializer",
983
- "content": {
984
- "type": "SYMBOL",
985
- "name": "lexical_declaration"
986
- }
978
+ "type": "STRING",
979
+ "value": "for"
987
980
  },
988
981
  {
989
- "type": "SEQ",
982
+ "type": "STRING",
983
+ "value": "("
984
+ },
985
+ {
986
+ "type": "CHOICE",
990
987
  "members": [
991
988
  {
992
989
  "type": "FIELD",
993
990
  "name": "initializer",
994
991
  "content": {
995
992
  "type": "SYMBOL",
996
- "name": "_expressions"
993
+ "name": "lexical_declaration"
997
994
  }
998
995
  },
999
996
  {
1000
- "type": "STRING",
1001
- "value": ";"
997
+ "type": "SEQ",
998
+ "members": [
999
+ {
1000
+ "type": "FIELD",
1001
+ "name": "initializer",
1002
+ "content": {
1003
+ "type": "SYMBOL",
1004
+ "name": "_expressions"
1005
+ }
1006
+ },
1007
+ {
1008
+ "type": "STRING",
1009
+ "value": ";"
1010
+ }
1011
+ ]
1012
+ },
1013
+ {
1014
+ "type": "FIELD",
1015
+ "name": "initializer",
1016
+ "content": {
1017
+ "type": "SYMBOL",
1018
+ "name": "empty_statement"
1019
+ }
1002
1020
  }
1003
1021
  ]
1004
1022
  },
1005
1023
  {
1006
1024
  "type": "FIELD",
1007
- "name": "initializer",
1025
+ "name": "condition",
1008
1026
  "content": {
1009
- "type": "SYMBOL",
1010
- "name": "empty_statement"
1027
+ "type": "CHOICE",
1028
+ "members": [
1029
+ {
1030
+ "type": "SEQ",
1031
+ "members": [
1032
+ {
1033
+ "type": "SYMBOL",
1034
+ "name": "_expressions"
1035
+ },
1036
+ {
1037
+ "type": "STRING",
1038
+ "value": ";"
1039
+ }
1040
+ ]
1041
+ },
1042
+ {
1043
+ "type": "SYMBOL",
1044
+ "name": "empty_statement"
1045
+ }
1046
+ ]
1011
1047
  }
1012
- }
1013
- ]
1014
- },
1015
- {
1016
- "type": "FIELD",
1017
- "name": "condition",
1018
- "content": {
1019
- "type": "CHOICE",
1020
- "members": [
1021
- {
1022
- "type": "SEQ",
1048
+ },
1049
+ {
1050
+ "type": "FIELD",
1051
+ "name": "increment",
1052
+ "content": {
1053
+ "type": "CHOICE",
1023
1054
  "members": [
1024
1055
  {
1025
1056
  "type": "SYMBOL",
1026
1057
  "name": "_expressions"
1027
1058
  },
1028
1059
  {
1029
- "type": "STRING",
1030
- "value": ";"
1060
+ "type": "BLANK"
1031
1061
  }
1032
1062
  ]
1033
- },
1034
- {
1035
- "type": "SYMBOL",
1036
- "name": "empty_statement"
1037
- }
1038
- ]
1039
- }
1040
- },
1041
- {
1042
- "type": "FIELD",
1043
- "name": "increment",
1044
- "content": {
1045
- "type": "CHOICE",
1046
- "members": [
1047
- {
1048
- "type": "SYMBOL",
1049
- "name": "_expressions"
1050
- },
1051
- {
1052
- "type": "BLANK"
1053
1063
  }
1054
- ]
1055
- }
1056
- },
1057
- {
1058
- "type": "STRING",
1059
- "value": ")"
1064
+ },
1065
+ {
1066
+ "type": "STRING",
1067
+ "value": ")"
1068
+ }
1069
+ ]
1060
1070
  },
1061
1071
  {
1062
1072
  "type": "STRING",
@@ -3774,7 +3784,7 @@
3774
3784
  },
3775
3785
  {
3776
3786
  "type": "PATTERN",
3777
- "value": "[\\r?][\\n\\u2028\\u2029]"
3787
+ "value": "\\r[\\n\\u2028\\u2029]"
3778
3788
  }
3779
3789
  ]
3780
3790
  }
@@ -4688,19 +4698,6 @@
4688
4698
  }
4689
4699
  ],
4690
4700
  "conflicts": [
4691
- [
4692
- "primary_expression",
4693
- "_property_name"
4694
- ],
4695
- [
4696
- "primary_expression",
4697
- "arrow_function"
4698
- ],
4699
- [
4700
- "primary_expression",
4701
- "arrow_function",
4702
- "_property_name"
4703
- ],
4704
4701
  [
4705
4702
  "primary_expression",
4706
4703
  "formal_parameters"
@@ -4720,14 +4717,6 @@
4720
4717
  [
4721
4718
  "labeled_statement",
4722
4719
  "_property_name"
4723
- ],
4724
- [
4725
- "computed_property_name",
4726
- "array"
4727
- ],
4728
- [
4729
- "binary_expression",
4730
- "_initializer"
4731
4720
  ]
4732
4721
  ],
4733
4722
  "precedences": [
@@ -4764,10 +4753,6 @@
4764
4753
  "type": "STRING",
4765
4754
  "value": "binary_shift"
4766
4755
  },
4767
- {
4768
- "type": "STRING",
4769
- "value": "binary_compare"
4770
- },
4771
4756
  {
4772
4757
  "type": "STRING",
4773
4758
  "value": "binary_relation"
package/src/parser.c CHANGED
@@ -2620,7 +2620,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
2620
2620
  ADVANCE_MAP(
2621
2621
  '!', 129,
2622
2622
  '"', 134,
2623
- '#', 2,
2623
+ '#', 4,
2624
2624
  '$', 172,
2625
2625
  '%', 113,
2626
2626
  '&', 100,
@@ -2639,9 +2639,9 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
2639
2639
  '<', 116,
2640
2640
  '=', 75,
2641
2641
  '>', 124,
2642
- '?', 14,
2642
+ '?', 16,
2643
2643
  '[', 69,
2644
- '\\', 22,
2644
+ '\\', 2,
2645
2645
  ']', 70,
2646
2646
  '^', 103,
2647
2647
  '`', 155,
@@ -2655,19 +2655,33 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
2655
2655
  if (lookahead > '@') ADVANCE(173);
2656
2656
  END_STATE();
2657
2657
  case 1:
2658
- if (lookahead == '\n') SKIP(18);
2659
- if (lookahead == '/') ADVANCE(10);
2660
- if (lookahead == '[') ADVANCE(21);
2658
+ if (lookahead == '\n') SKIP(20);
2659
+ if (lookahead == '/') ADVANCE(12);
2660
+ if (lookahead == '[') ADVANCE(23);
2661
2661
  if (lookahead == '\\') ADVANCE(53);
2662
2662
  if (set_contains(extras_character_set_1, 10, lookahead)) ADVANCE(158);
2663
2663
  if (lookahead != 0) ADVANCE(159);
2664
2664
  END_STATE();
2665
2665
  case 2:
2666
- if (lookahead == '!') ADVANCE(58);
2666
+ if (lookahead == '\r') ADVANCE(150);
2667
+ if (lookahead == 'u') ADVANCE(26);
2668
+ if (lookahead == 'x') ADVANCE(47);
2669
+ if (('0' <= lookahead && lookahead <= '7')) ADVANCE(152);
2670
+ if (lookahead != 0) ADVANCE(148);
2667
2671
  END_STATE();
2668
2672
  case 3:
2673
+ if (lookahead == '\r') ADVANCE(150);
2674
+ if (lookahead == 'u') ADVANCE(28);
2675
+ if (lookahead == 'x') ADVANCE(47);
2676
+ if (('0' <= lookahead && lookahead <= '7')) ADVANCE(152);
2677
+ if (lookahead != 0) ADVANCE(148);
2678
+ END_STATE();
2679
+ case 4:
2680
+ if (lookahead == '!') ADVANCE(58);
2681
+ END_STATE();
2682
+ case 5:
2669
2683
  ADVANCE_MAP(
2670
- '!', 19,
2684
+ '!', 21,
2671
2685
  '%', 113,
2672
2686
  '&', 100,
2673
2687
  '(', 66,
@@ -2683,127 +2697,111 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
2683
2697
  '<', 116,
2684
2698
  '=', 75,
2685
2699
  '>', 124,
2686
- '?', 14,
2700
+ '?', 16,
2687
2701
  '[', 69,
2688
- '\\', 23,
2702
+ '\\', 24,
2689
2703
  ']', 70,
2690
2704
  '^', 103,
2691
2705
  '|', 104,
2692
2706
  '}', 61,
2693
2707
  );
2694
- if (set_contains(extras_character_set_1, 10, lookahead)) SKIP(3);
2708
+ if (set_contains(extras_character_set_1, 10, lookahead)) SKIP(5);
2695
2709
  if (lookahead > '#' &&
2696
2710
  (lookahead < '%' || '@' < lookahead) &&
2697
2711
  lookahead != '`' &&
2698
2712
  (lookahead < '{' || '~' < lookahead)) ADVANCE(173);
2699
2713
  END_STATE();
2700
- case 4:
2714
+ case 6:
2701
2715
  if (lookahead == '"') ADVANCE(134);
2702
- if (lookahead == '/') ADVANCE(10);
2703
- if (set_contains(extras_character_set_1, 10, lookahead)) SKIP(4);
2716
+ if (lookahead == '/') ADVANCE(12);
2717
+ if (set_contains(extras_character_set_1, 10, lookahead)) SKIP(6);
2704
2718
  END_STATE();
2705
- case 5:
2719
+ case 7:
2706
2720
  if (lookahead == '"') ADVANCE(134);
2707
2721
  if (lookahead == '/') ADVANCE(136);
2708
- if (lookahead == '\\') ADVANCE(24);
2722
+ if (lookahead == '\\') ADVANCE(3);
2709
2723
  if (lookahead == '\n' ||
2710
- lookahead == '\r') SKIP(4);
2724
+ lookahead == '\r') SKIP(6);
2711
2725
  if (set_contains(extras_character_set_1, 10, lookahead)) ADVANCE(139);
2712
2726
  if (lookahead != 0) ADVANCE(141);
2713
2727
  END_STATE();
2714
- case 6:
2728
+ case 8:
2715
2729
  if (lookahead == '$') ADVANCE(25);
2716
- if (lookahead == '/') ADVANCE(10);
2717
- if (lookahead == '\\') ADVANCE(24);
2730
+ if (lookahead == '/') ADVANCE(12);
2731
+ if (lookahead == '\\') ADVANCE(3);
2718
2732
  if (lookahead == '`') ADVANCE(155);
2719
- if (set_contains(extras_character_set_1, 10, lookahead)) SKIP(7);
2733
+ if (set_contains(extras_character_set_1, 10, lookahead)) SKIP(9);
2720
2734
  END_STATE();
2721
- case 7:
2735
+ case 9:
2722
2736
  if (lookahead == '$') ADVANCE(25);
2723
- if (lookahead == '/') ADVANCE(10);
2737
+ if (lookahead == '/') ADVANCE(12);
2724
2738
  if (lookahead == '`') ADVANCE(155);
2725
- if (set_contains(extras_character_set_1, 10, lookahead)) SKIP(7);
2739
+ if (set_contains(extras_character_set_1, 10, lookahead)) SKIP(9);
2726
2740
  END_STATE();
2727
- case 8:
2741
+ case 10:
2728
2742
  if (lookahead == '\'') ADVANCE(135);
2729
- if (lookahead == '/') ADVANCE(10);
2730
- if (set_contains(extras_character_set_1, 10, lookahead)) SKIP(8);
2743
+ if (lookahead == '/') ADVANCE(12);
2744
+ if (set_contains(extras_character_set_1, 10, lookahead)) SKIP(10);
2731
2745
  END_STATE();
2732
- case 9:
2746
+ case 11:
2733
2747
  if (lookahead == '\'') ADVANCE(135);
2734
2748
  if (lookahead == '/') ADVANCE(142);
2735
- if (lookahead == '\\') ADVANCE(24);
2749
+ if (lookahead == '\\') ADVANCE(3);
2736
2750
  if (lookahead == '\n' ||
2737
- lookahead == '\r') SKIP(8);
2751
+ lookahead == '\r') SKIP(10);
2738
2752
  if (set_contains(extras_character_set_1, 10, lookahead)) ADVANCE(145);
2739
2753
  if (lookahead != 0) ADVANCE(147);
2740
2754
  END_STATE();
2741
- case 10:
2742
- if (lookahead == '*') ADVANCE(12);
2755
+ case 12:
2756
+ if (lookahead == '*') ADVANCE(14);
2743
2757
  if (lookahead == '/') ADVANCE(154);
2744
2758
  END_STATE();
2745
- case 11:
2746
- if (lookahead == '*') ADVANCE(11);
2759
+ case 13:
2760
+ if (lookahead == '*') ADVANCE(13);
2747
2761
  if (lookahead == '/') ADVANCE(153);
2748
- if (lookahead != 0) ADVANCE(12);
2762
+ if (lookahead != 0) ADVANCE(14);
2749
2763
  END_STATE();
2750
- case 12:
2751
- if (lookahead == '*') ADVANCE(11);
2752
- if (lookahead != 0) ADVANCE(12);
2764
+ case 14:
2765
+ if (lookahead == '*') ADVANCE(13);
2766
+ if (lookahead != 0) ADVANCE(14);
2753
2767
  END_STATE();
2754
- case 13:
2755
- if (lookahead == '.') ADVANCE(16);
2768
+ case 15:
2769
+ if (lookahead == '.') ADVANCE(18);
2756
2770
  if (('0' <= lookahead && lookahead <= '9')) ADVANCE(168);
2757
2771
  END_STATE();
2758
- case 14:
2772
+ case 16:
2759
2773
  if (lookahead == '.') ADVANCE(71);
2760
2774
  if (lookahead == '?') ADVANCE(127);
2761
2775
  END_STATE();
2762
- case 15:
2776
+ case 17:
2763
2777
  if (lookahead == '.') ADVANCE(71);
2764
2778
  if (lookahead == '?') ADVANCE(126);
2765
2779
  END_STATE();
2766
- case 16:
2780
+ case 18:
2767
2781
  if (lookahead == '.') ADVANCE(91);
2768
2782
  END_STATE();
2769
- case 17:
2783
+ case 19:
2770
2784
  if (lookahead == '/') ADVANCE(157);
2771
- if (set_contains(extras_character_set_1, 10, lookahead)) SKIP(18);
2785
+ if (set_contains(extras_character_set_1, 10, lookahead)) SKIP(20);
2772
2786
  END_STATE();
2773
- case 18:
2774
- if (lookahead == '/') ADVANCE(10);
2775
- if (set_contains(extras_character_set_1, 10, lookahead)) SKIP(18);
2787
+ case 20:
2788
+ if (lookahead == '/') ADVANCE(12);
2789
+ if (set_contains(extras_character_set_1, 10, lookahead)) SKIP(20);
2776
2790
  END_STATE();
2777
- case 19:
2791
+ case 21:
2778
2792
  if (lookahead == '=') ADVANCE(121);
2779
2793
  END_STATE();
2780
- case 20:
2794
+ case 22:
2781
2795
  if (lookahead == '=') ADVANCE(119);
2782
2796
  END_STATE();
2783
- case 21:
2797
+ case 23:
2784
2798
  if (lookahead == '\\') ADVANCE(52);
2785
2799
  if (lookahead == ']') ADVANCE(159);
2786
2800
  if (lookahead != 0 &&
2787
- lookahead != '\n') ADVANCE(21);
2788
- END_STATE();
2789
- case 22:
2790
- if (lookahead == 'u') ADVANCE(26);
2791
- if (lookahead == 'x') ADVANCE(47);
2792
- if (lookahead == '\r' ||
2793
- lookahead == '?') ADVANCE(150);
2794
- if (('0' <= lookahead && lookahead <= '7')) ADVANCE(152);
2795
- if (lookahead != 0) ADVANCE(148);
2796
- END_STATE();
2797
- case 23:
2798
- if (lookahead == 'u') ADVANCE(27);
2801
+ lookahead != '\n') ADVANCE(23);
2799
2802
  END_STATE();
2800
2803
  case 24:
2801
- if (lookahead == 'u') ADVANCE(28);
2802
- if (lookahead == 'x') ADVANCE(47);
2803
- if (lookahead == '\r' ||
2804
- lookahead == '?') ADVANCE(150);
2805
- if (('0' <= lookahead && lookahead <= '7')) ADVANCE(152);
2806
- if (lookahead != 0) ADVANCE(148);
2804
+ if (lookahead == 'u') ADVANCE(27);
2807
2805
  END_STATE();
2808
2806
  case 25:
2809
2807
  if (lookahead == '{') ADVANCE(156);
@@ -2937,7 +2935,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
2937
2935
  END_STATE();
2938
2936
  case 52:
2939
2937
  if (lookahead != 0 &&
2940
- lookahead != '\n') ADVANCE(21);
2938
+ lookahead != '\n') ADVANCE(23);
2941
2939
  END_STATE();
2942
2940
  case 53:
2943
2941
  if (lookahead != 0 &&
@@ -2948,7 +2946,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
2948
2946
  ADVANCE_MAP(
2949
2947
  '!', 129,
2950
2948
  '"', 134,
2951
- '#', 2,
2949
+ '#', 4,
2952
2950
  '$', 172,
2953
2951
  '%', 113,
2954
2952
  '&', 100,
@@ -2967,9 +2965,9 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
2967
2965
  '<', 116,
2968
2966
  '=', 75,
2969
2967
  '>', 124,
2970
- '?', 14,
2968
+ '?', 16,
2971
2969
  '[', 69,
2972
- '\\', 23,
2970
+ '\\', 24,
2973
2971
  ']', 70,
2974
2972
  '^', 103,
2975
2973
  '`', 155,
@@ -3002,11 +3000,11 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
3002
3000
  ':', 65,
3003
3001
  ';', 67,
3004
3002
  '<', 117,
3005
- '=', 20,
3003
+ '=', 22,
3006
3004
  '>', 125,
3007
- '?', 15,
3005
+ '?', 17,
3008
3006
  '[', 69,
3009
- '\\', 23,
3007
+ '\\', 24,
3010
3008
  ']', 70,
3011
3009
  '^', 102,
3012
3010
  '`', 155,
@@ -3025,7 +3023,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
3025
3023
  ADVANCE_MAP(
3026
3024
  '!', 128,
3027
3025
  '"', 134,
3028
- '#', 2,
3026
+ '#', 4,
3029
3027
  '\'', 135,
3030
3028
  '(', 66,
3031
3029
  ')', 68,
@@ -3033,14 +3031,14 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
3033
3031
  '+', 106,
3034
3032
  ',', 60,
3035
3033
  '-', 108,
3036
- '.', 13,
3034
+ '.', 15,
3037
3035
  '/', 110,
3038
3036
  '0', 160,
3039
3037
  ':', 65,
3040
3038
  ';', 67,
3041
3039
  '=', 76,
3042
3040
  '[', 69,
3043
- '\\', 23,
3041
+ '\\', 24,
3044
3042
  ']', 70,
3045
3043
  '`', 155,
3046
3044
  '{', 59,
@@ -3109,7 +3107,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
3109
3107
  END_STATE();
3110
3108
  case 73:
3111
3109
  ACCEPT_TOKEN(anon_sym_DOT);
3112
- if (lookahead == '.') ADVANCE(16);
3110
+ if (lookahead == '.') ADVANCE(18);
3113
3111
  if (('0' <= lookahead && lookahead <= '9')) ADVANCE(168);
3114
3112
  END_STATE();
3115
3113
  case 74:
@@ -3243,12 +3241,12 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
3243
3241
  END_STATE();
3244
3242
  case 110:
3245
3243
  ACCEPT_TOKEN(anon_sym_SLASH);
3246
- if (lookahead == '*') ADVANCE(12);
3244
+ if (lookahead == '*') ADVANCE(14);
3247
3245
  if (lookahead == '/') ADVANCE(154);
3248
3246
  END_STATE();
3249
3247
  case 111:
3250
3248
  ACCEPT_TOKEN(anon_sym_SLASH);
3251
- if (lookahead == '*') ADVANCE(12);
3249
+ if (lookahead == '*') ADVANCE(14);
3252
3250
  if (lookahead == '/') ADVANCE(154);
3253
3251
  if (lookahead == '=') ADVANCE(80);
3254
3252
  END_STATE();
@@ -3459,7 +3457,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
3459
3457
  END_STATE();
3460
3458
  case 149:
3461
3459
  ACCEPT_TOKEN(sym_escape_sequence);
3462
- if (lookahead == '\\') ADVANCE(23);
3460
+ if (lookahead == '\\') ADVANCE(24);
3463
3461
  if (set_contains(sym_identifier_character_set_2, 15, lookahead)) ADVANCE(173);
3464
3462
  END_STATE();
3465
3463
  case 150:
@@ -3498,16 +3496,16 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
3498
3496
  END_STATE();
3499
3497
  case 158:
3500
3498
  ACCEPT_TOKEN(sym_regex_pattern);
3501
- if (lookahead == '\n') SKIP(18);
3502
- if (lookahead == '/') ADVANCE(10);
3503
- if (lookahead == '[') ADVANCE(21);
3499
+ if (lookahead == '\n') SKIP(20);
3500
+ if (lookahead == '/') ADVANCE(12);
3501
+ if (lookahead == '[') ADVANCE(23);
3504
3502
  if (lookahead == '\\') ADVANCE(53);
3505
3503
  if (set_contains(extras_character_set_1, 10, lookahead)) ADVANCE(158);
3506
3504
  if (lookahead != 0) ADVANCE(159);
3507
3505
  END_STATE();
3508
3506
  case 159:
3509
3507
  ACCEPT_TOKEN(sym_regex_pattern);
3510
- if (lookahead == '[') ADVANCE(21);
3508
+ if (lookahead == '[') ADVANCE(23);
3511
3509
  if (lookahead == '\\') ADVANCE(53);
3512
3510
  if (lookahead != 0 &&
3513
3511
  lookahead != '\n' &&
@@ -3609,13 +3607,13 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
3609
3607
  END_STATE();
3610
3608
  case 172:
3611
3609
  ACCEPT_TOKEN(sym_identifier);
3612
- if (lookahead == '\\') ADVANCE(23);
3610
+ if (lookahead == '\\') ADVANCE(24);
3613
3611
  if (lookahead == '{') ADVANCE(156);
3614
3612
  if (set_contains(sym_identifier_character_set_2, 15, lookahead)) ADVANCE(173);
3615
3613
  END_STATE();
3616
3614
  case 173:
3617
3615
  ACCEPT_TOKEN(sym_identifier);
3618
- if (lookahead == '\\') ADVANCE(23);
3616
+ if (lookahead == '\\') ADVANCE(24);
3619
3617
  if (set_contains(sym_identifier_character_set_2, 15, lookahead)) ADVANCE(173);
3620
3618
  END_STATE();
3621
3619
  default:
@@ -4165,8 +4163,8 @@ static const TSLexerMode ts_lex_modes[STATE_COUNT] = {
4165
4163
  [65] = {.lex_state = 55, .external_lex_state = 2, .reserved_word_set_id = 8},
4166
4164
  [66] = {.lex_state = 55, .external_lex_state = 2, .reserved_word_set_id = 8},
4167
4165
  [67] = {.lex_state = 55, .external_lex_state = 2, .reserved_word_set_id = 8},
4168
- [68] = {.lex_state = 3, .external_lex_state = 2, .reserved_word_set_id = 9},
4169
- [69] = {.lex_state = 3, .external_lex_state = 2, .reserved_word_set_id = 9},
4166
+ [68] = {.lex_state = 5, .external_lex_state = 2, .reserved_word_set_id = 9},
4167
+ [69] = {.lex_state = 5, .external_lex_state = 2, .reserved_word_set_id = 9},
4170
4168
  [70] = {.lex_state = 56, .reserved_word_set_id = 1},
4171
4169
  [71] = {.lex_state = 56, .reserved_word_set_id = 10},
4172
4170
  [72] = {.lex_state = 56, .reserved_word_set_id = 10},
@@ -4174,39 +4172,39 @@ static const TSLexerMode ts_lex_modes[STATE_COUNT] = {
4174
4172
  [74] = {.lex_state = 56, .reserved_word_set_id = 10},
4175
4173
  [75] = {.lex_state = 56, .reserved_word_set_id = 10},
4176
4174
  [76] = {.lex_state = 56, .reserved_word_set_id = 10},
4177
- [77] = {.lex_state = 3, .external_lex_state = 2},
4175
+ [77] = {.lex_state = 5, .external_lex_state = 2},
4178
4176
  [78] = {.lex_state = 56, .reserved_word_set_id = 10},
4179
- [79] = {.lex_state = 3, .external_lex_state = 2, .reserved_word_set_id = 9},
4177
+ [79] = {.lex_state = 5, .external_lex_state = 2, .reserved_word_set_id = 9},
4180
4178
  [80] = {.lex_state = 56, .reserved_word_set_id = 10},
4181
- [81] = {.lex_state = 3, .external_lex_state = 3},
4182
- [82] = {.lex_state = 3, .external_lex_state = 3},
4183
- [83] = {.lex_state = 3, .external_lex_state = 2},
4184
- [84] = {.lex_state = 3, .external_lex_state = 2},
4185
- [85] = {.lex_state = 3, .external_lex_state = 2},
4179
+ [81] = {.lex_state = 5, .external_lex_state = 3},
4180
+ [82] = {.lex_state = 5, .external_lex_state = 3},
4181
+ [83] = {.lex_state = 5, .external_lex_state = 2},
4182
+ [84] = {.lex_state = 5, .external_lex_state = 2},
4183
+ [85] = {.lex_state = 5, .external_lex_state = 2},
4186
4184
  [86] = {.lex_state = 56, .reserved_word_set_id = 10},
4187
4185
  [87] = {.lex_state = 56, .reserved_word_set_id = 10},
4188
4186
  [88] = {.lex_state = 56, .external_lex_state = 4, .reserved_word_set_id = 10},
4189
- [89] = {.lex_state = 3, .external_lex_state = 3},
4190
- [90] = {.lex_state = 3, .external_lex_state = 3},
4191
- [91] = {.lex_state = 3, .external_lex_state = 3},
4192
- [92] = {.lex_state = 3, .external_lex_state = 3},
4193
- [93] = {.lex_state = 3, .external_lex_state = 3},
4194
- [94] = {.lex_state = 3, .external_lex_state = 3},
4187
+ [89] = {.lex_state = 5, .external_lex_state = 3},
4188
+ [90] = {.lex_state = 5, .external_lex_state = 3},
4189
+ [91] = {.lex_state = 5, .external_lex_state = 3},
4190
+ [92] = {.lex_state = 5, .external_lex_state = 3},
4191
+ [93] = {.lex_state = 5, .external_lex_state = 3},
4192
+ [94] = {.lex_state = 5, .external_lex_state = 3},
4195
4193
  [95] = {.lex_state = 56, .reserved_word_set_id = 10},
4196
4194
  [96] = {.lex_state = 56, .reserved_word_set_id = 10},
4197
- [97] = {.lex_state = 3, .external_lex_state = 2},
4198
- [98] = {.lex_state = 3, .external_lex_state = 2},
4195
+ [97] = {.lex_state = 5, .external_lex_state = 2},
4196
+ [98] = {.lex_state = 5, .external_lex_state = 2},
4199
4197
  [99] = {.lex_state = 56, .reserved_word_set_id = 10},
4200
4198
  [100] = {.lex_state = 56, .reserved_word_set_id = 10},
4201
- [101] = {.lex_state = 3, .external_lex_state = 3, .reserved_word_set_id = 1},
4199
+ [101] = {.lex_state = 5, .external_lex_state = 3, .reserved_word_set_id = 1},
4202
4200
  [102] = {.lex_state = 56, .reserved_word_set_id = 1},
4203
4201
  [103] = {.lex_state = 56, .reserved_word_set_id = 1},
4204
4202
  [104] = {.lex_state = 56, .reserved_word_set_id = 10},
4205
4203
  [105] = {.lex_state = 56, .reserved_word_set_id = 10},
4206
- [106] = {.lex_state = 3, .external_lex_state = 3},
4204
+ [106] = {.lex_state = 5, .external_lex_state = 3},
4207
4205
  [107] = {.lex_state = 56, .reserved_word_set_id = 10},
4208
4206
  [108] = {.lex_state = 56, .reserved_word_set_id = 1},
4209
- [109] = {.lex_state = 3, .external_lex_state = 2},
4207
+ [109] = {.lex_state = 5, .external_lex_state = 2},
4210
4208
  [110] = {.lex_state = 56, .reserved_word_set_id = 1},
4211
4209
  [111] = {.lex_state = 56, .reserved_word_set_id = 1},
4212
4210
  [112] = {.lex_state = 56, .reserved_word_set_id = 10},
@@ -4215,7 +4213,7 @@ static const TSLexerMode ts_lex_modes[STATE_COUNT] = {
4215
4213
  [115] = {.lex_state = 56, .reserved_word_set_id = 10},
4216
4214
  [116] = {.lex_state = 56, .reserved_word_set_id = 1},
4217
4215
  [117] = {.lex_state = 56, .reserved_word_set_id = 10},
4218
- [118] = {.lex_state = 3, .external_lex_state = 2},
4216
+ [118] = {.lex_state = 5, .external_lex_state = 2},
4219
4217
  [119] = {.lex_state = 56, .reserved_word_set_id = 1},
4220
4218
  [120] = {.lex_state = 56, .reserved_word_set_id = 1},
4221
4219
  [121] = {.lex_state = 56, .reserved_word_set_id = 10},
@@ -4224,18 +4222,18 @@ static const TSLexerMode ts_lex_modes[STATE_COUNT] = {
4224
4222
  [124] = {.lex_state = 56, .reserved_word_set_id = 10},
4225
4223
  [125] = {.lex_state = 56, .reserved_word_set_id = 10},
4226
4224
  [126] = {.lex_state = 56, .reserved_word_set_id = 12},
4227
- [127] = {.lex_state = 3, .external_lex_state = 2},
4225
+ [127] = {.lex_state = 5, .external_lex_state = 2},
4228
4226
  [128] = {.lex_state = 56, .reserved_word_set_id = 10},
4229
4227
  [129] = {.lex_state = 56, .external_lex_state = 4, .reserved_word_set_id = 12},
4230
4228
  [130] = {.lex_state = 56, .reserved_word_set_id = 10},
4231
4229
  [131] = {.lex_state = 56, .reserved_word_set_id = 10},
4232
4230
  [132] = {.lex_state = 56, .reserved_word_set_id = 10},
4233
4231
  [133] = {.lex_state = 56, .reserved_word_set_id = 10},
4234
- [134] = {.lex_state = 3, .external_lex_state = 2},
4232
+ [134] = {.lex_state = 5, .external_lex_state = 2},
4235
4233
  [135] = {.lex_state = 56, .reserved_word_set_id = 10},
4236
4234
  [136] = {.lex_state = 56, .reserved_word_set_id = 10},
4237
- [137] = {.lex_state = 3, .external_lex_state = 2},
4238
- [138] = {.lex_state = 3, .external_lex_state = 2},
4235
+ [137] = {.lex_state = 5, .external_lex_state = 2},
4236
+ [138] = {.lex_state = 5, .external_lex_state = 2},
4239
4237
  [139] = {.lex_state = 56, .reserved_word_set_id = 10},
4240
4238
  [140] = {.lex_state = 56, .reserved_word_set_id = 10},
4241
4239
  [141] = {.lex_state = 56, .reserved_word_set_id = 10},
@@ -4251,7 +4249,7 @@ static const TSLexerMode ts_lex_modes[STATE_COUNT] = {
4251
4249
  [151] = {.lex_state = 56, .reserved_word_set_id = 10},
4252
4250
  [152] = {.lex_state = 56, .reserved_word_set_id = 10},
4253
4251
  [153] = {.lex_state = 56, .reserved_word_set_id = 1},
4254
- [154] = {.lex_state = 3, .external_lex_state = 2},
4252
+ [154] = {.lex_state = 5, .external_lex_state = 2},
4255
4253
  [155] = {.lex_state = 56, .reserved_word_set_id = 1},
4256
4254
  [156] = {.lex_state = 56, .reserved_word_set_id = 10},
4257
4255
  [157] = {.lex_state = 56, .reserved_word_set_id = 10},
@@ -4262,13 +4260,13 @@ static const TSLexerMode ts_lex_modes[STATE_COUNT] = {
4262
4260
  [162] = {.lex_state = 56, .reserved_word_set_id = 10},
4263
4261
  [163] = {.lex_state = 56, .reserved_word_set_id = 10},
4264
4262
  [164] = {.lex_state = 56, .reserved_word_set_id = 10},
4265
- [165] = {.lex_state = 3, .external_lex_state = 3},
4263
+ [165] = {.lex_state = 5, .external_lex_state = 3},
4266
4264
  [166] = {.lex_state = 56, .reserved_word_set_id = 10},
4267
4265
  [167] = {.lex_state = 56, .reserved_word_set_id = 10},
4268
- [168] = {.lex_state = 3, .external_lex_state = 3},
4266
+ [168] = {.lex_state = 5, .external_lex_state = 3},
4269
4267
  [169] = {.lex_state = 56, .reserved_word_set_id = 10},
4270
4268
  [170] = {.lex_state = 56, .reserved_word_set_id = 10},
4271
- [171] = {.lex_state = 3, .external_lex_state = 2},
4269
+ [171] = {.lex_state = 5, .external_lex_state = 2},
4272
4270
  [172] = {.lex_state = 56, .reserved_word_set_id = 10},
4273
4271
  [173] = {.lex_state = 56, .reserved_word_set_id = 10},
4274
4272
  [174] = {.lex_state = 56, .reserved_word_set_id = 10},
@@ -4288,7 +4286,7 @@ static const TSLexerMode ts_lex_modes[STATE_COUNT] = {
4288
4286
  [188] = {.lex_state = 56, .external_lex_state = 4, .reserved_word_set_id = 2},
4289
4287
  [189] = {.lex_state = 56, .external_lex_state = 4, .reserved_word_set_id = 2},
4290
4288
  [190] = {.lex_state = 56, .external_lex_state = 4, .reserved_word_set_id = 2},
4291
- [191] = {.lex_state = 3, .external_lex_state = 3},
4289
+ [191] = {.lex_state = 5, .external_lex_state = 3},
4292
4290
  [192] = {.lex_state = 56, .reserved_word_set_id = 2},
4293
4291
  [193] = {.lex_state = 56, .reserved_word_set_id = 2},
4294
4292
  [194] = {.lex_state = 56, .reserved_word_set_id = 2},
@@ -4513,8 +4511,8 @@ static const TSLexerMode ts_lex_modes[STATE_COUNT] = {
4513
4511
  [413] = {.lex_state = 56},
4514
4512
  [414] = {.lex_state = 56},
4515
4513
  [415] = {.lex_state = 56},
4516
- [416] = {.lex_state = 3},
4517
- [417] = {.lex_state = 3},
4514
+ [416] = {.lex_state = 5},
4515
+ [417] = {.lex_state = 5},
4518
4516
  [418] = {.lex_state = 56},
4519
4517
  [419] = {.lex_state = 56, .reserved_word_set_id = 1},
4520
4518
  [420] = {.lex_state = 56, .reserved_word_set_id = 1},
@@ -4527,54 +4525,54 @@ static const TSLexerMode ts_lex_modes[STATE_COUNT] = {
4527
4525
  [427] = {.lex_state = 56},
4528
4526
  [428] = {.lex_state = 56, .reserved_word_set_id = 1},
4529
4527
  [429] = {.lex_state = 56, .reserved_word_set_id = 1},
4530
- [430] = {.lex_state = 6, .external_lex_state = 5},
4528
+ [430] = {.lex_state = 8, .external_lex_state = 5},
4531
4529
  [431] = {.lex_state = 56, .reserved_word_set_id = 1},
4532
4530
  [432] = {.lex_state = 56},
4533
- [433] = {.lex_state = 6, .external_lex_state = 5},
4531
+ [433] = {.lex_state = 8, .external_lex_state = 5},
4534
4532
  [434] = {.lex_state = 56},
4535
- [435] = {.lex_state = 6, .external_lex_state = 5},
4533
+ [435] = {.lex_state = 8, .external_lex_state = 5},
4536
4534
  [436] = {.lex_state = 56},
4537
4535
  [437] = {.lex_state = 56, .external_lex_state = 4},
4538
- [438] = {.lex_state = 6, .external_lex_state = 5},
4539
- [439] = {.lex_state = 6, .external_lex_state = 5},
4536
+ [438] = {.lex_state = 8, .external_lex_state = 5},
4537
+ [439] = {.lex_state = 8, .external_lex_state = 5},
4540
4538
  [440] = {.lex_state = 56},
4541
4539
  [441] = {.lex_state = 56},
4542
4540
  [442] = {.lex_state = 56, .external_lex_state = 4},
4543
4541
  [443] = {.lex_state = 56},
4544
- [444] = {.lex_state = 5},
4542
+ [444] = {.lex_state = 7},
4545
4543
  [445] = {.lex_state = 56},
4546
4544
  [446] = {.lex_state = 56, .reserved_word_set_id = 1},
4547
4545
  [447] = {.lex_state = 56, .reserved_word_set_id = 1},
4548
- [448] = {.lex_state = 6, .external_lex_state = 5},
4546
+ [448] = {.lex_state = 8, .external_lex_state = 5},
4549
4547
  [449] = {.lex_state = 56},
4550
- [450] = {.lex_state = 5},
4551
- [451] = {.lex_state = 9},
4548
+ [450] = {.lex_state = 7},
4549
+ [451] = {.lex_state = 11},
4552
4550
  [452] = {.lex_state = 56, .external_lex_state = 4},
4553
4551
  [453] = {.lex_state = 56},
4554
4552
  [454] = {.lex_state = 56},
4555
- [455] = {.lex_state = 5},
4553
+ [455] = {.lex_state = 7},
4556
4554
  [456] = {.lex_state = 56, .external_lex_state = 4},
4557
4555
  [457] = {.lex_state = 56},
4558
4556
  [458] = {.lex_state = 56},
4559
4557
  [459] = {.lex_state = 56},
4560
4558
  [460] = {.lex_state = 56, .external_lex_state = 4},
4561
- [461] = {.lex_state = 5},
4562
- [462] = {.lex_state = 9},
4563
- [463] = {.lex_state = 5},
4564
- [464] = {.lex_state = 9},
4559
+ [461] = {.lex_state = 7},
4560
+ [462] = {.lex_state = 11},
4561
+ [463] = {.lex_state = 7},
4562
+ [464] = {.lex_state = 11},
4565
4563
  [465] = {.lex_state = 56},
4566
- [466] = {.lex_state = 5},
4564
+ [466] = {.lex_state = 7},
4567
4565
  [467] = {.lex_state = 56, .external_lex_state = 4},
4568
4566
  [468] = {.lex_state = 56, .external_lex_state = 4},
4569
- [469] = {.lex_state = 9},
4570
- [470] = {.lex_state = 5},
4571
- [471] = {.lex_state = 9},
4572
- [472] = {.lex_state = 5},
4573
- [473] = {.lex_state = 9},
4574
- [474] = {.lex_state = 9},
4575
- [475] = {.lex_state = 9},
4576
- [476] = {.lex_state = 5},
4577
- [477] = {.lex_state = 9},
4567
+ [469] = {.lex_state = 11},
4568
+ [470] = {.lex_state = 7},
4569
+ [471] = {.lex_state = 11},
4570
+ [472] = {.lex_state = 7},
4571
+ [473] = {.lex_state = 11},
4572
+ [474] = {.lex_state = 11},
4573
+ [475] = {.lex_state = 11},
4574
+ [476] = {.lex_state = 7},
4575
+ [477] = {.lex_state = 11},
4578
4576
  [478] = {.lex_state = 56, .reserved_word_set_id = 1},
4579
4577
  [479] = {.lex_state = 56},
4580
4578
  [480] = {.lex_state = 56},
@@ -4684,7 +4682,7 @@ static const TSLexerMode ts_lex_modes[STATE_COUNT] = {
4684
4682
  [584] = {.lex_state = 56},
4685
4683
  [585] = {.lex_state = 56},
4686
4684
  [586] = {.lex_state = 56},
4687
- [587] = {.lex_state = 17},
4685
+ [587] = {.lex_state = 19},
4688
4686
  [588] = {.lex_state = 56},
4689
4687
  [589] = {.lex_state = 56, .reserved_word_set_id = 1},
4690
4688
  [590] = {.lex_state = 56},
@@ -4723,7 +4721,7 @@ static const TSLexerMode ts_lex_modes[STATE_COUNT] = {
4723
4721
  [623] = {.lex_state = 1},
4724
4722
  [624] = {.lex_state = 56, .reserved_word_set_id = 1},
4725
4723
  [625] = {.lex_state = 56},
4726
- [626] = {.lex_state = 17},
4724
+ [626] = {.lex_state = 19},
4727
4725
  [627] = {.lex_state = 56},
4728
4726
  [628] = {.lex_state = 1},
4729
4727
  [629] = {.lex_state = 56},
@@ -33938,7 +33936,7 @@ TS_PUBLIC const TSLanguage *tree_sitter_ucode(void) {
33938
33936
  .metadata = {
33939
33937
  .major_version = 0,
33940
33938
  .minor_version = 1,
33941
- .patch_version = 0,
33939
+ .patch_version = 2,
33942
33940
  },
33943
33941
  };
33944
33942
  return &language;
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
@@ -697,7 +697,7 @@ TS_PUBLIC const TSLanguage *tree_sitter_ucode_tmpl(void) {
697
697
  .metadata = {
698
698
  .major_version = 0,
699
699
  .minor_version = 1,
700
- .patch_version = 0,
700
+ .patch_version = 2,
701
701
  },
702
702
  };
703
703
  return &language;
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.1.2",
45
45
  "license": "MIT",
46
46
  "description": "Ucode grammar for tree-sitter",
47
47
  "links": {