Skip to content
 
 

Repository files navigation

Brokk's C# Grammar for Tree-sitter

CI crates docs.rs

This is the Brokk-owned and independently maintained fork of tree-sitter/tree-sitter-c-sharp, a C# grammar for Tree-sitter. Brokk maintains this fork for use in its code-intelligence tooling and publishes the Rust package as brokk-tree-sitter-c-sharp. It may intentionally diverge from upstream to support correctness and language coverage required by Brokk.

Installation

Add the Brokk-maintained Rust crate to your project:

cargo add brokk-tree-sitter-c-sharp@=0.23.6

Or add it directly to Cargo.toml:

[dependencies]
brokk-tree-sitter-c-sharp = "=0.23.6"

The grammar is based upon the Roslyn grammar with 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
  • Reduce parser state count and complexity
  • Be in-line with tree-sitter's convention where applicable

Status

Comprehensively supports C# 1 through 14.0 with the following exceptions:

  • var and await cannot be used as identifiers everywhere they are valid
  • File-based apps preprocessor directives (#:property, #:package, #:sdk, #:project) are not yet recognized

References

About

Brokk-owned and independently maintained C# grammar for Tree-sitter

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages