Skip to main content

Crate tree_sitter_c_sharp

Crate tree_sitter_c_sharp 

Source
Expand description

This crate provides C# language support for the tree-sitter parsing library.

Typically, you will use the LANGUAGE constant to add this language to a tree-sitter Parser, and then use the parser to parse some code:

let code = "class Program {\n    static void Main() => System.Console.WriteLine(\"Hello\");\n}\n";
let mut parser = tree_sitter::Parser::new();
let language = tree_sitter_c_sharp::LANGUAGE;
parser
    .set_language(&language.into())
    .expect("Error loading C# parser");
let tree = parser.parse(code).unwrap();
assert!(!tree.root_node().has_error());

The parser uses WillBooster ABI 0x5742000e, which upstream’s tree-sitter crate and pre-23.1.0 WillBooster runtimes reject. Require willbooster-tree-sitter 26.3.0 through 28.x. Tests and fuzzing use 28.0.0.

Constants§

LANGUAGE
The tree-sitter LanguageFn for this grammar.
NODE_TYPES
The content of the node-types.json file for this grammar.