#tree-sitter #jinja2 #incremental #parser

tree-sitter-jinja2

jinja2 grammar for the tree-sitter parsing library

9 releases

0.0.10 Aug 29, 2024
0.0.9 Aug 27, 2024
0.0.8 Jun 26, 2024
0.0.7 May 30, 2024
0.0.5 Dec 28, 2023

#162 in Text editors

Download history 245/week @ 2024-09-19 267/week @ 2024-09-26 210/week @ 2024-10-03 177/week @ 2024-10-10 188/week @ 2024-10-17 184/week @ 2024-10-24 144/week @ 2024-10-31 178/week @ 2024-11-07 181/week @ 2024-11-14 207/week @ 2024-11-21 142/week @ 2024-11-28 185/week @ 2024-12-05 178/week @ 2024-12-12 129/week @ 2024-12-19 86/week @ 2024-12-26 140/week @ 2025-01-02

563 downloads per month
Used in 2 crates

MIT license

78KB
2.5K SLoC

C 2.5K SLoC Rust 31 SLoC // 0.5% comments JavaScript 28 SLoC // 0.3% comments Scheme 7 SLoC

tree-sitter-jinja2

Really basic parser for really basic highlighting.

npm install
tree-sitter generate && tree-sitter parse example-file.jinja2

lib.rs:

This crate provides Jinja2 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();
let language = tree_sitter_jinja2::LANGUAGE;
parser
    .set_language(&language.into())
    .expect("Error loading Jinja2 parser");
let tree = parser.parse(code, None).unwrap();
assert!(!tree.root_node().has_error());

Dependencies

~4–305KB