@willbooster/tree-sitter-c-sharp 10.0.0 → 11.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
@@ -41,7 +41,7 @@ The contextual type names `nint` and `nuint` use `identifier` nodes.
41
41
 
42
42
  The npm package ships `tree-sitter-c_sharp.wasm` for
43
43
  [@willbooster/web-tree-sitter](https://www.npmjs.com/package/@willbooster/web-tree-sitter), which runs in Node.js, Bun,
44
- browsers, and Cloudflare Workers. The parser uses WillBooster ABI 6 and loads only with that runtime. Use version 7.0.20 or later within major version 7; upstream's runtime rejects it. Install the runtime alongside the grammar when using
44
+ browsers, and Cloudflare Workers. The parser uses WillBooster ABI 7 and loads only with that runtime. Use version 9.0.0 or later within major version 9; upstream's runtime rejects it. Install the runtime alongside the grammar when using
45
45
  the Wasm parser; it remains an optional peer for consumers that only use the grammar source or queries.
46
46
 
47
47
  In Node.js and Bun, load it from the package:
@@ -89,12 +89,12 @@ Their external tokens and serialized scanner state must match.
89
89
 
90
90
  In Rust, depend on the [crate](https://crates.io/crates/willbooster-tree-sitter-c-sharp) and on
91
91
  [willbooster-tree-sitter](https://crates.io/crates/willbooster-tree-sitter), the runtime this package is tested and
92
- fuzzed with. Use runtime 7.0.20 or later within major version 7:
92
+ fuzzed with. Use runtime 9.0.0 or later within major version 9:
93
93
 
94
94
  ```toml
95
95
  [dependencies]
96
- tree-sitter = { package = "willbooster-tree-sitter", version = "7.0.20" }
97
- tree-sitter-c-sharp = { package = "willbooster-tree-sitter-c-sharp", version = "8" }
96
+ tree-sitter = { package = "willbooster-tree-sitter", version = "9.0.0" }
97
+ tree-sitter-c-sharp = { package = "willbooster-tree-sitter-c-sharp", version = "11" }
98
98
  ```
99
99
 
100
100
  ```rust
package/grammar.js CHANGED
@@ -11,7 +11,7 @@
11
11
  const { alias, choice, field, grammar, optional, prec, repeat, repeat1, seq, sym, token } =
12
12
  /** @type {typeof globalThis & import('@willbooster/web-tree-sitter/dsl').DSL} */ (globalThis);
13
13
 
14
- /** @typedef {'_preproc_expression' | '_top_level_item_no_statement' | '_base_list_mixed_type' | '_base_list_mixed_suffix' | '_base_list_trivia' | '_base_list' | '_base_list_type' | '_base_list_suffix' | '_base_list_prefix' | '_base_list_separator' | '_base_list_separator_path' | '_enum_base_clause' | '_enum_base_type' | 'attribute_list' | 'declaration' | 'enum_member_declaration' | 'expression' | 'method_signature' | 'statement'} PreprocContentRule */
14
+ /** @typedef {'_preproc_expression' | '_top_level_item_no_statement' | '_namespace_body_item' | '_base_list_mixed_type' | '_base_list_mixed_suffix' | '_base_list_trivia' | '_base_list' | '_base_list_type' | '_base_list_suffix' | '_base_list_prefix' | '_base_list_separator' | '_base_list_separator_path' | '_enum_base_clause' | '_enum_base_type' | 'attribute_list' | 'declaration' | 'enum_member_declaration' | 'expression' | 'method_signature' | 'statement'} PreprocContentRule */
15
15
 
16
16
  const PREC = {
17
17
  GENERIC: 19,
@@ -421,7 +421,20 @@ module.exports = grammar({
421
421
  _namespace_member_declaration: ($) => choice($.namespace_declaration, $.type_declaration),
422
422
 
423
423
  namespace_declaration: ($) =>
424
- seq('namespace', field('name', $._name), field('body', $.declaration_list), sym('_optional_semi')),
424
+ seq(
425
+ 'namespace',
426
+ field('name', $._name),
427
+ field('body', alias($._namespace_body, $.declaration_list)),
428
+ sym('_optional_semi')
429
+ ),
430
+
431
+ _namespace_body: ($) => seq('{', repeat($._namespace_body_item), blockEnd()),
432
+
433
+ _namespace_body_item: ($) =>
434
+ prec(
435
+ 1,
436
+ choice($.extern_alias_directive, $.declaration, alias(sym('preproc_if_in_namespace'), sym('preproc_if')))
437
+ ),
425
438
 
426
439
  file_scoped_namespace_declaration: ($) =>
427
440
  prec.right(seq('namespace', field('name', $._name), statementEnd(), repeat($._top_level_item_no_statement))),
@@ -2450,6 +2463,7 @@ module.exports = grammar({
2450
2463
  false,
2451
2464
  true
2452
2465
  ),
2466
+ ...preprocIf('_in_namespace', ($) => $._namespace_body_item, 1),
2453
2467
  ...preprocIfWithMixedContent(
2454
2468
  '_in_mixed_base_type',
2455
2469
  ($) => $._base_list_type,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-c-sharp",
3
- "version": "10.0.0",
3
+ "version": "11.0.0",
4
4
  "description": "C# grammar for tree-sitter",
5
5
  "keywords": [
6
6
  "incremental",
@@ -48,7 +48,7 @@
48
48
  "@willbooster/oxfmt-config": "1.2.2",
49
49
  "@willbooster/oxlint-config": "1.4.8",
50
50
  "@willbooster/wb": "22.26.2",
51
- "@willbooster/web-tree-sitter": "7.0.20",
51
+ "@willbooster/web-tree-sitter": "9.0.0",
52
52
  "conventional-changelog-conventionalcommits": "10.4.1",
53
53
  "lefthook": "2.2.2",
54
54
  "oxfmt": "0.73.0",
@@ -62,7 +62,7 @@
62
62
  "wrangler": "4.149.0"
63
63
  },
64
64
  "peerDependencies": {
65
- "@willbooster/web-tree-sitter": "^7.0.20"
65
+ "@willbooster/web-tree-sitter": "^9.0.0"
66
66
  },
67
67
  "peerDependenciesMeta": {
68
68
  "@willbooster/web-tree-sitter": {
@@ -2698,6 +2698,10 @@
2698
2698
  {
2699
2699
  "type": "declaration",
2700
2700
  "named": true
2701
+ },
2702
+ {
2703
+ "type": "extern_alias_directive",
2704
+ "named": true
2701
2705
  }
2702
2706
  ]
2703
2707
  }
Binary file
package/tree-sitter.json CHANGED
@@ -29,7 +29,7 @@
29
29
  }
30
30
  ],
31
31
  "metadata": {
32
- "version": "10.0.0",
32
+ "version": "11.0.0",
33
33
  "license": "MIT",
34
34
  "description": "C# grammar for tree-sitter",
35
35
  "authors": [