@willbooster/tree-sitter-c 13.0.0 → 14.0.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 +44 -10
- package/package.json +1 -1
- package/tree-sitter-c.wasm +0 -0
- package/tree-sitter.json +1 -1
package/grammar.js
CHANGED
|
@@ -482,7 +482,13 @@ module.exports = Object.assign(
|
|
|
482
482
|
repeat($.attribute_declaration),
|
|
483
483
|
repeat($.ms_pointer_modifier),
|
|
484
484
|
repeat(
|
|
485
|
-
choice(
|
|
485
|
+
choice(
|
|
486
|
+
$.type_qualifier,
|
|
487
|
+
$.attribute_specifier,
|
|
488
|
+
prec(-1, $.ms_call_modifier),
|
|
489
|
+
$.macro_specifier,
|
|
490
|
+
$._conditional_macro_specifier
|
|
491
|
+
)
|
|
486
492
|
),
|
|
487
493
|
field('declarator', alias($._old_style_declarator, $._declarator))
|
|
488
494
|
)
|
|
@@ -707,13 +713,12 @@ module.exports = Object.assign(
|
|
|
707
713
|
),
|
|
708
714
|
|
|
709
715
|
parenthesized_declarator: ($) =>
|
|
710
|
-
prec.dynamic(PREC.PAREN_DECLARATOR,
|
|
716
|
+
prec.dynamic(PREC.PAREN_DECLARATOR, parenthesizedDeclaratorRule($, $._declarator)),
|
|
711
717
|
parenthesized_field_declarator: ($) =>
|
|
712
|
-
prec.dynamic(PREC.PAREN_DECLARATOR,
|
|
718
|
+
prec.dynamic(PREC.PAREN_DECLARATOR, parenthesizedDeclaratorRule($, $._field_declarator)),
|
|
713
719
|
parenthesized_type_declarator: ($) =>
|
|
714
|
-
prec.dynamic(PREC.PAREN_DECLARATOR,
|
|
715
|
-
abstract_parenthesized_declarator: ($) =>
|
|
716
|
-
prec(1, seq('(', optional($.ms_call_modifier), $._abstract_declarator, ')')),
|
|
720
|
+
prec.dynamic(PREC.PAREN_DECLARATOR, parenthesizedDeclaratorRule($, $._type_declarator)),
|
|
721
|
+
abstract_parenthesized_declarator: ($) => prec(1, parenthesizedDeclaratorRule($, $._abstract_declarator)),
|
|
717
722
|
|
|
718
723
|
attributed_declarator: ($) => seq($._unattributed_declarator, repeat1($.attribute_declaration)),
|
|
719
724
|
attributed_field_declarator: ($) => seq($._unattributed_field_declarator, repeat1($.attribute_declaration)),
|
|
@@ -731,7 +736,13 @@ module.exports = Object.assign(
|
|
|
731
736
|
repeat($.attribute_declaration),
|
|
732
737
|
repeat($.ms_pointer_modifier),
|
|
733
738
|
repeat(
|
|
734
|
-
choice(
|
|
739
|
+
choice(
|
|
740
|
+
$.type_qualifier,
|
|
741
|
+
$.attribute_specifier,
|
|
742
|
+
prec(-1, $.ms_call_modifier),
|
|
743
|
+
$.macro_specifier,
|
|
744
|
+
$._conditional_macro_specifier
|
|
745
|
+
)
|
|
735
746
|
),
|
|
736
747
|
field('declarator', $._field_declarator)
|
|
737
748
|
)
|
|
@@ -748,7 +759,13 @@ module.exports = Object.assign(
|
|
|
748
759
|
repeat($.attribute_declaration),
|
|
749
760
|
repeat($.ms_pointer_modifier),
|
|
750
761
|
repeat(
|
|
751
|
-
choice(
|
|
762
|
+
choice(
|
|
763
|
+
$.type_qualifier,
|
|
764
|
+
$.attribute_specifier,
|
|
765
|
+
prec(-1, $.ms_call_modifier),
|
|
766
|
+
$.macro_specifier,
|
|
767
|
+
$._conditional_macro_specifier
|
|
768
|
+
)
|
|
752
769
|
),
|
|
753
770
|
field('declarator', $._type_declarator)
|
|
754
771
|
)
|
|
@@ -763,7 +780,7 @@ module.exports = Object.assign(
|
|
|
763
780
|
'*',
|
|
764
781
|
repeat($.attribute_declaration),
|
|
765
782
|
repeat($.ms_pointer_modifier),
|
|
766
|
-
repeat(choice($.type_qualifier, $.attribute_specifier)),
|
|
783
|
+
repeat(choice($.type_qualifier, $.attribute_specifier, prec(-1, $.ms_call_modifier))),
|
|
767
784
|
field('declarator', optional($._abstract_declarator))
|
|
768
785
|
)
|
|
769
786
|
)
|
|
@@ -1766,6 +1783,15 @@ function conditionalMacroRule($, ifdef, ifndef) {
|
|
|
1766
1783
|
);
|
|
1767
1784
|
}
|
|
1768
1785
|
|
|
1786
|
+
/**
|
|
1787
|
+
* @param {import('./types/treeSitterDsl').GrammarSymbols<'ms_call_modifier'>} $
|
|
1788
|
+
* @param {import('./types/treeSitterDsl').Rule} declarator
|
|
1789
|
+
*/
|
|
1790
|
+
function parenthesizedDeclaratorRule($, declarator) {
|
|
1791
|
+
const parenthesized = seq('(', optional($.ms_call_modifier), declarator, ')');
|
|
1792
|
+
return choice(parenthesized, prec(2, seq($.ms_call_modifier, parenthesized)));
|
|
1793
|
+
}
|
|
1794
|
+
|
|
1769
1795
|
/**
|
|
1770
1796
|
* @param {import('./types/treeSitterDsl').GrammarSymbols<'ms_based_modifier' | 'ms_call_modifier' | 'attribute_declaration' | 'ms_pointer_modifier' | 'type_qualifier' | 'attribute_specifier' | 'macro_specifier' | '_conditional_macro_specifier'>} $
|
|
1771
1797
|
* @param {import('./types/treeSitterDsl').Rule} declarator
|
|
@@ -1778,7 +1804,15 @@ function pointerDeclaratorRule($, declarator) {
|
|
|
1778
1804
|
'*',
|
|
1779
1805
|
repeat($.attribute_declaration),
|
|
1780
1806
|
repeat($.ms_pointer_modifier),
|
|
1781
|
-
repeat(
|
|
1807
|
+
repeat(
|
|
1808
|
+
choice(
|
|
1809
|
+
$.type_qualifier,
|
|
1810
|
+
$.attribute_specifier,
|
|
1811
|
+
prec(-1, $.ms_call_modifier),
|
|
1812
|
+
$.macro_specifier,
|
|
1813
|
+
$._conditional_macro_specifier
|
|
1814
|
+
)
|
|
1815
|
+
),
|
|
1782
1816
|
field('declarator', declarator)
|
|
1783
1817
|
)
|
|
1784
1818
|
);
|
package/package.json
CHANGED
package/tree-sitter-c.wasm
CHANGED
|
Binary file
|