#tree-sitter #device-tree #incremental-parser #parser #tree-sitter-devicetree

tree-sitter-devicetree

Tree-sitter parser for Devicetree files, with support for Zephyr's superset of Devicetree syntax

8 releases (4 breaking)

0.14.1 Feb 25, 2025
0.14.0 Feb 25, 2025
0.13.0 Feb 23, 2025
0.12.1 Oct 19, 2024
0.10.0 Mar 16, 2024

#146 in Text editors

Download history 1/week @ 2025-01-22 7/week @ 2025-01-29 191/week @ 2025-02-05 52/week @ 2025-02-12 326/week @ 2025-02-19 241/week @ 2025-02-26 79/week @ 2025-03-05 45/week @ 2025-03-12 35/week @ 2025-03-19 27/week @ 2025-03-26 11/week @ 2025-04-02 22/week @ 2025-04-09

104 downloads per month
Used in 2 crates

MIT license

1MB
36K SLoC

C 35K SLoC JavaScript 552 SLoC // 0.0% comments Scheme 66 SLoC Rust 27 SLoC // 0.3% comments

This crate provides Devicetree language support for the tree-sitter parsing library.

Typically, you will use the [LANGUAGE][] constant to add this language to a tree-sitter Parser, and then use the parser to parse some code:

let code = r#"
"#;
let mut parser = tree_sitter::Parser::new();
let language = tree_sitter_devicetree::LANGUAGE;
parser
    .set_language(&language.into())
    .expect("Error loading Devicetree parser");
let tree = parser.parse(code, None).unwrap();
assert!(!tree.root_node().has_error());

tree-sitter-devicetree

A tree-sitter grammar for Devicetree with support for Zephyr's superset of Devicetree syntax.

Some parts of the grammar are adapted from tree-sitter-c.

Dependencies

~4–280KB