#parser #tree-sitter #jinja #incremental

tree-sitter-jinja

Jinja grammar for tree-sitter

1 unstable release

0.0.1 Aug 21, 2024

#25 in #jinja

Apache-2.0

550KB
24K SLoC

C 24K SLoC Scheme 148 SLoC JavaScript 60 SLoC Rust 29 SLoC // 0.3% comments

tree-sitter-jinja2

Jinja2 grammar for tree-sitter.

inline statement starts with # .


lib.rs:

This crate provides Jinja language support for the tree-sitter parsing library.

Typically, you will use the language function to add this language to a tree-sitter Parser, and then use the parser to parse some code:

let code = r#"
"#;
let mut parser = tree_sitter::Parser::new();
parser.set_language(&tree_sitter_jinja::language()).expect("Error loading Jinja grammar");
let tree = parser.parse(code, None).unwrap();
assert!(!tree.root_node().has_error());

Dependencies

~3–4MB
~80K SLoC