@willbooster/tree-sitter-c 14.0.0 → 15.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/README.md CHANGED
@@ -18,7 +18,7 @@ This fork fixes parsing bugs and raises conformance with the ISO C standard
18
18
  ## Usage
19
19
 
20
20
  The npm package ships `tree-sitter-c.wasm` for
21
- [@willbooster/web-tree-sitter](https://www.npmjs.com/package/@willbooster/web-tree-sitter) version 7.0.5 or later, which runs in Node.js, Bun, browsers, and Cloudflare Workers. The parser carries the ABI number of the WillBooster/tree-sitter generator (`0x57420006`), so it loads only with that runtime; upstream tree-sitter runtimes reject it. In Node.js and Bun, load the grammar from its path:
21
+ [@willbooster/web-tree-sitter](https://www.npmjs.com/package/@willbooster/web-tree-sitter) version 10.0.2 or later within 10.x, which runs in Node.js, Bun, browsers, and Cloudflare Workers. The parser carries the ABI number of the WillBooster/tree-sitter generator (`0x57420007`), so it loads only with that runtime; upstream tree-sitter runtimes reject it. In Node.js and Bun, load the grammar from its path:
22
22
 
23
23
  ```js
24
24
  import { fileURLToPath } from 'node:url';
@@ -118,12 +118,12 @@ arrays, parenthesized/function declarators, initializers and multiple declarator
118
118
 
119
119
  In Rust, depend on the [crate](https://crates.io/crates/willbooster-tree-sitter-c) and on
120
120
  [willbooster-tree-sitter](https://crates.io/crates/willbooster-tree-sitter), the runtime this package is tested and
121
- fuzzed with, at version 7.0.5 or later. No other runtime loads the parser:
121
+ fuzzed with, at version 10.0.2 or later within 10.x. No other runtime loads the parser:
122
122
 
123
123
  ```toml
124
124
  [dependencies]
125
- tree-sitter = { package = "willbooster-tree-sitter", version = "7.0.5" }
126
- tree-sitter-c = { package = "willbooster-tree-sitter-c", version = "11" }
125
+ tree-sitter = { package = "willbooster-tree-sitter", version = "10.0.2" }
126
+ tree-sitter-c = { package = "willbooster-tree-sitter-c", version = "15" }
127
127
  ```
128
128
 
129
129
  ```rust
package/grammar.js CHANGED
@@ -137,9 +137,7 @@ module.exports = Object.assign(
137
137
  [$.type_definition, $._type_declarator],
138
138
  [$.type_definition, $.sized_type_specifier],
139
139
  [$.type_definition, $._sized_bit_int_specifier],
140
- [$.attributed_statement],
141
140
  [$.case_statement],
142
- [$._single_attributed_statement],
143
141
  [$._statement_declaration_modifiers, $._case_body_attributed_statement, $._case_label_attributes],
144
142
  [$._statement_declaration_modifiers, $.attributed_statement, $.case_statement],
145
143
  [$.enum_specifier],
@@ -213,7 +211,9 @@ module.exports = Object.assign(
213
211
  $.statement,
214
212
  $._single_noncompound_statement,
215
213
  $._non_case_statement,
214
+ $._unattributed_non_case_statement,
216
215
  $._single_non_case_statement,
216
+ $._single_unattributed_non_case_statement,
217
217
  $._case_body_statement,
218
218
  $._case_body_unattributed_statement,
219
219
  $._case_label_tail,
@@ -482,7 +482,13 @@ module.exports = Object.assign(
482
482
  repeat($.attribute_declaration),
483
483
  repeat($.ms_pointer_modifier),
484
484
  repeat(
485
- choice($.type_qualifier, $.attribute_specifier, $.macro_specifier, $._conditional_macro_specifier)
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
  )
@@ -730,7 +736,13 @@ module.exports = Object.assign(
730
736
  repeat($.attribute_declaration),
731
737
  repeat($.ms_pointer_modifier),
732
738
  repeat(
733
- choice($.type_qualifier, $.attribute_specifier, $.macro_specifier, $._conditional_macro_specifier)
739
+ choice(
740
+ $.type_qualifier,
741
+ $.attribute_specifier,
742
+ prec(-1, $.ms_call_modifier),
743
+ $.macro_specifier,
744
+ $._conditional_macro_specifier
745
+ )
734
746
  ),
735
747
  field('declarator', $._field_declarator)
736
748
  )
@@ -747,7 +759,13 @@ module.exports = Object.assign(
747
759
  repeat($.attribute_declaration),
748
760
  repeat($.ms_pointer_modifier),
749
761
  repeat(
750
- choice($.type_qualifier, $.attribute_specifier, $.macro_specifier, $._conditional_macro_specifier)
762
+ choice(
763
+ $.type_qualifier,
764
+ $.attribute_specifier,
765
+ prec(-1, $.ms_call_modifier),
766
+ $.macro_specifier,
767
+ $._conditional_macro_specifier
768
+ )
751
769
  ),
752
770
  field('declarator', $._type_declarator)
753
771
  )
@@ -762,7 +780,7 @@ module.exports = Object.assign(
762
780
  '*',
763
781
  repeat($.attribute_declaration),
764
782
  repeat($.ms_pointer_modifier),
765
- repeat(choice($.type_qualifier, $.attribute_specifier)),
783
+ repeat(choice($.type_qualifier, $.attribute_specifier, prec(-1, $.ms_call_modifier))),
766
784
  field('declarator', optional($._abstract_declarator))
767
785
  )
768
786
  )
@@ -1061,11 +1079,13 @@ module.exports = Object.assign(
1061
1079
  repeat($.attribute_specifier)
1062
1080
  ),
1063
1081
 
1064
- attributed_statement: ($) => seq(repeat1($.attribute_declaration), alias($._non_case_statement, $.statement)),
1082
+ attributed_statement: ($) =>
1083
+ seq(repeat1($.attribute_declaration), alias($._unattributed_non_case_statement, $.statement)),
1065
1084
 
1066
1085
  statement: ($) => choice($.case_statement, alias($._non_case_statement, $.statement)),
1067
1086
 
1068
- _non_case_statement: ($) => choice($.attributed_statement, $._unattributed_non_case_statement),
1087
+ _non_case_statement: ($) =>
1088
+ choice($.attributed_statement, alias($._unattributed_non_case_statement, $.statement)),
1069
1089
 
1070
1090
  _unattributed_non_case_statement: ($) => choice($.labeled_statement, $._unlabeled_non_case_statement),
1071
1091
 
@@ -1137,6 +1157,12 @@ module.exports = Object.assign(
1137
1157
  choice(alias($._single_case_statement, $.case_statement), alias($._single_non_case_statement, $.statement)),
1138
1158
 
1139
1159
  _single_non_case_statement: ($) =>
1160
+ choice(
1161
+ alias($._single_unattributed_non_case_statement, $.statement),
1162
+ alias($._single_attributed_statement, $.attributed_statement)
1163
+ ),
1164
+
1165
+ _single_unattributed_non_case_statement: ($) =>
1140
1166
  choice(
1141
1167
  $.expression_statement,
1142
1168
  $.switch_statement,
@@ -1150,8 +1176,7 @@ module.exports = Object.assign(
1150
1176
  $.if_statement,
1151
1177
  $.while_statement,
1152
1178
  $.do_statement,
1153
- $.for_statement,
1154
- alias($._single_attributed_statement, $.attributed_statement)
1179
+ $.for_statement
1155
1180
  ),
1156
1181
 
1157
1182
  _single_case_statement: ($) =>
@@ -1189,7 +1214,7 @@ module.exports = Object.assign(
1189
1214
  _single_attributed_statement: ($) =>
1190
1215
  seq(
1191
1216
  repeat1($.attribute_declaration),
1192
- choice($.compound_statement, alias($._single_non_case_statement, $.statement))
1217
+ choice($.compound_statement, alias($._single_unattributed_non_case_statement, $.statement))
1193
1218
  ),
1194
1219
 
1195
1220
  case_statement: ($) =>
@@ -1786,7 +1811,15 @@ function pointerDeclaratorRule($, declarator) {
1786
1811
  '*',
1787
1812
  repeat($.attribute_declaration),
1788
1813
  repeat($.ms_pointer_modifier),
1789
- repeat(choice($.type_qualifier, $.attribute_specifier, $.macro_specifier, $._conditional_macro_specifier)),
1814
+ repeat(
1815
+ choice(
1816
+ $.type_qualifier,
1817
+ $.attribute_specifier,
1818
+ prec(-1, $.ms_call_modifier),
1819
+ $.macro_specifier,
1820
+ $._conditional_macro_specifier
1821
+ )
1822
+ ),
1790
1823
  field('declarator', declarator)
1791
1824
  )
1792
1825
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-c",
3
- "version": "14.0.0",
3
+ "version": "15.0.0",
4
4
  "description": "C grammar for tree-sitter",
5
5
  "keywords": [
6
6
  "incremental",
@@ -55,7 +55,7 @@
55
55
  "@willbooster/oxfmt-config": "1.2.2",
56
56
  "@willbooster/oxlint-config": "1.4.8",
57
57
  "@willbooster/wb": "22.26.2",
58
- "@willbooster/web-tree-sitter": "7.0.5",
58
+ "@willbooster/web-tree-sitter": "10.0.2",
59
59
  "conventional-changelog-conventionalcommits": "10.4.1",
60
60
  "lefthook": "2.2.2",
61
61
  "oxfmt": "0.73.0",
@@ -68,7 +68,7 @@
68
68
  "wrangler": "4.149.0"
69
69
  },
70
70
  "peerDependencies": {
71
- "@willbooster/web-tree-sitter": "^7.0.5"
71
+ "@willbooster/web-tree-sitter": "^10.0.2"
72
72
  },
73
73
  "peerDependenciesMeta": {
74
74
  "@willbooster/web-tree-sitter": {
Binary file
package/tree-sitter.json CHANGED
@@ -16,7 +16,7 @@
16
16
  }
17
17
  ],
18
18
  "metadata": {
19
- "version": "14.0.0",
19
+ "version": "15.0.0",
20
20
  "license": "MIT",
21
21
  "description": "C grammar for tree-sitter",
22
22
  "authors": [