Add devicetree parser with queries

This commit is contained in:
Jędrzej Boczar 2021-01-31 22:38:51 +01:00
parent a077f61b67
commit 2d72fc34d9
5 changed files with 68 additions and 0 deletions

View file

@ -416,6 +416,15 @@ list.turtle = {
maintainers = { "@bonabeavis" },
}
list.devicetree = {
install_info = {
url = "https://github.com/joelspadin/tree-sitter-devicetree",
files = { "src/parser.c" },
branch = "main",
},
filetype = 'dts',
}
local M = {
list = list
}

View file

@ -0,0 +1 @@
(node) @fold

View file

@ -0,0 +1,40 @@
(comment) @comment
[
(preproc_include)
(dtsi_include)
] @include
[
(preproc_def)
] @constant.macro
[
(preproc_function_def)
] @function.macro
[
(memory_reservation)
(file_version)
] @annotation
[
(string_literal)
(byte_string_literal)
(system_lib_string)
] @string
(integer_literal) @number
(identifier) @variable
(node (identifier) @attribute)
(property (identifier) @property)
(labeled_item (identifier) @label)
(call_expression (identifier) @function.macro)
(reference) @attribute
(unit_address) @constant
[ "=" ] @operator
[ "(" ")" "[" "]" "{" "}" "<" ">" ] @punctuation.bracket
[ ";" ":" "," "@" ] @punctuation.delimiter

View file

@ -0,0 +1,14 @@
[
(node)
(property)
(integer_cells)
] @indent
[
"}"
">"
] @branch
[
(comment)
] @ignore

View file

@ -0,0 +1,4 @@
[
(node)
(integer_cells)
]@scope