Crate tree_sitter_embedded_template

Source
Expand description

This crate provides EmbeddedTemplate 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:

use tree_sitter::Parser;

let code = r#"
<html>
 <body>
 <% if (true) { %>
 <p>hello</p>
 <% } %>
</body>
</html>
"#;
let mut parser = Parser::new();
let language = tree_sitter_embedded_template::LANGUAGE;
parser
    .set_language(&language.into())
    .expect("Error loading EmbeddedTemplate parser");
let tree = parser.parse(code, None).unwrap();
assert!(!tree.root_node().has_error());

Constantsยง

HIGHLIGHTS_QUERY
The syntax highlighting query for this grammar.
INJECTIONS_EJS_QUERY
The injections query for this grammar to inject HTML/JavaScript.
INJECTIONS_ERB_QUERY
The injections query for this grammar to inject HTML/Ruby.
LANGUAGE
The tree-sitter LanguageFn for this grammar.
NODE_TYPES
The content of the node-types.json file for this grammar.