2 releases

0.0.2 Jan 30, 2025
0.0.1 Mar 11, 2023

#25 in Parser tooling

Download history 345/week @ 2024-10-25 320/week @ 2024-11-01 146/week @ 2024-11-08 413/week @ 2024-11-15 450/week @ 2024-11-22 595/week @ 2024-11-29 329/week @ 2024-12-06 528/week @ 2024-12-13 510/week @ 2024-12-20 1533/week @ 2024-12-27 1231/week @ 2025-01-03 1653/week @ 2025-01-10 1527/week @ 2025-01-17 1829/week @ 2025-01-24 2062/week @ 2025-01-31 2872/week @ 2025-02-07

8,623 downloads per month
Used in 5 crates (3 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–310KB