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 (0x5742000b), so it loads only with
a willbooster-tree-sitter 15.x runtime; upstream’s tree-sitter runtime and other major versions of the fork reject
it.
Constants§
- LANGUAGE
- The tree-sitter
LanguageFnfor this grammar. - NODE_
TYPES - The content of the
node-types.jsonfile for this grammar.