2 releases

0.0.2 Jan 30, 2025
0.0.1 Mar 11, 2023

#243 in Parser implementations

Download history 1033/week @ 2024-12-24 1574/week @ 2024-12-31 1274/week @ 2025-01-07 1240/week @ 2025-01-14 2045/week @ 2025-01-21 1997/week @ 2025-01-28 2344/week @ 2025-02-04 2878/week @ 2025-02-11 2949/week @ 2025-02-18 2191/week @ 2025-02-25 3187/week @ 2025-03-04 827/week @ 2025-03-11 1247/week @ 2025-03-18 745/week @ 2025-03-25 1378/week @ 2025-04-01 655/week @ 2025-04-08

4,183 downloads per month
Used in 10 crates (7 directly)

MIT license

620KB
23K SLoC

C 22K SLoC // 0.0% comments JavaScript 368 SLoC // 0.0% comments Scheme 111 SLoC // 0.2% comments Rust 33 SLoC // 0.4% comments

tree-sitter-nix

Build Status

Nix grammar for tree-sitter.


lib.rs:

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

use tree_sitter::Parser;

let code = r#"
let
  b = a + 1;
  a = 1;
in
a + b
"#;
let mut parser = Parser::new();
let language = tree_sitter_nix::LANGUAGE;
parser
    .set_language(&language.into())
    .expect("Error loading nix parser");
let tree = parser.parse(code, None).unwrap();
assert!(!tree.root_node().has_error());

Dependencies

~4–280KB