@willbooster/tree-sitter-c 21.0.0 → 22.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
@@ -5,7 +5,7 @@
5
5
  [![Test](https://github.com/WillBooster/tree-sitter-c/actions/workflows/test.yml/badge.svg)](https://github.com/WillBooster/tree-sitter-c/actions/workflows/test.yml)
6
6
  [![Test rust](https://github.com/WillBooster/tree-sitter-c/actions/workflows/test-rust.yml/badge.svg)](https://github.com/WillBooster/tree-sitter-c/actions/workflows/test-rust.yml)
7
7
  [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
8
- [![wbfy](https://img.shields.io/badge/wbfy-20.51.1-1e90ff.svg)](https://github.com/WillBooster/shared/tree/main/packages/wbfy)
8
+ [![wbfy](https://img.shields.io/badge/wbfy-21.3.0-1e90ff.svg)](https://github.com/WillBooster/shared/tree/main/packages/wbfy)
9
9
  [![crates.io](https://img.shields.io/crates/v/willbooster-tree-sitter-c.svg)](https://crates.io/crates/willbooster-tree-sitter-c)
10
10
 
11
11
  C grammar for [tree-sitter](https://github.com/tree-sitter/tree-sitter), forked from
@@ -192,10 +192,9 @@ In Rust, depend on the [crate](https://crates.io/crates/willbooster-tree-sitter-
192
192
  [willbooster-tree-sitter](https://crates.io/crates/willbooster-tree-sitter), the runtime this package is tested and
193
193
  fuzzed with, at version 15.0.3 or later within 15.x. No other runtime loads the parser:
194
194
 
195
- ```toml
196
- [dependencies]
197
- tree-sitter = { package = "willbooster-tree-sitter", version = "15.0.3" }
198
- tree-sitter-c = { package = "willbooster-tree-sitter-c", version = "20" }
195
+ ```sh
196
+ cargo add willbooster-tree-sitter@15.0.3 --rename tree-sitter
197
+ cargo add willbooster-tree-sitter-c --rename tree-sitter-c
199
198
  ```
200
199
 
201
200
  ```rust
package/grammar.js CHANGED
@@ -636,18 +636,20 @@ module.exports = Object.assign(
636
636
  ...preprocIf('_in_statement', () => sym('_block_item')),
637
637
  ...preprocIf('_in_single_case', () => sym('_single_case_body'), 0, true),
638
638
  ...preprocIf('_in_field_declaration_list', () => sym('_field_declaration_list_item')),
639
- ...preprocIf('_in_enumerator_list', () => choice(seq(sym('enumerator'), ','), sym('_enumerator_directives'))),
639
+ ...preprocIf('_in_enumerator_list', () => sym('_enumerator_list_item')),
640
640
  ...preprocIf(
641
641
  '_in_enumerator_list_no_comma',
642
642
  () =>
643
643
  choice(
644
- seq(optional(sym('_enumerator_directives')), sym('enumerator'), optional(sym('_enumerator_directives'))),
645
- sym('_enumerator_directives')
644
+ seq(repeat(sym('_enumerator_list_item')), sym('enumerator'), optional(sym('_enumerator_directives'))),
645
+ repeat1(sym('_enumerator_list_item'))
646
646
  ),
647
647
  0,
648
648
  false
649
649
  ),
650
650
 
651
+ _enumerator_list_item: ($) => choice(seq($.enumerator, ','), $._enumerator_macro, $._enumerator_directives),
652
+
651
653
  _enumerator_directives: ($) => prec.right(repeat1($.preproc_call)),
652
654
 
653
655
  _preproc_newline: () => token.immediate(/\r?\n/),
@@ -1413,6 +1415,7 @@ module.exports = Object.assign(
1413
1415
  repeat(
1414
1416
  choice(
1415
1417
  seq($.enumerator, ','),
1418
+ $._enumerator_macro,
1416
1419
  alias(sym('preproc_if_in_enumerator_list'), sym('preproc_if')),
1417
1420
  alias(sym('preproc_ifdef_in_enumerator_list'), sym('preproc_ifdef')),
1418
1421
  seq($.preproc_call, ','),
@@ -1485,6 +1488,14 @@ module.exports = Object.assign(
1485
1488
 
1486
1489
  bitfield_clause: ($) => seq(':', $.expression),
1487
1490
 
1491
+ _enumerator_macro: ($) => seq(alias($._enumerator_macro_call, $.call_expression), optional(',')),
1492
+
1493
+ _enumerator_macro_call: ($) =>
1494
+ seq(
1495
+ field('function', $.identifier),
1496
+ field('arguments', alias($._macro_attribute_argument_list, $.argument_list))
1497
+ ),
1498
+
1488
1499
  enumerator: ($) => seq(field('name', $.identifier), optional(seq('=', field('value', $.expression)))),
1489
1500
 
1490
1501
  variadic_parameter: () => '...',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-c",
3
- "version": "21.0.0",
3
+ "version": "22.0.0",
4
4
  "description": "C grammar for tree-sitter",
5
5
  "keywords": [
6
6
  "c",
@@ -57,7 +57,7 @@
57
57
  "@types/bun": "1.4.4",
58
58
  "@vitest/browser-playwright": "5.0.5",
59
59
  "@willbooster/oxlint-config": "1.4.9",
60
- "@willbooster/wb": "22.32.3",
60
+ "@willbooster/wb": "23.0.2",
61
61
  "@willbooster/web-tree-sitter": "15.0.3",
62
62
  "conventional-changelog-conventionalcommits": "10.4.1",
63
63
  "lefthook": "2.2.2",
@@ -66,7 +66,7 @@
66
66
  "playwright": "1.64.1",
67
67
  "semantic-release": "25.0.9",
68
68
  "vitest": "5.0.5",
69
- "wrangler": "4.151.1"
69
+ "wrangler": "4.152.0"
70
70
  },
71
71
  "peerDependencies": {
72
72
  "@willbooster/web-tree-sitter": "^15.0.3"
@@ -1774,6 +1774,10 @@
1774
1774
  "multiple": true,
1775
1775
  "required": false,
1776
1776
  "types": [
1777
+ {
1778
+ "type": "call_expression",
1779
+ "named": true
1780
+ },
1777
1781
  {
1778
1782
  "type": "enumerator",
1779
1783
  "named": true
Binary file
package/tree-sitter.json CHANGED
@@ -22,7 +22,7 @@
22
22
  }
23
23
  ],
24
24
  "metadata": {
25
- "version": "21.0.0",
25
+ "version": "22.0.0",
26
26
  "license": "MIT",
27
27
  "description": "C grammar for tree-sitter",
28
28
  "authors": [