@willbooster/tree-sitter-c-sharp 10.0.0 → 10.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 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": "10.0.1",
4
4
  "description": "C# grammar for tree-sitter",
5
5
  "keywords": [
6
6
  "incremental",
@@ -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": "10.0.1",
33
33
  "license": "MIT",
34
34
  "description": "C# grammar for tree-sitter",
35
35
  "authors": [