@willbooster/tree-sitter-c 1.3.0 → 1.4.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/grammar.js +25 -2
- package/package.json +1 -1
- package/src/node-types.json +10 -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')],
|
|
@@ -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
|
@@ -1145,6 +1145,16 @@
|
|
|
1145
1145
|
"type": "compound_literal_expression",
|
|
1146
1146
|
"named": true,
|
|
1147
1147
|
"fields": {
|
|
1148
|
+
"storage_class": {
|
|
1149
|
+
"multiple": true,
|
|
1150
|
+
"required": false,
|
|
1151
|
+
"types": [
|
|
1152
|
+
{
|
|
1153
|
+
"type": "storage_class_specifier",
|
|
1154
|
+
"named": true
|
|
1155
|
+
}
|
|
1156
|
+
]
|
|
1157
|
+
},
|
|
1148
1158
|
"type": {
|
|
1149
1159
|
"multiple": false,
|
|
1150
1160
|
"required": true,
|
package/tree-sitter-c.wasm
CHANGED
|
Binary file
|