tree-sitter-devicetree
tree-sitter-devicetree copied to clipboard
`/delete-node/` reported as error
syntax description rejects a lot of /delete-node/ + /delete-property/ case. E.g. in
/ {
/delete-node/ foo;
/delete-property/ bar;
};
/ {
/delete-node/ foo@0;
};
/ {
/delete-node/foo;
};
/ {
/delete-property/bar;
};
/delete-node/ &bar;
only the first block works. Rest is reported as
(document
(node name: (identifier) {
(delete_node /delete-node/ name: (identifier) ;)
(delete_property /delete-property/ name: (identifier) ;)
} ;)
(node name: (identifier) {
(delete_node /delete-node/ name: (identifier)
name: (ERROR @ (identifier))
;)
} ;)
(node name: (identifier) {
(ERROR (identifier) ;)
} ;)
(node name: (identifier) {
(ERROR (identifier) ;)
} ;)
(ERROR (identifier)
(reference & label: (identifier))
;))
The 3rd & 4th blocks are invalid. AFAIK, directives with arguments are supposed to have whitespace.
The spec is not specific, but reading dtc's source code or the elinux.org wiki can help
Oh and to the following TODO, yes they are. https://github.com/joelspadin/tree-sitter-devicetree/blob/2087a5b965db2a9efabab958a27fd8ddf43038a2/grammar.js#L180
https://elinux.org/Device_Tree_Mysteries#Signed_Property_Values Apparently dtc allows negative integers?
The 3rd & 4th blocks are invalid. AFAIK, directives with arguments are supposed to have whitespace.
They are accepted by dtc and I am using them for years...
Whitespaces are simply ignored; e.g.
a = <23>;
b=<42>;
c = <666>;
is completely valid. Why should they matter for /delete-.../?
They are accepted by dtc and I am using them for years...
Thanks for telling me! I looked at the parser spec but I don't have enough knowledge of tree-sitter to fix it. No idea how it requires whitespace in seq.