@willbooster/tree-sitter-c-sharp 4.0.0 → 5.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 +3 -1
- package/grammar.js +22 -21
- package/package.json +1 -1
- package/tree-sitter-c_sharp.wasm +0 -0
- package/tree-sitter.json +1 -1
package/README.md
CHANGED
|
@@ -77,6 +77,8 @@ parser.setLanguage(await Language.load(cSharp));
|
|
|
77
77
|
```
|
|
78
78
|
|
|
79
79
|
The package also ships the queries in `queries/` and the node types in `src/node-types.json`.
|
|
80
|
+
When extending the source grammar, use `grammar.js` and `src/scanner.c` from the same repository release tag.
|
|
81
|
+
Their external directive tokens and serialized scanner state must match.
|
|
80
82
|
|
|
81
83
|
In Rust, depend on the [crate](https://crates.io/crates/willbooster-tree-sitter-c-sharp) and on
|
|
82
84
|
[willbooster-tree-sitter](https://crates.io/crates/willbooster-tree-sitter), the runtime this package is tested and
|
|
@@ -85,7 +87,7 @@ fuzzed with. The parser requires runtime 2.0.0 or later:
|
|
|
85
87
|
```toml
|
|
86
88
|
[dependencies]
|
|
87
89
|
tree-sitter = { package = "willbooster-tree-sitter", version = "2.0.0" }
|
|
88
|
-
tree-sitter-c-sharp = { package = "willbooster-tree-sitter-c-sharp", version = "
|
|
90
|
+
tree-sitter-c-sharp = { package = "willbooster-tree-sitter-c-sharp", version = "5" }
|
|
89
91
|
```
|
|
90
92
|
|
|
91
93
|
```rust
|
package/grammar.js
CHANGED
|
@@ -152,8 +152,18 @@ module.exports = grammar({
|
|
|
152
152
|
// modifier) closed by ')=>'.
|
|
153
153
|
$._lambda_paren_open,
|
|
154
154
|
$._end_of_input,
|
|
155
|
-
$.
|
|
155
|
+
$._directive_newline,
|
|
156
156
|
$._file_directive_preproc_arg,
|
|
157
|
+
$._file_directive_sdk,
|
|
158
|
+
$._file_directive_package,
|
|
159
|
+
$._file_directive_property,
|
|
160
|
+
$._file_directive_project,
|
|
161
|
+
$._file_directive_ref,
|
|
162
|
+
$._file_directive_include,
|
|
163
|
+
$._file_directive_exclude,
|
|
164
|
+
$.file_directive_kind,
|
|
165
|
+
$._file_directive_literal_context,
|
|
166
|
+
$._file_directive_newline,
|
|
157
167
|
],
|
|
158
168
|
|
|
159
169
|
extras: ($) => [
|
|
@@ -1524,7 +1534,7 @@ module.exports = grammar({
|
|
|
1524
1534
|
|
|
1525
1535
|
interpolation_alignment_clause: ($) => seq(',', $.expression),
|
|
1526
1536
|
|
|
1527
|
-
interpolation_format_clause: () => seq(':', /[^}"]+/),
|
|
1537
|
+
interpolation_format_clause: ($) => seq(':', optional($._file_directive_literal_context), /[^}"]+/),
|
|
1528
1538
|
|
|
1529
1539
|
member_access_expression: ($) =>
|
|
1530
1540
|
prec(
|
|
@@ -1719,7 +1729,7 @@ module.exports = grammar({
|
|
|
1719
1729
|
string_literal: ($) =>
|
|
1720
1730
|
seq(
|
|
1721
1731
|
'"',
|
|
1722
|
-
repeat(choice($.string_literal_content, $.escape_sequence)),
|
|
1732
|
+
repeat(choice($.string_literal_content, $.escape_sequence, $._file_directive_literal_context)),
|
|
1723
1733
|
token.immediate('"'),
|
|
1724
1734
|
optional($.string_literal_encoding)
|
|
1725
1735
|
),
|
|
@@ -1896,6 +1906,7 @@ module.exports = grammar({
|
|
|
1896
1906
|
repeat(
|
|
1897
1907
|
choice(
|
|
1898
1908
|
$.string_literal_content,
|
|
1909
|
+
$._file_directive_literal_context,
|
|
1899
1910
|
alias(token.immediate(prec(-1, '\\')), $.string_literal_content),
|
|
1900
1911
|
alias(
|
|
1901
1912
|
token.immediate(
|
|
@@ -1959,25 +1970,17 @@ module.exports = grammar({
|
|
|
1959
1970
|
choice(
|
|
1960
1971
|
fileDirectiveArguments(
|
|
1961
1972
|
$,
|
|
1962
|
-
choice(
|
|
1963
|
-
alias(token(prec(-2, /#:[sS][dD][kK]/)), '#:sdk'),
|
|
1964
|
-
alias(token(prec(-2, /#:[pP][aA][cC][kK][aA][gG][eE]/)), '#:package')
|
|
1965
|
-
),
|
|
1973
|
+
choice(alias($._file_directive_sdk, '#:sdk'), alias($._file_directive_package, '#:package')),
|
|
1966
1974
|
'@',
|
|
1967
1975
|
'metadata'
|
|
1968
1976
|
),
|
|
1969
|
-
fileDirectiveArguments(
|
|
1970
|
-
$,
|
|
1971
|
-
alias(token(prec(-2, /#:[pP][rR][oO][pP][eE][rR][tT][yY]/)), '#:property'),
|
|
1972
|
-
'=',
|
|
1973
|
-
'value'
|
|
1974
|
-
),
|
|
1977
|
+
fileDirectiveArguments($, alias($._file_directive_property, '#:property'), '=', 'value'),
|
|
1975
1978
|
seq(
|
|
1976
1979
|
choice(
|
|
1977
|
-
alias(
|
|
1978
|
-
alias(
|
|
1979
|
-
alias(
|
|
1980
|
-
alias(
|
|
1980
|
+
alias($._file_directive_project, '#:project'),
|
|
1981
|
+
alias($._file_directive_ref, '#:ref'),
|
|
1982
|
+
alias($._file_directive_include, '#:include'),
|
|
1983
|
+
alias($._file_directive_exclude, '#:exclude')
|
|
1981
1984
|
),
|
|
1982
1985
|
optional(seq($._file_directive_spacing, field('value', $.file_directive_value)))
|
|
1983
1986
|
),
|
|
@@ -1987,11 +1990,9 @@ module.exports = grammar({
|
|
|
1987
1990
|
)
|
|
1988
1991
|
),
|
|
1989
1992
|
optional($._file_directive_spacing),
|
|
1990
|
-
choice(
|
|
1993
|
+
choice($._file_directive_newline, $._end_of_input)
|
|
1991
1994
|
),
|
|
1992
1995
|
|
|
1993
|
-
file_directive_kind: () => token(prec(-2, new RegExp(`#:[^${directiveWhitespace}]*`))),
|
|
1994
|
-
|
|
1995
1996
|
_file_directive_spacing: () => token.immediate(prec(1, new RegExp(`[${directiveHorizontal}]+`))),
|
|
1996
1997
|
file_directive_name: () =>
|
|
1997
1998
|
token.immediate(
|
|
@@ -2068,7 +2069,7 @@ function directiveEnd($) {
|
|
|
2068
2069
|
|
|
2069
2070
|
/** @param {GrammarSymbols<string>} $ */
|
|
2070
2071
|
function directiveNewLine($) {
|
|
2071
|
-
return
|
|
2072
|
+
return $._directive_newline;
|
|
2072
2073
|
}
|
|
2073
2074
|
|
|
2074
2075
|
/**
|
package/package.json
CHANGED
package/tree-sitter-c_sharp.wasm
CHANGED
|
Binary file
|