2 releases

0.0.2 Jan 30, 2025
0.0.1 Mar 11, 2023

#247 in Parser implementations

Download history 1710/week @ 2024-12-28 1096/week @ 2025-01-04 1527/week @ 2025-01-11 1736/week @ 2025-01-18 2041/week @ 2025-01-25 1877/week @ 2025-02-01 2931/week @ 2025-02-08 2534/week @ 2025-02-15 2707/week @ 2025-02-22 2405/week @ 2025-03-01 2213/week @ 2025-03-08 1242/week @ 2025-03-15 728/week @ 2025-03-22 1155/week @ 2025-03-29 832/week @ 2025-04-05 845/week @ 2025-04-12

3,753 downloads per month
Used in 11 crates (8 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