difftastic/vendor/tree-sitter-c-sharp
Wilfred Hughes 806f925948 Add 'vendor/tree-sitter-c-sharp/' from commit '4a3d9677f86aab13b7e721df22e12004416e2539'
git-subtree-dir: vendor/tree-sitter-c-sharp
git-subtree-mainline: 5991efdcc7
git-subtree-split: 4a3d9677f8
2021-09-22 22:12:22 +07:00
..
.github/workflows Add 'vendor/tree-sitter-c-sharp/' from commit '4a3d9677f86aab13b7e721df22e12004416e2539' 2021-09-22 22:12:22 +07:00
bindings Add 'vendor/tree-sitter-c-sharp/' from commit '4a3d9677f86aab13b7e721df22e12004416e2539' 2021-09-22 22:12:22 +07:00
corpus Add 'vendor/tree-sitter-c-sharp/' from commit '4a3d9677f86aab13b7e721df22e12004416e2539' 2021-09-22 22:12:22 +07:00
queries Add 'vendor/tree-sitter-c-sharp/' from commit '4a3d9677f86aab13b7e721df22e12004416e2539' 2021-09-22 22:12:22 +07:00
script Add 'vendor/tree-sitter-c-sharp/' from commit '4a3d9677f86aab13b7e721df22e12004416e2539' 2021-09-22 22:12:22 +07:00
src Add 'vendor/tree-sitter-c-sharp/' from commit '4a3d9677f86aab13b7e721df22e12004416e2539' 2021-09-22 22:12:22 +07:00
test/queries Add 'vendor/tree-sitter-c-sharp/' from commit '4a3d9677f86aab13b7e721df22e12004416e2539' 2021-09-22 22:12:22 +07:00
.gitattributes Add 'vendor/tree-sitter-c-sharp/' from commit '4a3d9677f86aab13b7e721df22e12004416e2539' 2021-09-22 22:12:22 +07:00
.gitignore Add 'vendor/tree-sitter-c-sharp/' from commit '4a3d9677f86aab13b7e721df22e12004416e2539' 2021-09-22 22:12:22 +07:00
.npmignore Add 'vendor/tree-sitter-c-sharp/' from commit '4a3d9677f86aab13b7e721df22e12004416e2539' 2021-09-22 22:12:22 +07:00
Cargo.toml Add 'vendor/tree-sitter-c-sharp/' from commit '4a3d9677f86aab13b7e721df22e12004416e2539' 2021-09-22 22:12:22 +07:00
LICENSE Add 'vendor/tree-sitter-c-sharp/' from commit '4a3d9677f86aab13b7e721df22e12004416e2539' 2021-09-22 22:12:22 +07:00
README.md Add 'vendor/tree-sitter-c-sharp/' from commit '4a3d9677f86aab13b7e721df22e12004416e2539' 2021-09-22 22:12:22 +07:00
binding.gyp Add 'vendor/tree-sitter-c-sharp/' from commit '4a3d9677f86aab13b7e721df22e12004416e2539' 2021-09-22 22:12:22 +07:00
grammar.js Add 'vendor/tree-sitter-c-sharp/' from commit '4a3d9677f86aab13b7e721df22e12004416e2539' 2021-09-22 22:12:22 +07:00
index.js Add 'vendor/tree-sitter-c-sharp/' from commit '4a3d9677f86aab13b7e721df22e12004416e2539' 2021-09-22 22:12:22 +07:00
package.json Add 'vendor/tree-sitter-c-sharp/' from commit '4a3d9677f86aab13b7e721df22e12004416e2539' 2021-09-22 22:12:22 +07:00
test.js Add 'vendor/tree-sitter-c-sharp/' from commit '4a3d9677f86aab13b7e721df22e12004416e2539' 2021-09-22 22:12:22 +07:00

README.md

tree-sitter-c-sharp

Build Status

C# grammar for tree-sitter based on an export of the Roslyn grammar export with various changes in order to:

  • Deal with differences between the parsing technologies
  • Work around some bugs in that grammar
  • Handle #if, #else, #elif, #endif blocks
  • Support syntax highlighting/parsing of fragments
  • Simplify the output tree

Status

Comprehensive support for C# exists with the following exceptions:

  • async, var and await cannot be used as identifiers

C# 7.0 (complete)

  • Tuples
  • Discards
  • Basic pattern matching
  • Recursive pattern matching
  • Ref locals and return
  • Local function statements
  • Expression bodied constructors
  • Expression bodied destructors/finalizers
  • Throw expressions
  • Binary and _ literal support

C# 7.1 (complete)

  • async main method
  • Default literals (as default_expression)
  • Inferred tuple element names
  • Generic type pattern matching

C# 7.2 (complete)

  • in parameter modifiers
  • ref readonly method returns
  • readonly struct
  • ref struct
  • Non-named trailing arguments
  • _ leading binary and hex literals
  • private protected modifier
  • Conditional ref expressions

C# 7.3 (complete)

  • stackalloc array initializers
  • unmanaged generic type parameter constraint
  • Attributes attached to auto property backing fields
  • out support for parameters on initializers, constructors etc.

C# 8.0 (complete)

  • readonly members
  • Default interface methods
  • switch expressions
  • switch property patterns
  • switch tuple patterns
  • static local functions
  • Nullable reference types
  • Null-forgiving operator
  • Null-coalescing assignment

C# 9.0 (complete)

  • Covariant returns
  • Extending partial methods
  • Extension GetEnumerator
  • Function pointers
  • Init properties
  • Lambda discard parameters
  • Local function attributes
  • Module initializers
  • Native integers
  • Patterns
    • Simple type patterns
    • Relational patterns
    • Logical patterns
  • Records
  • Skip Locals Init
  • Static anonymous functions
  • Target-typed conditional expression
  • Target-typed new
  • Top-level statements

C# 10.0

  • global using directives
  • File-scoped namespace declaration
  • Extended property patterns
  • Allow const interpolated strings
  • Record types can seal ToString()
  • Allow both assignment and declaration in the same deconstruction
  • Allow AsyncMethodBuilder attribute on methods
  • Record structs

References