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 (0x57420006), so it loads only with
the willbooster-tree-sitter runtime; upstream’s tree-sitter runtime rejects it. Use version 7.0.5 or later.
Constants§
- LANGUAGE
- The tree-sitter
LanguageFnfor this grammar. - NODE_
TYPES - The content of the
node-types.jsonfile for this grammar.