Expand description
This crate provides Ruby 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 = "def hello(name)\n puts \"Hello, #{name}!\"\nend\n";
let mut parser = tree_sitter::Parser::new();
let language = tree_sitter_ruby::LANGUAGE;
parser
.set_language(&language.into())
.expect("Error loading Ruby parser");
let tree = parser.parse(code, None).unwrap();
assert!(!tree.root_node().has_error());The parser carries the ABI number of the WillBooster fork of tree-sitter (0x57420001), so it loads only with
the willbooster-tree-sitter runtime, version 2.0.0 or later; upstream’s tree-sitter runtime rejects it.
Constants§
- LANGUAGE
- The tree-sitter
LanguageFnfor this grammar. - NODE_
TYPES - The content of the
node-types.jsonfile for this grammar.