@willbooster/tree-sitter-c 5.1.0 → 5.1.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/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.36.11-1e90ff.svg)](https://github.com/WillBooster/shared/tree/main/packages/wbfy)
8
+ [![wbfy](https://img.shields.io/badge/wbfy-20.41.8-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
package/grammar.js CHANGED
@@ -96,6 +96,11 @@ module.exports = Object.assign(
96
96
  [$._single_attributed_statement],
97
97
  [$._declaration_modifiers, $.attributed_statement],
98
98
  [$.enum_specifier],
99
+ [sym('preproc_if_in_enumerator_list'), sym('preproc_if_in_enumerator_list_no_comma')],
100
+ [sym('preproc_ifdef_in_enumerator_list'), sym('preproc_ifdef_in_enumerator_list_no_comma')],
101
+ [sym('preproc_else_in_enumerator_list'), sym('preproc_else_in_enumerator_list_no_comma')],
102
+ [sym('preproc_elif_in_enumerator_list'), sym('preproc_elif_in_enumerator_list_no_comma')],
103
+ [sym('preproc_elifdef_in_enumerator_list'), sym('preproc_elifdef_in_enumerator_list_no_comma')],
99
104
  [$.type_specifier, $._old_style_parameter_list],
100
105
  [$.parameter_list, $._old_style_parameter_list],
101
106
  [$.function_declarator, $._function_declaration_declarator],
@@ -244,8 +249,19 @@ module.exports = Object.assign(
244
249
  ...preprocIf('', () => sym('_block_item')),
245
250
  ...preprocIf('_in_single_case', () => sym('_single_case_body'), 0, true),
246
251
  ...preprocIf('_in_field_declaration_list', () => sym('_field_declaration_list_item')),
247
- ...preprocIf('_in_enumerator_list', () => seq(sym('enumerator'), ',')),
248
- ...preprocIf('_in_enumerator_list_no_comma', () => sym('enumerator'), -1),
252
+ ...preprocIf('_in_enumerator_list', () => choice(seq(sym('enumerator'), ','), sym('_enumerator_directives'))),
253
+ ...preprocIf(
254
+ '_in_enumerator_list_no_comma',
255
+ () =>
256
+ choice(
257
+ seq(optional(sym('_enumerator_directives')), sym('enumerator'), optional(sym('_enumerator_directives'))),
258
+ sym('_enumerator_directives')
259
+ ),
260
+ 0,
261
+ false
262
+ ),
263
+
264
+ _enumerator_directives: ($) => prec.right(repeat1($.preproc_call)),
249
265
 
250
266
  _preproc_newline: () => token.immediate(/\r?\n/),
251
267
 
@@ -783,7 +799,8 @@ module.exports = Object.assign(
783
799
  seq($.enumerator, ','),
784
800
  alias(sym('preproc_if_in_enumerator_list'), sym('preproc_if')),
785
801
  alias(sym('preproc_ifdef_in_enumerator_list'), sym('preproc_ifdef')),
786
- seq($.preproc_call, ',')
802
+ seq($.preproc_call, ','),
803
+ prec(1, $.preproc_call)
787
804
  )
788
805
  ),
789
806
  optional(
@@ -791,11 +808,11 @@ module.exports = Object.assign(
791
808
  choice(
792
809
  $.enumerator,
793
810
  alias(sym('preproc_if_in_enumerator_list_no_comma'), sym('preproc_if')),
794
- alias(sym('preproc_ifdef_in_enumerator_list_no_comma'), sym('preproc_ifdef')),
795
- $.preproc_call
811
+ alias(sym('preproc_ifdef_in_enumerator_list_no_comma'), sym('preproc_ifdef'))
796
812
  )
797
813
  )
798
814
  ),
815
+ repeat($.preproc_call),
799
816
  '}'
800
817
  ),
801
818
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-c",
3
- "version": "5.1.0",
3
+ "version": "5.1.1",
4
4
  "description": "C grammar for tree-sitter",
5
5
  "keywords": [
6
6
  "incremental",
@@ -60,7 +60,6 @@
60
60
  "playwright": "1.64.0",
61
61
  "semantic-release": "25.0.9",
62
62
  "sort-package-json": "4.0.0",
63
- "typescript": "7.0.2",
64
63
  "vitest": "5.0.3",
65
64
  "wrangler": "4.149.0"
66
65
  },
Binary file
package/tree-sitter.json CHANGED
@@ -16,7 +16,7 @@
16
16
  }
17
17
  ],
18
18
  "metadata": {
19
- "version": "5.1.0",
19
+ "version": "5.1.1",
20
20
  "license": "MIT",
21
21
  "description": "C grammar for tree-sitter",
22
22
  "authors": [