@willbooster/tree-sitter-c 1.3.0 → 1.4.1
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 +29 -6
- package/package.json +1 -1
- package/src/node-types.json +18 -0
- package/tree-sitter-c.wasm +0 -0
- package/tree-sitter.json +1 -1
package/grammar.js
CHANGED
|
@@ -67,6 +67,9 @@ module.exports = Object.assign(
|
|
|
67
67
|
[$._top_level_item, $._top_level_statement],
|
|
68
68
|
[$.type_specifier, $._top_level_expression_statement],
|
|
69
69
|
[$.type_qualifier, $.extension_expression],
|
|
70
|
+
[$.storage_class_specifier, $.type_specifier],
|
|
71
|
+
[$._compound_literal_storage_class_specifier, $.type_specifier],
|
|
72
|
+
[$._compound_literal_constexpr_specifier, $.type_qualifier],
|
|
70
73
|
],
|
|
71
74
|
|
|
72
75
|
externals: () => [sym('pragma_operator'), sym('preproc_arg'), sym('_preproc_newline')],
|
|
@@ -458,7 +461,7 @@ module.exports = Object.assign(
|
|
|
458
461
|
'*',
|
|
459
462
|
repeat($.attribute_declaration),
|
|
460
463
|
repeat($.ms_pointer_modifier),
|
|
461
|
-
repeat($.type_qualifier),
|
|
464
|
+
repeat(choice($.type_qualifier, $.attribute_specifier)),
|
|
462
465
|
field('declarator', $._declarator)
|
|
463
466
|
)
|
|
464
467
|
)
|
|
@@ -472,7 +475,7 @@ module.exports = Object.assign(
|
|
|
472
475
|
'*',
|
|
473
476
|
repeat($.attribute_declaration),
|
|
474
477
|
repeat($.ms_pointer_modifier),
|
|
475
|
-
repeat($.type_qualifier),
|
|
478
|
+
repeat(choice($.type_qualifier, $.attribute_specifier)),
|
|
476
479
|
field('declarator', $._field_declarator)
|
|
477
480
|
)
|
|
478
481
|
)
|
|
@@ -486,7 +489,7 @@ module.exports = Object.assign(
|
|
|
486
489
|
'*',
|
|
487
490
|
repeat($.attribute_declaration),
|
|
488
491
|
repeat($.ms_pointer_modifier),
|
|
489
|
-
repeat($.type_qualifier),
|
|
492
|
+
repeat(choice($.type_qualifier, $.attribute_specifier)),
|
|
490
493
|
field('declarator', $._type_declarator)
|
|
491
494
|
)
|
|
492
495
|
)
|
|
@@ -499,7 +502,7 @@ module.exports = Object.assign(
|
|
|
499
502
|
'*',
|
|
500
503
|
repeat($.attribute_declaration),
|
|
501
504
|
repeat($.ms_pointer_modifier),
|
|
502
|
-
repeat($.type_qualifier),
|
|
505
|
+
repeat(choice($.type_qualifier, $.attribute_specifier)),
|
|
503
506
|
field('declarator', optional($._abstract_declarator))
|
|
504
507
|
)
|
|
505
508
|
)
|
|
@@ -633,7 +636,8 @@ module.exports = Object.assign(
|
|
|
633
636
|
$.sized_type_specifier,
|
|
634
637
|
alias($._sized_bit_int_specifier, $.sized_type_specifier),
|
|
635
638
|
$.primitive_type,
|
|
636
|
-
$._type_identifier
|
|
639
|
+
$._type_identifier,
|
|
640
|
+
prec.dynamic(-1, alias('thread_local', sym('type_identifier')))
|
|
637
641
|
),
|
|
638
642
|
|
|
639
643
|
typeof_specifier: ($) =>
|
|
@@ -932,6 +936,7 @@ module.exports = Object.assign(
|
|
|
932
936
|
$.field_expression,
|
|
933
937
|
$.compound_literal_expression,
|
|
934
938
|
$.identifier,
|
|
939
|
+
alias('thread_local', $.identifier),
|
|
935
940
|
$.number_literal,
|
|
936
941
|
$._string,
|
|
937
942
|
$.true,
|
|
@@ -1145,7 +1150,25 @@ module.exports = Object.assign(
|
|
|
1145
1150
|
),
|
|
1146
1151
|
|
|
1147
1152
|
compound_literal_expression: ($) =>
|
|
1148
|
-
seq(
|
|
1153
|
+
seq(
|
|
1154
|
+
'(',
|
|
1155
|
+
repeat(
|
|
1156
|
+
seq(
|
|
1157
|
+
optional(
|
|
1158
|
+
field('storage_class', alias($._compound_literal_constexpr_specifier, $.storage_class_specifier))
|
|
1159
|
+
),
|
|
1160
|
+
field('storage_class', alias($._compound_literal_storage_class_specifier, $.storage_class_specifier))
|
|
1161
|
+
)
|
|
1162
|
+
),
|
|
1163
|
+
field('type', $.type_descriptor),
|
|
1164
|
+
')',
|
|
1165
|
+
field('value', $.initializer_list)
|
|
1166
|
+
),
|
|
1167
|
+
|
|
1168
|
+
_compound_literal_constexpr_specifier: () => 'constexpr',
|
|
1169
|
+
|
|
1170
|
+
_compound_literal_storage_class_specifier: () =>
|
|
1171
|
+
choice('static', 'register', 'thread_local', '_Thread_local', '__thread'),
|
|
1149
1172
|
|
|
1150
1173
|
parenthesized_expression: ($) => seq('(', choice($.expression, $.comma_expression, $.compound_statement), ')'),
|
|
1151
1174
|
|
package/package.json
CHANGED
package/src/node-types.json
CHANGED
|
@@ -449,6 +449,10 @@
|
|
|
449
449
|
"type": "attribute_declaration",
|
|
450
450
|
"named": true
|
|
451
451
|
},
|
|
452
|
+
{
|
|
453
|
+
"type": "attribute_specifier",
|
|
454
|
+
"named": true
|
|
455
|
+
},
|
|
452
456
|
{
|
|
453
457
|
"type": "ms_pointer_modifier",
|
|
454
458
|
"named": true
|
|
@@ -1145,6 +1149,16 @@
|
|
|
1145
1149
|
"type": "compound_literal_expression",
|
|
1146
1150
|
"named": true,
|
|
1147
1151
|
"fields": {
|
|
1152
|
+
"storage_class": {
|
|
1153
|
+
"multiple": true,
|
|
1154
|
+
"required": false,
|
|
1155
|
+
"types": [
|
|
1156
|
+
{
|
|
1157
|
+
"type": "storage_class_specifier",
|
|
1158
|
+
"named": true
|
|
1159
|
+
}
|
|
1160
|
+
]
|
|
1161
|
+
},
|
|
1148
1162
|
"type": {
|
|
1149
1163
|
"multiple": false,
|
|
1150
1164
|
"required": true,
|
|
@@ -2765,6 +2779,10 @@
|
|
|
2765
2779
|
"type": "attribute_declaration",
|
|
2766
2780
|
"named": true
|
|
2767
2781
|
},
|
|
2782
|
+
{
|
|
2783
|
+
"type": "attribute_specifier",
|
|
2784
|
+
"named": true
|
|
2785
|
+
},
|
|
2768
2786
|
{
|
|
2769
2787
|
"type": "ms_based_modifier",
|
|
2770
2788
|
"named": true
|
package/tree-sitter-c.wasm
CHANGED
|
Binary file
|