#jinja2 #parser #incremental

tree-sitter-jinja2

jinja2 grammar for the tree-sitter parsing library

5 releases

0.0.6 Mar 27, 2024
0.0.5 Dec 28, 2023

#163 in Text editors

Download history 31/week @ 2024-02-25 6/week @ 2024-03-03 25/week @ 2024-03-10 92/week @ 2024-03-17 195/week @ 2024-03-24 250/week @ 2024-03-31 152/week @ 2024-04-07 147/week @ 2024-04-14 119/week @ 2024-04-21

685 downloads per month
Used in 2 crates

MIT license

69KB
2K SLoC

C 2K SLoC Rust 31 SLoC // 0.5% comments JavaScript 25 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 = "";
let mut parser = tree_sitter::Parser::new();
parser.set_language(tree_sitter_javascript::language()).expect("Error loading jinja2 grammar");
let tree = parser.parse(code, None).unwrap();

Dependencies

~2.7–4MB
~71K SLoC