@willbooster/tree-sitter-c-sharp 1.0.23 → 1.0.25

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
@@ -146,10 +146,11 @@ module.exports = grammar({
146
146
  // modifier) closed by ')=>'.
147
147
  $._lambda_paren_open,
148
148
  $._end_of_input,
149
+ $._directive_crlf,
149
150
  ],
150
151
 
151
152
  extras: ($) => [
152
- /[\s\u00A0\uFEFF\u3000]+/,
153
+ /[\s\u0085\u00A0\u2028\u2029\uFEFF\u3000]+/,
153
154
  $.comment,
154
155
  $.preproc_region,
155
156
  $.preproc_endregion,
@@ -1737,7 +1738,12 @@ module.exports = grammar({
1737
1738
  ...preprocIf('_in_enum_member_declaration', ($) => $.enum_member_declaration, 0, false),
1738
1739
  ...preprocIf('_in_attribute_list', ($) => $.attribute_list, -1, false),
1739
1740
 
1740
- preproc_arg: () => token(prec(-1, /\S([^/\n]|\/[^*]|\\\r?\n)*/)),
1741
+ preproc_arg: ($) =>
1742
+ seq(
1743
+ token(prec(-1, /[^\s\u0085\u2028\u2029]([^/\r\n\u0085\u2028\u2029]|\/[^*\r\n\u0085\u2028\u2029])*/)),
1744
+ optional($._preproc_arg_slash)
1745
+ ),
1746
+ _preproc_arg_slash: () => token.immediate(/\//),
1741
1747
  preproc_directive: () => /#[ \t]*[a-zA-Z0-9]\w*/,
1742
1748
 
1743
1749
  _preproc_expression: ($) =>
@@ -1854,9 +1860,9 @@ module.exports = grammar({
1854
1860
 
1855
1861
  preproc_undef: ($) => seq(preprocessor('undef'), $.preproc_arg, directiveEnd($)),
1856
1862
 
1857
- shebang_directive: () => token(seq('#!', /.*/)),
1863
+ shebang_directive: () => token(seq('#!', /[^\r\n\u0085\u2028\u2029]*/)),
1858
1864
 
1859
- comment: () => token(choice(seq('//', /[^\n\r]*/), seq('/*', /[^*]*\*+([^/*][^*]*\*+)*/, '/'))),
1865
+ comment: () => token(choice(seq('//', /[^\r\n\u0085\u2028\u2029]*/), seq('/*', /[^*]*\*+([^/*][^*]*\*+)*/, '/'))),
1860
1866
  },
1861
1867
  });
1862
1868
 
@@ -1869,7 +1875,12 @@ module.exports = grammar({
1869
1875
  * @returns {ChoiceRule}
1870
1876
  */
1871
1877
  function directiveEnd($) {
1872
- return choice(/\n/, $._end_of_input);
1878
+ return choice(directiveNewLine($), $._end_of_input);
1879
+ }
1880
+
1881
+ /** @param {GrammarSymbols<string>} $ */
1882
+ function directiveNewLine($) {
1883
+ return choice($._directive_crlf, /[\r\n\u0085\u2028\u2029]/);
1873
1884
  }
1874
1885
 
1875
1886
  /**
@@ -1916,7 +1927,7 @@ function preprocIf(suffix, content, precedence = 0, rep = true, required = false
1916
1927
  seq(
1917
1928
  preprocessor('if'),
1918
1929
  field('condition', $._preproc_expression),
1919
- /\n/,
1930
+ directiveNewLine($),
1920
1931
  rep ? repeat(content($)) : required ? content($) : optional(content($)),
1921
1932
  field('alternative', optional(alternativeBlock($))),
1922
1933
  preprocessor('endif')
@@ -1935,7 +1946,7 @@ function preprocIf(suffix, content, precedence = 0, rep = true, required = false
1935
1946
  seq(
1936
1947
  preprocessor('elif'),
1937
1948
  field('condition', $._preproc_expression),
1938
- /\n/,
1949
+ directiveNewLine($),
1939
1950
  rep ? repeat(content($)) : required ? content($) : optional(content($)),
1940
1951
  field('alternative', optional(alternativeBlock($)))
1941
1952
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-c-sharp",
3
- "version": "1.0.23",
3
+ "version": "1.0.25",
4
4
  "description": "C# grammar for tree-sitter",
5
5
  "keywords": [
6
6
  "incremental",
@@ -4810,6 +4810,11 @@
4810
4810
  ]
4811
4811
  }
4812
4812
  },
4813
+ {
4814
+ "type": "preproc_arg",
4815
+ "named": true,
4816
+ "fields": {}
4817
+ },
4813
4818
  {
4814
4819
  "type": "preproc_define",
4815
4820
  "named": true,
@@ -7299,10 +7304,6 @@
7299
7304
  "type": "predefined_type",
7300
7305
  "named": true
7301
7306
  },
7302
- {
7303
- "type": "preproc_arg",
7304
- "named": true
7305
- },
7306
7307
  {
7307
7308
  "type": "private",
7308
7309
  "named": false
Binary file
package/tree-sitter.json CHANGED
@@ -19,7 +19,7 @@
19
19
  }
20
20
  ],
21
21
  "metadata": {
22
- "version": "1.0.23",
22
+ "version": "1.0.25",
23
23
  "license": "MIT",
24
24
  "description": "C# grammar for tree-sitter",
25
25
  "authors": [