Expand description
This crate provides Java language support for the tree-sitter parsing library.
The parser carries the ABI number of the WillBooster fork (0x57420007) and is tested with the
willbooster-tree-sitter runtime 10.0.2 (depend on it as
tree-sitter = { package = "willbooster-tree-sitter", version = "10.0.2" }). Runtimes with a different ABI,
including upstream’s tree-sitter crate, reject it with a LanguageError.
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 Main {\n int answer() {\n return 42;\n }\n}\n";
let mut parser = tree_sitter::Parser::new();
let language = tree_sitter_java::LANGUAGE;
parser
.set_language(&language.into())
.expect("Error loading Java parser");
let tree = parser.parse(code, None).unwrap();
assert!(!tree.root_node().has_error());Constants§
- LANGUAGE
- The tree-sitter
LanguageFnfor this grammar. - NODE_
TYPES - The content of the
node-types.jsonfile for this grammar.