Socket
Socket
Sign inDemoInstall

tree-sitter-c-sharp

Package Overview
Dependencies
13
Maintainers
5
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.19.1 to 0.20.0

.github/workflows/publish_crate.yml

108

grammar.js

@@ -77,2 +77,3 @@ const PREC = {

[$._type, $.array_creation_expression],
[$._type, $.attribute],
[$._type, $.stack_alloc_array_creation_expression],

@@ -262,2 +263,3 @@ [$._type, $._nullable_base_type],

'readonly',
'required',
prec(1, 'ref'), //make sure that 'ref' is treated as a modifier for local variable declarations instead of as a ref expression

@@ -348,3 +350,3 @@ 'sealed',

choice($.array_type, $.nullable_type),
$.identifier
field('name', $.identifier),
),

@@ -387,4 +389,4 @@

'~',
$.identifier,
$.parameter_list,
field('name', $.identifier),
field('parameters', $.parameter_list),
$._function_body

@@ -412,3 +414,3 @@ ),

optional(choice('in', 'out')),
$.identifier
field('name', $.identifier),
),

@@ -605,2 +607,3 @@

'record',
optional('class'),
field('name', $.identifier),

@@ -612,2 +615,3 @@ field('type_parameters', optional($.type_parameter_list)),

field('body', $._record_body),
optional(';')
),

@@ -626,2 +630,3 @@

field('body', $._record_body),
optional(';')
),

@@ -840,10 +845,6 @@

// grammar.txt one doesn't seem to make sense so we do this instead
goto_statement: $ => seq(
'goto',
choice(
alias($.identifier, $.label_name),
seq('case', $._expression),
'default'
),
optional(choice('case', 'default')),
optional($._expression),
';'

@@ -865,3 +866,3 @@ ),

labeled_statement: $ => seq(
alias($.identifier, $.label_name),
$.identifier,
':',

@@ -938,3 +939,5 @@ $._statement

$.relational_pattern,
$.binary_pattern,
$.or_pattern,
$.and_pattern,
$.list_pattern,
$.type_pattern

@@ -945,2 +948,10 @@ ),

list_pattern: $ => seq(
'[',
optional(seq(commaSep1(choice($._pattern, $.slice_pattern)), optional(','))),
']'
),
slice_pattern: $ => '..',
parenthesized_pattern: $ => seq('(', $._pattern, ')'),

@@ -957,34 +968,33 @@

binary_pattern: $ => choice(
prec.left(PREC.AND, seq(
field('left', $._pattern),
field('operator', 'and'),
field('right', $._pattern)
)),
prec.left(PREC.OR, seq(
field('left', $._pattern),
field('operator', 'or'),
field('right', $._pattern)
)),
),
and_pattern: $ => prec.left(PREC.AND, seq(
field('left', $._pattern),
field('operator', 'and'),
field('right', $._pattern)
)),
or_pattern: $ => prec.left(PREC.OR, seq(
field('left', $._pattern),
field('operator', 'or'),
field('right', $._pattern)
)),
//We may need to expand this list if more things can be evaluated at compile time
constant_pattern: $ => choice(
$.binary_expression,
$.default_expression,
$.interpolated_string_expression,
$.parenthesized_expression,
$.postfix_unary_expression,
$.prefix_unary_expression,
$.size_of_expression,
$.tuple_expression,
$.type_of_expression,
$.member_access_expression,
$.invocation_expression,
$.cast_expression,
$._simple_name,
$._literal
),
$.binary_expression,
$.default_expression,
$.interpolated_string_expression,
$.parenthesized_expression,
$.postfix_unary_expression,
$.prefix_unary_expression,
$.size_of_expression,
$.tuple_expression,
$.type_of_expression,
$.member_access_expression,
$.invocation_expression,
$.cast_expression,
$._simple_name,
$._literal
),
declaration_pattern: $ => seq(

@@ -998,3 +1008,3 @@ field('type', $._type),

$.parenthesized_variable_designation,
$.identifier
field('name', $.identifier),
)),

@@ -1027,3 +1037,3 @@

)),
expression_colon: $ => seq($._expression, ':'),

@@ -1070,3 +1080,3 @@

field('type', $._type),
field('name', optional($.identifier)),
optional(field('name', $.identifier)),
')'

@@ -1104,3 +1114,3 @@ ),

'delegate',
optional($.parameter_list),
optional(field('parameters', $.parameter_list)),
$.block

@@ -1110,5 +1120,5 @@ ),

lambda_expression: $ => prec(-1, seq(
optional('async'),
optional('static'),
choice($.parameter_list, $.identifier),
repeat($.attribute_list),
optional(alias(choice('async', 'static', seq('async', 'static'), seq('static', 'async')), $.modifier)),
choice(field('parameters', $.parameter_list), $.identifier),
'=>',

@@ -1656,3 +1666,3 @@ field('body', choice($.block, $._expression))

)),
'"'
choice('"', '"U8', '"u8')
),

@@ -1668,3 +1678,3 @@

)),
'"'
choice('"', '"U8', '"u8')
)),

@@ -1671,0 +1681,0 @@

{
"name": "tree-sitter-c-sharp",
"version": "0.19.1",
"version": "0.20.0",
"description": "C# grammar for tree-sitter",

@@ -21,3 +21,3 @@ "main": "bindings/node",

"devDependencies": {
"tree-sitter-cli": "^0.19.4"
"tree-sitter-cli": "^0.20.0"
},

@@ -24,0 +24,0 @@ "scripts": {

@@ -15,19 +15,6 @@ # tree-sitter-c-sharp

Comprehensive support for C# exists with the following exceptions:
Comprehensive supports C# 1 through 10.0 with the following exceptions:
- [ ] `async`, `var` and `await` cannot be used as identifiers
- [ ] `async`, `var` and `await` cannot be used as identifiers everywhere they are valid
#### C# 8.0 (complete)
- [x] `readonly` members
- [x] Default interface methods
- [x] `switch` expressions
- [x] `switch` property patterns
- [x] `switch` tuple patterns
- [x] `static` local functions
- [x] Nullable reference types
- [x] Null-forgiving operator
- [x] Null-coalescing assignment
- [x] using statement without braces
#### C# 9.0 (complete)

@@ -65,3 +52,14 @@

- [x] Record structs
- [ ] Lambda improvements
#### C# 11.0 (under development)
- [x] Generic attributes
- [x] Static abstract members in interfaces
- [x] Newlines in string interpolations
- [x] List patterns
- [x] Slice pattern
- [x] Required members
- [ ] Raw string literals
### References

@@ -68,0 +66,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc