Strongly-typed AST types for C#, auto-generated from
tree-sitter-c-sharp's node-types.json.
This crate is generated by treesitter-types and is
automatically kept up to date when a new version of the grammar crate is released.
These types have been tested by parsing the .NET Runtime source code.
See the Tree-sitter project for more information about the underlying parser framework.
Example
use *;
// A minimal C# hello-world program (without using directives).
let src = b"\
class Hello {
static void Main() {
System.Console.WriteLine(\"Hello, World!\");
}
}
";
// Parse the source with tree-sitter and convert into typed AST.
let mut parser = new;
parser.set_language.unwrap;
let tree = parser.parse.unwrap;
let cu = from_node.unwrap;
// The compilation unit has one top-level child: the class declaration.
assert_eq!;
let TypeDeclaration = &cu.children else ;
let ClassDeclaration = type_decl.as_ref else ;
assert_eq!;
// The class body contains one method.
assert_eq!;