Expand description
This crate provides Yarnlock 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 = r#"
package-1@^1.0.0:
version "1.0.3"
resolved "https://registry.npmjs.org/package-1/-/package-1-1.0.3.tgz#a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0"
"#;
let mut parser = tree_sitter::Parser::new();
let language = tree_sitter_yarnlock::LANGUAGE;
parser
.set_language(&language.into())
.expect("Error loading Yarnlock 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.