@willbooster/tree-sitter-c 15.0.0 → 15.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 +40 -8
- package/package.json +1 -1
- package/tree-sitter-c.wasm +0 -0
- package/tree-sitter.json +1 -1
package/grammar.js
CHANGED
|
@@ -150,6 +150,8 @@ module.exports = Object.assign(
|
|
|
150
150
|
[$.parameter_list, $._old_style_parameter_list],
|
|
151
151
|
[$.function_declarator, $._function_declaration_declarator],
|
|
152
152
|
[$.pointer_declarator],
|
|
153
|
+
[$.pointer_declarator, $._initialized_declarator],
|
|
154
|
+
[$._initialized_pointer_declarator],
|
|
153
155
|
[$.pointer_declarator, $.abstract_pointer_declarator],
|
|
154
156
|
[$.pointer_field_declarator],
|
|
155
157
|
[$.pointer_type_declarator],
|
|
@@ -194,6 +196,9 @@ module.exports = Object.assign(
|
|
|
194
196
|
extras: ($) => [$.pragma_operator, /\s|\\(?:\r\n?|\n\r?)/, $.comment],
|
|
195
197
|
|
|
196
198
|
inline: ($) => [
|
|
199
|
+
$._unattributed_non_case_statement,
|
|
200
|
+
$._single_unattributed_non_case_statement,
|
|
201
|
+
$._unlabeled_non_case_statement,
|
|
197
202
|
$._non_identifier_type_specifier,
|
|
198
203
|
$._non_macro_declaration_modifiers,
|
|
199
204
|
$._unattributed_declarator,
|
|
@@ -211,9 +216,9 @@ module.exports = Object.assign(
|
|
|
211
216
|
$.statement,
|
|
212
217
|
$._single_noncompound_statement,
|
|
213
218
|
$._non_case_statement,
|
|
214
|
-
$.
|
|
219
|
+
$._attributed_body_statement,
|
|
215
220
|
$._single_non_case_statement,
|
|
216
|
-
$.
|
|
221
|
+
$._single_attributed_body_statement,
|
|
217
222
|
$._case_body_statement,
|
|
218
223
|
$._case_body_unattributed_statement,
|
|
219
224
|
$._case_label_tail,
|
|
@@ -222,6 +227,8 @@ module.exports = Object.assign(
|
|
|
222
227
|
$.type_specifier,
|
|
223
228
|
$._declarator,
|
|
224
229
|
$._old_style_declarator,
|
|
230
|
+
$._initialized_declarator,
|
|
231
|
+
$._initialized_parenthesized_content,
|
|
225
232
|
$._field_declarator,
|
|
226
233
|
$._type_declarator,
|
|
227
234
|
$._abstract_declarator,
|
|
@@ -867,7 +874,29 @@ module.exports = Object.assign(
|
|
|
867
874
|
),
|
|
868
875
|
|
|
869
876
|
init_declarator: ($) =>
|
|
870
|
-
seq(
|
|
877
|
+
seq(
|
|
878
|
+
field('declarator', alias($._initialized_declarator, $._declarator)),
|
|
879
|
+
'=',
|
|
880
|
+
field('value', choice($.initializer_list, $.expression))
|
|
881
|
+
),
|
|
882
|
+
|
|
883
|
+
_initialized_declarator: ($) =>
|
|
884
|
+
choice(
|
|
885
|
+
$._declarator,
|
|
886
|
+
alias($._initialized_parenthesized_declarator, $.parenthesized_declarator),
|
|
887
|
+
alias($._initialized_pointer_declarator, $.pointer_declarator)
|
|
888
|
+
),
|
|
889
|
+
|
|
890
|
+
_initialized_parenthesized_declarator: ($) =>
|
|
891
|
+
parenthesizedDeclaratorRule($, alias($._initialized_parenthesized_content, $._declarator)),
|
|
892
|
+
|
|
893
|
+
_initialized_parenthesized_content: ($) =>
|
|
894
|
+
choice(
|
|
895
|
+
alias($._initialized_pointer_declarator, $.pointer_declarator),
|
|
896
|
+
alias($._initialized_parenthesized_declarator, $.parenthesized_declarator)
|
|
897
|
+
),
|
|
898
|
+
|
|
899
|
+
_initialized_pointer_declarator: ($) => pointerDeclaratorRule($, alias($._initialized_declarator, $._declarator)),
|
|
871
900
|
|
|
872
901
|
compound_statement: ($) => seq('{', repeat($._block_item), '}'),
|
|
873
902
|
|
|
@@ -1080,12 +1109,13 @@ module.exports = Object.assign(
|
|
|
1080
1109
|
),
|
|
1081
1110
|
|
|
1082
1111
|
attributed_statement: ($) =>
|
|
1083
|
-
seq(repeat1($.attribute_declaration), alias($.
|
|
1112
|
+
seq(repeat1($.attribute_declaration), alias($._attributed_body_statement, $.statement)),
|
|
1113
|
+
|
|
1114
|
+
_attributed_body_statement: ($) => $._unattributed_non_case_statement,
|
|
1084
1115
|
|
|
1085
1116
|
statement: ($) => choice($.case_statement, alias($._non_case_statement, $.statement)),
|
|
1086
1117
|
|
|
1087
|
-
_non_case_statement: ($) =>
|
|
1088
|
-
choice($.attributed_statement, alias($._unattributed_non_case_statement, $.statement)),
|
|
1118
|
+
_non_case_statement: ($) => choice($.attributed_statement, $._unattributed_non_case_statement),
|
|
1089
1119
|
|
|
1090
1120
|
_unattributed_non_case_statement: ($) => choice($.labeled_statement, $._unlabeled_non_case_statement),
|
|
1091
1121
|
|
|
@@ -1158,7 +1188,7 @@ module.exports = Object.assign(
|
|
|
1158
1188
|
|
|
1159
1189
|
_single_non_case_statement: ($) =>
|
|
1160
1190
|
choice(
|
|
1161
|
-
|
|
1191
|
+
$._single_unattributed_non_case_statement,
|
|
1162
1192
|
alias($._single_attributed_statement, $.attributed_statement)
|
|
1163
1193
|
),
|
|
1164
1194
|
|
|
@@ -1214,9 +1244,11 @@ module.exports = Object.assign(
|
|
|
1214
1244
|
_single_attributed_statement: ($) =>
|
|
1215
1245
|
seq(
|
|
1216
1246
|
repeat1($.attribute_declaration),
|
|
1217
|
-
choice($.compound_statement, alias($.
|
|
1247
|
+
choice($.compound_statement, alias($._single_attributed_body_statement, $.statement))
|
|
1218
1248
|
),
|
|
1219
1249
|
|
|
1250
|
+
_single_attributed_body_statement: ($) => $._single_unattributed_non_case_statement,
|
|
1251
|
+
|
|
1220
1252
|
case_statement: ($) =>
|
|
1221
1253
|
prec.dynamic(
|
|
1222
1254
|
1,
|
package/package.json
CHANGED
package/tree-sitter-c.wasm
CHANGED
|
Binary file
|