@willbooster/tree-sitter-c-sharp 1.0.21 → 1.0.22

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
@@ -435,8 +435,6 @@ module.exports = grammar({
435
435
  '<',
436
436
  '>=',
437
437
  '<=',
438
- // C# 14: user-defined compound assignment operators.
439
- // https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-14#user-defined-compound-assignment-operators
440
438
  '+=',
441
439
  '-=',
442
440
  '*=',
@@ -502,14 +500,6 @@ module.exports = grammar({
502
500
  // and operators with a shared receiver inside a non-generic static class.
503
501
  // https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/proposals/csharp-14.0/extensions
504
502
  //
505
- // extension_declaration:
506
- // 'extension' type_parameter_list? '(' receiver_parameter ')'
507
- // type_parameter_constraints_clause* extension_body
508
- // extension_body: '{' extension_member_declaration* '}' ';'?
509
- // extension_member_declaration:
510
- // method_declaration | property_declaration | operator_declaration
511
- // receiver_parameter: attributes? parameter_modifiers? type identifier?
512
- //
513
503
  // `extension` is contextual; it is recognized as the start of an
514
504
  // extension declaration when followed by `<` or `(` in declaration
515
505
  // position. Use prec.dynamic so an identifier named `extension` in
@@ -1018,7 +1008,6 @@ module.exports = grammar({
1018
1008
  // Invocation with name - creates conflict with recursive_pattern's Name(positional_pattern_clause)
1019
1009
  _name_invocation_pattern: ($) => seq(field('function', $._name), field('arguments', $.argument_list)),
1020
1010
 
1021
- // Invocation where function is not a simple name
1022
1011
  // One above `invocation_expression`, which reads the same tokens where both fit.
1023
1012
  _complex_invocation_expression: ($) =>
1024
1013
  prec(
@@ -1067,15 +1056,11 @@ module.exports = grammar({
1067
1056
  )
1068
1057
  ),
1069
1058
 
1070
- // C# 11 slice pattern: `..` optionally followed by a subpattern that
1071
- // binds the captured slice. `[a, .. var rest, z]`, `[..]` (bare),
1072
- // `[.. List<int> rest]` (declaration_pattern), etc.
1073
1059
  slice_pattern: ($) => prec.right(seq('..', optional($.pattern))),
1074
1060
 
1075
1061
  recursive_pattern: ($) =>
1076
1062
  prec.left(
1077
1063
  choice(
1078
- // name followed by positional pattern WITH variable designation
1079
1064
  prec.dynamic(
1080
1065
  1,
1081
1066
  seq(
@@ -1085,16 +1070,12 @@ module.exports = grammar({
1085
1070
  $._simple_designation
1086
1071
  )
1087
1072
  ),
1088
- // name followed by positional pattern WITHOUT variable designation
1089
1073
  prec.dynamic(
1090
1074
  -1,
1091
1075
  seq(field('type', $._name), $.positional_pattern_clause, optional($.property_pattern_clause))
1092
1076
  ),
1093
- // positional pattern with variable designation (no type prefix)
1094
1077
  prec.dynamic(1, seq($.positional_pattern_clause, $._simple_designation)),
1095
- // positional pattern without variable designation (no type prefix)
1096
1078
  $.positional_pattern_clause,
1097
- // other type followed by a property pattern clause
1098
1079
  seq(field('type', $.type), $.property_pattern_clause, optional($._simple_designation)),
1099
1080
  // A positional clause follows only a name (above), a predefined type, or an array type. Letting any type take
1100
1081
  // one reads `Name(A.B)` once more, through `type`; after a syntax error, the extra GLR versions then exceed
@@ -1166,10 +1147,6 @@ module.exports = grammar({
1166
1147
  $.typeof_expression,
1167
1148
  $.makeref_expression,
1168
1149
  $.ref_expression,
1169
- // Address-of (see `_address_of_expression` below): aliased to
1170
- // `prefix_unary_expression` to preserve the public AST shape.
1171
- // Parallels `_pointer_indirection_expression` (the `*` operator),
1172
- // which is similarly aliased back into `lvalue_expression`.
1173
1150
  alias($._address_of_expression, $.prefix_unary_expression),
1174
1151
  alias($._value_indirection_expression, $.prefix_unary_expression),
1175
1152
  $.reftype_expression,
@@ -1504,7 +1481,6 @@ module.exports = grammar({
1504
1481
  )
1505
1482
  ),
1506
1483
 
1507
- // inline
1508
1484
  _object_creation_type: ($) => choice($._name, $.nullable_type, $.predefined_type),
1509
1485
 
1510
1486
  parenthesized_expression: ($) => seq('(', $.non_lvalue_expression, ')'),
@@ -1626,7 +1602,7 @@ module.exports = grammar({
1626
1602
  seq(
1627
1603
  optional(seq(field('name', $.identifier), ':')),
1628
1604
  optional(choice('ref', 'out', 'in')),
1629
- choice($.expression, $.declaration_expression)
1605
+ choice($.expression, prec.dynamic(-1, $.declaration_expression))
1630
1606
  )
1631
1607
  ),
1632
1608
 
@@ -1741,8 +1717,6 @@ module.exports = grammar({
1741
1717
  'yield'
1742
1718
  ),
1743
1719
 
1744
- // Preprocessor
1745
-
1746
1720
  ...preprocIf('', ($) => $.declaration),
1747
1721
  ...preprocIf('_in_top_level', ($) => choice($._top_level_item_no_statement, $.statement)),
1748
1722
  ...preprocIf('_in_expression', ($) => $.expression, -2, false),
@@ -1885,8 +1859,6 @@ function directiveEnd($) {
1885
1859
  }
1886
1860
 
1887
1861
  /**
1888
- * Creates a preprocessor regex rule
1889
- *
1890
1862
  * @param {string} command
1891
1863
  *
1892
1864
  * @returns {AliasRule}
@@ -1973,8 +1945,6 @@ function postfixOperand($) {
1973
1945
  }
1974
1946
 
1975
1947
  /**
1976
- * Creates a rule to match one or more of the rules separated by a comma
1977
- *
1978
1948
  * @param {Rule} rule
1979
1949
  *
1980
1950
  * @returns {SeqRule}
@@ -1984,8 +1954,6 @@ function commaSep1(rule) {
1984
1954
  }
1985
1955
 
1986
1956
  /**
1987
- * Creates a rule to match two or more of the rules separated by a comma
1988
- *
1989
1957
  * @param {Rule} rule
1990
1958
  *
1991
1959
  * @returns {SeqRule}
@@ -1995,8 +1963,6 @@ function commaSep2(rule) {
1995
1963
  }
1996
1964
 
1997
1965
  /**
1998
- * Creates a rule to optionally match one or more of the rules separated by a comma
1999
- *
2000
1966
  * @param {Rule} rule
2001
1967
  *
2002
1968
  * @returns {ChoiceRule}
@@ -2006,8 +1972,6 @@ function commaSep(rule) {
2006
1972
  }
2007
1973
 
2008
1974
  /**
2009
- * Creates a rule to match one or more of the rules separated by `separator`
2010
- *
2011
1975
  * @param {RuleOrLiteral} rule
2012
1976
  *
2013
1977
  * @param {RuleOrLiteral} separator
@@ -2019,8 +1983,6 @@ function sep1(rule, separator) {
2019
1983
  }
2020
1984
 
2021
1985
  /**
2022
- * Creates a rule to optionally match one or more of the rules separated by `separator`
2023
- *
2024
1986
  * @param {RuleOrLiteral} rule
2025
1987
  *
2026
1988
  * @param {RuleOrLiteral} separator
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-c-sharp",
3
- "version": "1.0.21",
3
+ "version": "1.0.22",
4
4
  "description": "C# grammar for tree-sitter",
5
5
  "keywords": [
6
6
  "incremental",
Binary file
package/tree-sitter.json CHANGED
@@ -19,7 +19,7 @@
19
19
  }
20
20
  ],
21
21
  "metadata": {
22
- "version": "1.0.21",
22
+ "version": "1.0.22",
23
23
  "license": "MIT",
24
24
  "description": "C# grammar for tree-sitter",
25
25
  "authors": [