2 releases

0.0.2 Jan 30, 2025
0.0.1 Mar 11, 2023

#22 in Parser tooling

Download history 461/week @ 2024-12-04 419/week @ 2024-12-11 506/week @ 2024-12-18 1252/week @ 2024-12-25 1397/week @ 2025-01-01 1361/week @ 2025-01-08 1420/week @ 2025-01-15 2209/week @ 2025-01-22 1648/week @ 2025-01-29 2841/week @ 2025-02-05 2353/week @ 2025-02-12 3170/week @ 2025-02-19 2141/week @ 2025-02-26 2978/week @ 2025-03-05 876/week @ 2025-03-12 1260/week @ 2025-03-19

7,688 downloads per month
Used in 13 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