#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

#164 in Text editors

Download history 31/week @ 2024-02-26 7/week @ 2024-03-04 26/week @ 2024-03-11 99/week @ 2024-03-18 215/week @ 2024-03-25 241/week @ 2024-04-01 145/week @ 2024-04-08 151/week @ 2024-04-15 124/week @ 2024-04-22 131/week @ 2024-04-29 126/week @ 2024-05-06

545 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