@willbooster/tree-sitter-c 5.1.0 → 6.0.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/README.md +5 -5
- package/grammar.js +139 -64
- package/package.json +3 -4
- package/src/node-types.json +60 -0
- package/tree-sitter-c.wasm +0 -0
- package/tree-sitter.json +1 -1
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
[](https://github.com/WillBooster/tree-sitter-c/actions/workflows/test.yml)
|
|
6
6
|
[](https://github.com/WillBooster/tree-sitter-c/actions/workflows/test-rust.yml)
|
|
7
7
|
[](https://github.com/semantic-release/semantic-release)
|
|
8
|
-
[](https://github.com/WillBooster/shared/tree/main/packages/wbfy)
|
|
9
9
|
[](https://crates.io/crates/willbooster-tree-sitter-c)
|
|
10
10
|
|
|
11
11
|
C grammar for [tree-sitter](https://github.com/tree-sitter/tree-sitter), forked from
|
|
@@ -18,7 +18,7 @@ This fork fixes parsing bugs and raises conformance with the ISO C standard
|
|
|
18
18
|
## Usage
|
|
19
19
|
|
|
20
20
|
The npm package ships `tree-sitter-c.wasm` for
|
|
21
|
-
[@willbooster/web-tree-sitter](https://www.npmjs.com/package/@willbooster/web-tree-sitter) version
|
|
21
|
+
[@willbooster/web-tree-sitter](https://www.npmjs.com/package/@willbooster/web-tree-sitter) version 4.0.2 or later, which runs in Node.js, Bun, browsers, and Cloudflare Workers. The parser carries the ABI number of the WillBooster/tree-sitter generator (`0x57420003`), so it loads only with that runtime; upstream tree-sitter runtimes reject it. In Node.js and Bun, load the grammar from its path:
|
|
22
22
|
|
|
23
23
|
```js
|
|
24
24
|
import { fileURLToPath } from 'node:url';
|
|
@@ -65,12 +65,12 @@ adjacency, so the parameter scanner must skip them again to reach `(`.
|
|
|
65
65
|
|
|
66
66
|
In Rust, depend on the [crate](https://crates.io/crates/willbooster-tree-sitter-c) and on
|
|
67
67
|
[willbooster-tree-sitter](https://crates.io/crates/willbooster-tree-sitter), the runtime this package is tested and
|
|
68
|
-
fuzzed with, at version
|
|
68
|
+
fuzzed with, at version 4.0.2 or later. No other runtime loads the parser:
|
|
69
69
|
|
|
70
70
|
```toml
|
|
71
71
|
[dependencies]
|
|
72
|
-
tree-sitter = { package = "willbooster-tree-sitter", version = "2" }
|
|
73
|
-
tree-sitter-c = { package = "willbooster-tree-sitter-c", version = "
|
|
72
|
+
tree-sitter = { package = "willbooster-tree-sitter", version = "4.0.2" }
|
|
73
|
+
tree-sitter-c = { package = "willbooster-tree-sitter-c", version = "6" }
|
|
74
74
|
```
|
|
75
75
|
|
|
76
76
|
```rust
|
package/grammar.js
CHANGED
|
@@ -93,13 +93,19 @@ module.exports = Object.assign(
|
|
|
93
93
|
[$.type_definition, $.sized_type_specifier],
|
|
94
94
|
[$.type_definition, $._sized_bit_int_specifier],
|
|
95
95
|
[$.attributed_statement],
|
|
96
|
+
[$.case_statement],
|
|
96
97
|
[$._single_attributed_statement],
|
|
97
|
-
[$._declaration_modifiers, $.
|
|
98
|
+
[$._declaration_modifiers, $._case_body_attributed_statement, $._case_label_attributes],
|
|
99
|
+
[$._declaration_modifiers, $.attributed_statement, $.case_statement],
|
|
98
100
|
[$.enum_specifier],
|
|
101
|
+
[sym('preproc_if_in_enumerator_list'), sym('preproc_if_in_enumerator_list_no_comma')],
|
|
102
|
+
[sym('preproc_ifdef_in_enumerator_list'), sym('preproc_ifdef_in_enumerator_list_no_comma')],
|
|
103
|
+
[sym('preproc_else_in_enumerator_list'), sym('preproc_else_in_enumerator_list_no_comma')],
|
|
104
|
+
[sym('preproc_elif_in_enumerator_list'), sym('preproc_elif_in_enumerator_list_no_comma')],
|
|
105
|
+
[sym('preproc_elifdef_in_enumerator_list'), sym('preproc_elifdef_in_enumerator_list_no_comma')],
|
|
99
106
|
[$.type_specifier, $._old_style_parameter_list],
|
|
100
107
|
[$.parameter_list, $._old_style_parameter_list],
|
|
101
108
|
[$.function_declarator, $._function_declaration_declarator],
|
|
102
|
-
[$._block_item, $.statement],
|
|
103
109
|
[$._top_level_item, $._top_level_statement],
|
|
104
110
|
[$.type_specifier, $._top_level_expression_statement],
|
|
105
111
|
[$.type_qualifier, $.extension_expression],
|
|
@@ -124,7 +130,6 @@ module.exports = Object.assign(
|
|
|
124
130
|
$._type_identifier,
|
|
125
131
|
$._field_identifier,
|
|
126
132
|
$._statement_identifier,
|
|
127
|
-
$._non_case_statement,
|
|
128
133
|
$._assignment_left_expression,
|
|
129
134
|
$._expression_not_binary,
|
|
130
135
|
],
|
|
@@ -133,6 +138,13 @@ module.exports = Object.assign(
|
|
|
133
138
|
$.expression,
|
|
134
139
|
$.statement,
|
|
135
140
|
$._single_noncompound_statement,
|
|
141
|
+
$._non_case_statement,
|
|
142
|
+
$._single_non_case_statement,
|
|
143
|
+
$._case_body_statement,
|
|
144
|
+
$._case_body_unattributed_statement,
|
|
145
|
+
$._case_label_tail,
|
|
146
|
+
$._case_label_statement,
|
|
147
|
+
$._case_label_chain_statement,
|
|
136
148
|
$.type_specifier,
|
|
137
149
|
$._declarator,
|
|
138
150
|
$._old_style_declarator,
|
|
@@ -171,7 +183,6 @@ module.exports = Object.assign(
|
|
|
171
183
|
$.linkage_specification,
|
|
172
184
|
$.declaration,
|
|
173
185
|
$.statement,
|
|
174
|
-
$.attributed_statement,
|
|
175
186
|
$.type_definition,
|
|
176
187
|
$._empty_declaration,
|
|
177
188
|
sym('preproc_if'),
|
|
@@ -212,6 +223,7 @@ module.exports = Object.assign(
|
|
|
212
223
|
alias($.preproc_call_expression, $.call_expression)
|
|
213
224
|
)
|
|
214
225
|
),
|
|
226
|
+
repeat(choice($.comment, $.pragma_operator)),
|
|
215
227
|
sym('_preproc_newline')
|
|
216
228
|
),
|
|
217
229
|
|
|
@@ -219,7 +231,8 @@ module.exports = Object.assign(
|
|
|
219
231
|
seq(
|
|
220
232
|
preprocessor('define'),
|
|
221
233
|
field('name', $.identifier),
|
|
222
|
-
|
|
234
|
+
repeat(choice($.comment, $.pragma_operator)),
|
|
235
|
+
optional(seq(field('value', $.preproc_arg), repeat(choice($.comment, $.pragma_operator)))),
|
|
223
236
|
sym('_preproc_newline')
|
|
224
237
|
),
|
|
225
238
|
|
|
@@ -228,7 +241,8 @@ module.exports = Object.assign(
|
|
|
228
241
|
preprocessor('define'),
|
|
229
242
|
field('name', alias(sym('_preproc_function_name'), $.identifier)),
|
|
230
243
|
field('parameters', $.preproc_params),
|
|
231
|
-
|
|
244
|
+
repeat(choice($.comment, $.pragma_operator)),
|
|
245
|
+
optional(seq(field('value', $.preproc_arg), repeat(choice($.comment, $.pragma_operator)))),
|
|
232
246
|
sym('_preproc_newline')
|
|
233
247
|
),
|
|
234
248
|
|
|
@@ -237,15 +251,32 @@ module.exports = Object.assign(
|
|
|
237
251
|
preproc_call: ($) =>
|
|
238
252
|
seq(
|
|
239
253
|
field('directive', $.preproc_directive),
|
|
240
|
-
|
|
254
|
+
repeat(choice($.comment, $.pragma_operator)),
|
|
255
|
+
optional(
|
|
256
|
+
seq(
|
|
257
|
+
field('argument', alias($._preproc_directive_arg, $.preproc_arg)),
|
|
258
|
+
repeat(choice($.comment, $.pragma_operator))
|
|
259
|
+
)
|
|
260
|
+
),
|
|
241
261
|
sym('_preproc_newline')
|
|
242
262
|
),
|
|
243
263
|
|
|
244
264
|
...preprocIf('', () => sym('_block_item')),
|
|
245
265
|
...preprocIf('_in_single_case', () => sym('_single_case_body'), 0, true),
|
|
246
266
|
...preprocIf('_in_field_declaration_list', () => sym('_field_declaration_list_item')),
|
|
247
|
-
...preprocIf('_in_enumerator_list', () => seq(sym('enumerator'), ',')),
|
|
248
|
-
...preprocIf(
|
|
267
|
+
...preprocIf('_in_enumerator_list', () => choice(seq(sym('enumerator'), ','), sym('_enumerator_directives'))),
|
|
268
|
+
...preprocIf(
|
|
269
|
+
'_in_enumerator_list_no_comma',
|
|
270
|
+
() =>
|
|
271
|
+
choice(
|
|
272
|
+
seq(optional(sym('_enumerator_directives')), sym('enumerator'), optional(sym('_enumerator_directives'))),
|
|
273
|
+
sym('_enumerator_directives')
|
|
274
|
+
),
|
|
275
|
+
0,
|
|
276
|
+
false
|
|
277
|
+
),
|
|
278
|
+
|
|
279
|
+
_enumerator_directives: ($) => prec.right(repeat1($.preproc_call)),
|
|
249
280
|
|
|
250
281
|
_preproc_newline: () => token.immediate(/\r?\n/),
|
|
251
282
|
|
|
@@ -783,7 +814,8 @@ module.exports = Object.assign(
|
|
|
783
814
|
seq($.enumerator, ','),
|
|
784
815
|
alias(sym('preproc_if_in_enumerator_list'), sym('preproc_if')),
|
|
785
816
|
alias(sym('preproc_ifdef_in_enumerator_list'), sym('preproc_ifdef')),
|
|
786
|
-
seq($.preproc_call, ',')
|
|
817
|
+
seq($.preproc_call, ','),
|
|
818
|
+
prec(1, $.preproc_call)
|
|
787
819
|
)
|
|
788
820
|
),
|
|
789
821
|
optional(
|
|
@@ -791,11 +823,11 @@ module.exports = Object.assign(
|
|
|
791
823
|
choice(
|
|
792
824
|
$.enumerator,
|
|
793
825
|
alias(sym('preproc_if_in_enumerator_list_no_comma'), sym('preproc_if')),
|
|
794
|
-
alias(sym('preproc_ifdef_in_enumerator_list_no_comma'), sym('preproc_ifdef'))
|
|
795
|
-
$.preproc_call
|
|
826
|
+
alias(sym('preproc_ifdef_in_enumerator_list_no_comma'), sym('preproc_ifdef'))
|
|
796
827
|
)
|
|
797
828
|
)
|
|
798
829
|
),
|
|
830
|
+
repeat($.preproc_call),
|
|
799
831
|
'}'
|
|
800
832
|
),
|
|
801
833
|
|
|
@@ -860,14 +892,16 @@ module.exports = Object.assign(
|
|
|
860
892
|
repeat($.attribute_specifier)
|
|
861
893
|
),
|
|
862
894
|
|
|
863
|
-
attributed_statement: ($) => seq(repeat1($.attribute_declaration), $.statement),
|
|
895
|
+
attributed_statement: ($) => seq(repeat1($.attribute_declaration), alias($._non_case_statement, $.statement)),
|
|
896
|
+
|
|
897
|
+
statement: ($) => choice($.case_statement, alias($._non_case_statement, $.statement)),
|
|
864
898
|
|
|
865
|
-
|
|
899
|
+
_non_case_statement: ($) => choice($.attributed_statement, $._unattributed_non_case_statement),
|
|
866
900
|
|
|
867
|
-
|
|
901
|
+
_unattributed_non_case_statement: ($) => choice($.labeled_statement, $._unlabeled_non_case_statement),
|
|
902
|
+
|
|
903
|
+
_unlabeled_non_case_statement: ($) =>
|
|
868
904
|
choice(
|
|
869
|
-
$.attributed_statement,
|
|
870
|
-
$.labeled_statement,
|
|
871
905
|
$.compound_statement,
|
|
872
906
|
$.expression_statement,
|
|
873
907
|
$.if_statement,
|
|
@@ -913,12 +947,12 @@ module.exports = Object.assign(
|
|
|
913
947
|
seq(
|
|
914
948
|
'if',
|
|
915
949
|
field('condition', $.parenthesized_expression),
|
|
916
|
-
field('consequence', $.
|
|
950
|
+
field('consequence', $._single_statement),
|
|
917
951
|
optional(field('alternative', $.else_clause))
|
|
918
952
|
)
|
|
919
953
|
),
|
|
920
954
|
|
|
921
|
-
else_clause: ($) => seq('else', $.
|
|
955
|
+
else_clause: ($) => seq('else', $._single_statement),
|
|
922
956
|
|
|
923
957
|
switch_statement: ($) =>
|
|
924
958
|
seq('switch', field('condition', $.parenthesized_expression), field('body', $._single_statement)),
|
|
@@ -926,6 +960,9 @@ module.exports = Object.assign(
|
|
|
926
960
|
_single_statement: ($) => choice($.compound_statement, alias($._single_noncompound_statement, $.statement)),
|
|
927
961
|
|
|
928
962
|
_single_noncompound_statement: ($) =>
|
|
963
|
+
choice(alias($._single_case_statement, $.case_statement), alias($._single_non_case_statement, $.statement)),
|
|
964
|
+
|
|
965
|
+
_single_non_case_statement: ($) =>
|
|
929
966
|
choice(
|
|
930
967
|
$.expression_statement,
|
|
931
968
|
$.switch_statement,
|
|
@@ -935,71 +972,103 @@ module.exports = Object.assign(
|
|
|
935
972
|
$.goto_statement,
|
|
936
973
|
$.seh_try_statement,
|
|
937
974
|
$.seh_leave_statement,
|
|
938
|
-
alias($._single_case_statement, $.case_statement),
|
|
939
975
|
alias($._single_labeled_statement, $.labeled_statement),
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
976
|
+
$.if_statement,
|
|
977
|
+
$.while_statement,
|
|
978
|
+
$.do_statement,
|
|
979
|
+
$.for_statement,
|
|
944
980
|
alias($._single_attributed_statement, $.attributed_statement)
|
|
945
981
|
),
|
|
946
982
|
|
|
947
983
|
_single_case_statement: ($) =>
|
|
948
|
-
prec.
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
984
|
+
prec.dynamic(
|
|
985
|
+
1,
|
|
986
|
+
prec.right(
|
|
987
|
+
seq(
|
|
988
|
+
repeat($.attribute_declaration),
|
|
989
|
+
choice(
|
|
990
|
+
seq('case', field('value', $.expression), optional(seq('...', field('end_value', $.expression)))),
|
|
991
|
+
'default'
|
|
992
|
+
),
|
|
993
|
+
':',
|
|
994
|
+
optional($._single_case_body)
|
|
995
|
+
)
|
|
956
996
|
)
|
|
957
997
|
),
|
|
958
998
|
_single_case_body: ($) =>
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
999
|
+
prec.dynamic(
|
|
1000
|
+
1,
|
|
1001
|
+
choice(
|
|
1002
|
+
$._single_statement,
|
|
1003
|
+
$.declaration,
|
|
1004
|
+
$.type_definition,
|
|
1005
|
+
alias(sym('preproc_if_in_single_case'), sym('preproc_if')),
|
|
1006
|
+
alias(sym('preproc_ifdef_in_single_case'), sym('preproc_ifdef'))
|
|
1007
|
+
)
|
|
965
1008
|
),
|
|
966
1009
|
_single_labeled_statement: ($) =>
|
|
967
1010
|
seq(field('label', $._statement_identifier), ':', choice($._single_statement, $.declaration)),
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
field('condition', $.parenthesized_expression),
|
|
973
|
-
field('consequence', $._single_statement),
|
|
974
|
-
optional(field('alternative', alias($._single_else_clause, $.else_clause)))
|
|
975
|
-
)
|
|
1011
|
+
_single_attributed_statement: ($) =>
|
|
1012
|
+
seq(
|
|
1013
|
+
repeat1($.attribute_declaration),
|
|
1014
|
+
choice($.compound_statement, alias($._single_non_case_statement, $.statement))
|
|
976
1015
|
),
|
|
977
|
-
_single_else_clause: ($) => seq('else', $._single_statement),
|
|
978
|
-
_single_while_statement: ($) =>
|
|
979
|
-
seq('while', field('condition', $.parenthesized_expression), field('body', $._single_statement)),
|
|
980
|
-
_single_do_statement: ($) =>
|
|
981
|
-
seq('do', field('body', $._single_statement), 'while', field('condition', $.parenthesized_expression), ';'),
|
|
982
|
-
_single_for_statement: ($) => seq('for', '(', $._for_statement_body, ')', field('body', $._single_statement)),
|
|
983
|
-
_single_attributed_statement: ($) => seq(repeat1($.attribute_declaration), $._single_statement),
|
|
984
1016
|
|
|
985
1017
|
case_statement: ($) =>
|
|
986
|
-
prec.
|
|
1018
|
+
prec.dynamic(
|
|
1019
|
+
1,
|
|
987
1020
|
seq(
|
|
1021
|
+
repeat($.attribute_declaration),
|
|
988
1022
|
choice(
|
|
989
1023
|
seq('case', field('value', $.expression), optional(seq('...', field('end_value', $.expression)))),
|
|
990
1024
|
'default'
|
|
991
1025
|
),
|
|
992
1026
|
':',
|
|
993
|
-
repeat(
|
|
1027
|
+
repeat($._case_statement_item),
|
|
1028
|
+
optional(alias($._case_label_tail, $.statement))
|
|
1029
|
+
)
|
|
1030
|
+
),
|
|
1031
|
+
|
|
1032
|
+
_case_statement_item: ($) =>
|
|
1033
|
+
prec.dynamic(1, choice(alias($._case_body_statement, $.statement), $.declaration, $.type_definition)),
|
|
1034
|
+
|
|
1035
|
+
_case_body_statement: ($) =>
|
|
1036
|
+
choice(
|
|
1037
|
+
alias($._case_body_unattributed_statement, $.statement),
|
|
1038
|
+
alias($._case_body_attributed_statement, $.attributed_statement)
|
|
1039
|
+
),
|
|
1040
|
+
_case_body_unattributed_statement: ($) =>
|
|
1041
|
+
choice($._unlabeled_non_case_statement, alias($._case_body_labeled_statement, $.labeled_statement)),
|
|
1042
|
+
_case_body_labeled_statement: ($) =>
|
|
1043
|
+
seq(
|
|
1044
|
+
field('label', $._statement_identifier),
|
|
1045
|
+
':',
|
|
1046
|
+
choice($.declaration, alias($._case_body_statement, $.statement))
|
|
1047
|
+
),
|
|
1048
|
+
_case_body_attributed_statement: ($) =>
|
|
1049
|
+
prec(1, seq(repeat1($.attribute_declaration), alias($._case_body_unattributed_statement, $.statement))),
|
|
1050
|
+
_case_label_tail: ($) =>
|
|
1051
|
+
prec.dynamic(
|
|
1052
|
+
1,
|
|
1053
|
+
choice(
|
|
1054
|
+
alias($._case_label_chain, $.labeled_statement),
|
|
1055
|
+
alias($._case_label_attributes, $.attributed_statement)
|
|
994
1056
|
)
|
|
995
1057
|
),
|
|
1058
|
+
_case_label_attributes: ($) =>
|
|
1059
|
+
seq(repeat1($.attribute_declaration), alias($._case_label_chain_statement, $.statement)),
|
|
1060
|
+
_case_label_chain_statement: ($) => alias($._case_label_chain, $.labeled_statement),
|
|
1061
|
+
_case_label_chain: ($) =>
|
|
1062
|
+
seq(field('label', $._statement_identifier), ':', alias($._case_label_statement, $.statement)),
|
|
1063
|
+
_case_label_statement: ($) => choice($.case_statement, alias($._case_label_tail, $.statement)),
|
|
996
1064
|
|
|
997
|
-
while_statement: ($) =>
|
|
1065
|
+
while_statement: ($) =>
|
|
1066
|
+
seq('while', field('condition', $.parenthesized_expression), field('body', $._single_statement)),
|
|
998
1067
|
|
|
999
1068
|
do_statement: ($) =>
|
|
1000
|
-
seq('do', field('body', $.
|
|
1069
|
+
seq('do', field('body', $._single_statement), 'while', field('condition', $.parenthesized_expression), ';'),
|
|
1001
1070
|
|
|
1002
|
-
for_statement: ($) => seq('for', '(', $._for_statement_body, ')', field('body', $.
|
|
1071
|
+
for_statement: ($) => seq('for', '(', $._for_statement_body, ')', field('body', $._single_statement)),
|
|
1003
1072
|
_for_statement_body: ($) =>
|
|
1004
1073
|
seq(
|
|
1005
1074
|
choice(
|
|
@@ -1335,7 +1404,13 @@ module.exports = Object.assign(
|
|
|
1335
1404
|
'directive',
|
|
1336
1405
|
alias(token(/#[ \t]*(embed|include|undef|error|warning|line|pragma)/), $.preproc_directive)
|
|
1337
1406
|
),
|
|
1338
|
-
|
|
1407
|
+
repeat(choice($.comment, $.pragma_operator)),
|
|
1408
|
+
optional(
|
|
1409
|
+
seq(
|
|
1410
|
+
field('argument', alias($._preproc_directive_arg, $.preproc_arg)),
|
|
1411
|
+
repeat(choice($.comment, $.pragma_operator))
|
|
1412
|
+
)
|
|
1413
|
+
),
|
|
1339
1414
|
alias(sym('_preproc_newline'), '\n')
|
|
1340
1415
|
),
|
|
1341
1416
|
|
|
@@ -1501,9 +1576,9 @@ function sizedTypeSpecifier(type) {
|
|
|
1501
1576
|
function preprocIf(suffix, content, precedence = 0, repeatContent = true) {
|
|
1502
1577
|
function alternativeBlock() {
|
|
1503
1578
|
return choice(
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1579
|
+
...['preproc_else', 'preproc_elif', 'preproc_elifdef'].map((name) =>
|
|
1580
|
+
suffix ? alias(sym(name + suffix), sym(name)) : sym(name)
|
|
1581
|
+
)
|
|
1507
1582
|
);
|
|
1508
1583
|
}
|
|
1509
1584
|
|
|
@@ -1514,7 +1589,7 @@ function preprocIf(suffix, content, precedence = 0, repeatContent = true) {
|
|
|
1514
1589
|
seq(
|
|
1515
1590
|
preprocessor('if'),
|
|
1516
1591
|
field('condition', sym('_preproc_expression')),
|
|
1517
|
-
alias(
|
|
1592
|
+
alias(token(/\r\n?|\n\r?/), '\n'),
|
|
1518
1593
|
repeatContent ? repeat(content($)) : optional(content($)),
|
|
1519
1594
|
field('alternative', optional(alternativeBlock())),
|
|
1520
1595
|
preprocessor('endif')
|
|
@@ -1542,7 +1617,7 @@ function preprocIf(suffix, content, precedence = 0, repeatContent = true) {
|
|
|
1542
1617
|
seq(
|
|
1543
1618
|
preprocessor('elif'),
|
|
1544
1619
|
field('condition', sym('_preproc_expression')),
|
|
1545
|
-
alias(
|
|
1620
|
+
alias(token(/\r\n?|\n\r?/), '\n'),
|
|
1546
1621
|
repeatContent ? repeat(content($)) : optional(content($)),
|
|
1547
1622
|
field('alternative', optional(alternativeBlock()))
|
|
1548
1623
|
)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@willbooster/tree-sitter-c",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"description": "C grammar for tree-sitter",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"incremental",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"@willbooster/oxfmt-config": "1.2.2",
|
|
52
52
|
"@willbooster/oxlint-config": "1.4.8",
|
|
53
53
|
"@willbooster/wb": "22.26.1",
|
|
54
|
-
"@willbooster/web-tree-sitter": "
|
|
54
|
+
"@willbooster/web-tree-sitter": "4.0.2",
|
|
55
55
|
"conventional-changelog-conventionalcommits": "10.4.1",
|
|
56
56
|
"lefthook": "2.2.1",
|
|
57
57
|
"oxfmt": "0.72.0",
|
|
@@ -60,12 +60,11 @@
|
|
|
60
60
|
"playwright": "1.64.0",
|
|
61
61
|
"semantic-release": "25.0.9",
|
|
62
62
|
"sort-package-json": "4.0.0",
|
|
63
|
-
"typescript": "7.0.2",
|
|
64
63
|
"vitest": "5.0.3",
|
|
65
64
|
"wrangler": "4.149.0"
|
|
66
65
|
},
|
|
67
66
|
"peerDependencies": {
|
|
68
|
-
"@willbooster/web-tree-sitter": "^
|
|
67
|
+
"@willbooster/web-tree-sitter": "^4.0.2"
|
|
69
68
|
},
|
|
70
69
|
"peerDependenciesMeta": {
|
|
71
70
|
"@willbooster/web-tree-sitter": {
|
package/src/node-types.json
CHANGED
|
@@ -1027,6 +1027,10 @@
|
|
|
1027
1027
|
"multiple": true,
|
|
1028
1028
|
"required": false,
|
|
1029
1029
|
"types": [
|
|
1030
|
+
{
|
|
1031
|
+
"type": "attribute_declaration",
|
|
1032
|
+
"named": true
|
|
1033
|
+
},
|
|
1030
1034
|
{
|
|
1031
1035
|
"type": "declaration",
|
|
1032
1036
|
"named": true
|
|
@@ -2866,6 +2870,20 @@
|
|
|
2866
2870
|
}
|
|
2867
2871
|
]
|
|
2868
2872
|
}
|
|
2873
|
+
},
|
|
2874
|
+
"children": {
|
|
2875
|
+
"multiple": true,
|
|
2876
|
+
"required": false,
|
|
2877
|
+
"types": [
|
|
2878
|
+
{
|
|
2879
|
+
"type": "comment",
|
|
2880
|
+
"named": true
|
|
2881
|
+
},
|
|
2882
|
+
{
|
|
2883
|
+
"type": "pragma_operator",
|
|
2884
|
+
"named": true
|
|
2885
|
+
}
|
|
2886
|
+
]
|
|
2869
2887
|
}
|
|
2870
2888
|
},
|
|
2871
2889
|
{
|
|
@@ -2892,6 +2910,20 @@
|
|
|
2892
2910
|
}
|
|
2893
2911
|
]
|
|
2894
2912
|
}
|
|
2913
|
+
},
|
|
2914
|
+
"children": {
|
|
2915
|
+
"multiple": true,
|
|
2916
|
+
"required": false,
|
|
2917
|
+
"types": [
|
|
2918
|
+
{
|
|
2919
|
+
"type": "comment",
|
|
2920
|
+
"named": true
|
|
2921
|
+
},
|
|
2922
|
+
{
|
|
2923
|
+
"type": "pragma_operator",
|
|
2924
|
+
"named": true
|
|
2925
|
+
}
|
|
2926
|
+
]
|
|
2895
2927
|
}
|
|
2896
2928
|
},
|
|
2897
2929
|
{
|
|
@@ -3278,6 +3310,20 @@
|
|
|
3278
3310
|
}
|
|
3279
3311
|
]
|
|
3280
3312
|
}
|
|
3313
|
+
},
|
|
3314
|
+
"children": {
|
|
3315
|
+
"multiple": true,
|
|
3316
|
+
"required": false,
|
|
3317
|
+
"types": [
|
|
3318
|
+
{
|
|
3319
|
+
"type": "comment",
|
|
3320
|
+
"named": true
|
|
3321
|
+
},
|
|
3322
|
+
{
|
|
3323
|
+
"type": "pragma_operator",
|
|
3324
|
+
"named": true
|
|
3325
|
+
}
|
|
3326
|
+
]
|
|
3281
3327
|
}
|
|
3282
3328
|
},
|
|
3283
3329
|
{
|
|
@@ -3558,6 +3604,20 @@
|
|
|
3558
3604
|
}
|
|
3559
3605
|
]
|
|
3560
3606
|
}
|
|
3607
|
+
},
|
|
3608
|
+
"children": {
|
|
3609
|
+
"multiple": true,
|
|
3610
|
+
"required": false,
|
|
3611
|
+
"types": [
|
|
3612
|
+
{
|
|
3613
|
+
"type": "comment",
|
|
3614
|
+
"named": true
|
|
3615
|
+
},
|
|
3616
|
+
{
|
|
3617
|
+
"type": "pragma_operator",
|
|
3618
|
+
"named": true
|
|
3619
|
+
}
|
|
3620
|
+
]
|
|
3561
3621
|
}
|
|
3562
3622
|
},
|
|
3563
3623
|
{
|
package/tree-sitter-c.wasm
CHANGED
|
Binary file
|