@willbooster/tree-sitter-c 47.0.0 → 48.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/grammar.js +4 -12
- package/package.json +1 -1
- package/src/functionMacro.h +11 -2
- package/src/keywords.h +0 -1
- package/tree-sitter-c.wasm +0 -0
- package/tree-sitter.json +1 -1
package/grammar.js
CHANGED
|
@@ -500,7 +500,6 @@ module.exports = Object.assign(
|
|
|
500
500
|
[$.attributed_type_declarator, $._type_declarator],
|
|
501
501
|
[$._declaration_modifiers, $._field_declaration_list_item],
|
|
502
502
|
[$._declaration_specifiers],
|
|
503
|
-
[$._compound_literal_constexpr_specifier, $.type_qualifier],
|
|
504
503
|
[$._marked_macro_type_specifiers],
|
|
505
504
|
[$._braced_leading_macro_attribute_specifier, $._post_type_macro_attribute_specifier],
|
|
506
505
|
[
|
|
@@ -1605,6 +1604,7 @@ module.exports = Object.assign(
|
|
|
1605
1604
|
'static',
|
|
1606
1605
|
'auto',
|
|
1607
1606
|
'register',
|
|
1607
|
+
'constexpr',
|
|
1608
1608
|
'inline',
|
|
1609
1609
|
'__inline',
|
|
1610
1610
|
'__inline__',
|
|
@@ -1617,7 +1617,6 @@ module.exports = Object.assign(
|
|
|
1617
1617
|
type_qualifier: ($) =>
|
|
1618
1618
|
choice(
|
|
1619
1619
|
'const',
|
|
1620
|
-
'constexpr',
|
|
1621
1620
|
'volatile',
|
|
1622
1621
|
'restrict',
|
|
1623
1622
|
'__restrict__',
|
|
@@ -2256,7 +2255,7 @@ module.exports = Object.assign(
|
|
|
2256
2255
|
|
|
2257
2256
|
platform_version: ($) => seq(field('platform', $.identifier), field('version', $.version_number)),
|
|
2258
2257
|
|
|
2259
|
-
version_number: () => /\d+(\.\d+){0,2}
|
|
2258
|
+
version_number: () => token(prec(-1, /\d+(\.\d+){0,2}/)),
|
|
2260
2259
|
|
|
2261
2260
|
gnu_asm_expression: ($) =>
|
|
2262
2261
|
prec(
|
|
@@ -2340,22 +2339,15 @@ module.exports = Object.assign(
|
|
|
2340
2339
|
seq(
|
|
2341
2340
|
'(',
|
|
2342
2341
|
repeat(
|
|
2343
|
-
|
|
2344
|
-
optional(
|
|
2345
|
-
field('storage_class', alias($._compound_literal_constexpr_specifier, $.storage_class_specifier))
|
|
2346
|
-
),
|
|
2347
|
-
field('storage_class', alias($._compound_literal_storage_class_specifier, $.storage_class_specifier))
|
|
2348
|
-
)
|
|
2342
|
+
field('storage_class', alias($._compound_literal_storage_class_specifier, $.storage_class_specifier))
|
|
2349
2343
|
),
|
|
2350
2344
|
field('type', $.type_descriptor),
|
|
2351
2345
|
')',
|
|
2352
2346
|
field('value', $.initializer_list)
|
|
2353
2347
|
),
|
|
2354
2348
|
|
|
2355
|
-
_compound_literal_constexpr_specifier: () => 'constexpr',
|
|
2356
|
-
|
|
2357
2349
|
_compound_literal_storage_class_specifier: () =>
|
|
2358
|
-
choice('static', 'register', 'thread_local', '_Thread_local', '__thread'),
|
|
2350
|
+
choice('static', 'constexpr', 'register', 'thread_local', '_Thread_local', '__thread'),
|
|
2359
2351
|
|
|
2360
2352
|
parenthesized_expression: ($) => seq('(', choice($.expression, $.comma_expression, $.compound_statement), ')'),
|
|
2361
2353
|
|
package/package.json
CHANGED
package/src/functionMacro.h
CHANGED
|
@@ -54,6 +54,7 @@ static bool function_macro_type_prefix_keyword(const MacroName *name, const char
|
|
|
54
54
|
static bool function_macro_group(int32_t c, int32_t open, int32_t close, unsigned *depth, unsigned *nested, unsigned *braces);
|
|
55
55
|
static void function_macro_note_literal(bool *literal, unsigned depth, unsigned nested, const MacroArgumentWord *word, int32_t c);
|
|
56
56
|
static bool function_macro_tail_word(TSLexer *lexer, bool escaped, MacroPrototypeTail *tail);
|
|
57
|
+
static bool function_macro_tail_modifier(const char *word, bool before_declarator);
|
|
57
58
|
static MacroGroup function_macro_tail_group(TSLexer *lexer, int32_t c, MacroPrototypeTail *tail, const PragmaTrivia *trivia);
|
|
58
59
|
static bool function_macro_tail_punctuator(TSLexer *lexer, int32_t c, MacroPrototypeTail *tail);
|
|
59
60
|
static bool function_macro_declaration_continues(TSLexer *lexer, bool post_type, bool allow_braced, const PragmaTrivia *trivia);
|
|
@@ -661,8 +662,16 @@ static bool function_macro_tail_word(TSLexer *lexer, bool escaped, MacroPrototyp
|
|
|
661
662
|
tail->modifier = pragma || (name.ascii && function_macro_word_in(word, function_macro_group_modifiers,
|
|
662
663
|
sizeof(function_macro_group_modifiers) / sizeof(function_macro_group_modifiers[0])));
|
|
663
664
|
return !tail->post_type || !keyword ||
|
|
664
|
-
|
|
665
|
-
|
|
665
|
+
function_macro_tail_modifier(word, !tail->declarator_name && !tail->declarator_group);
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
static bool function_macro_tail_modifier(const char *word, bool before_declarator) {
|
|
669
|
+
if (before_declarator) {
|
|
670
|
+
return function_macro_word_in(word, function_macro_type_prefix_modifiers,
|
|
671
|
+
sizeof(function_macro_type_prefix_modifiers) / sizeof(function_macro_type_prefix_modifiers[0]));
|
|
672
|
+
}
|
|
673
|
+
return function_macro_word_in(word, function_macro_declaration_modifiers,
|
|
674
|
+
sizeof(function_macro_declaration_modifiers) / sizeof(function_macro_declaration_modifiers[0]));
|
|
666
675
|
}
|
|
667
676
|
|
|
668
677
|
static bool function_macro_argument_escape(TSLexer *lexer, MacroArgumentWord *word) {
|
package/src/keywords.h
CHANGED
package/tree-sitter-c.wasm
CHANGED
|
Binary file
|