Closed nickcoutsos closed 1 year ago
My understanding of devicetree syntax is that parenthesis are required for integer cells, because spaces are used as the item delimiter. Is it valid to leave out the parenthesis for a field that takes a single integer and not integer cells? If so, then changing the definition of _integer_cell_items would not be the correct place to add that.
Ok, so I guess the difference here would be <FOO | BAR>
being an integer whereas <FOO | BAR BAZ>
would be integer-cells?
Yeah. And I am not sure about whether the DT language allows the former, but the latter would need to be <(FOO | BAR) BAZ>
to be valid.
I'm looking at the source for the devicetree spec and I'm thinking that maybe the parentheses ought to be mandatory after all:
https://github.com/devicetree-org/devicetree-specification/blob/639f3e9a97040b6a60ee8716748b558bf883aae1/source/chapter6-source-language.rst#node-and-property-definitions (hard to link to the exact line with GitHub rendering RST files)
values may be represented as arithmetic, bitwise, or logical expressions within parenthesis.
I'll bring it up in the ZMK discord server but I feel like, correct or not, people are accepting <FOO | BAR>
and I might need to be add my own special handling of that specific property value.
Ok, apparently the other syntax actually doesn't compile so this was all moot. Sorry to take up your time!
I'm looking into handling ZMK
mods
, noticing that in some places the documentation uses both<MOD_LSFT | MOD_LALT>
and<(MOD_LSFT | MOD_LALT)>
, though only the latter parses correctly with the current grammar.It appears to result in a
binary_expression
but looking at_integer_cell_items
:it seems like it's matching
$.parenthesized_expression
specifically. If I try adding$.binary_expression
to that list it results in a conflictWould using
$._expression
in place of most of the choices be appropriate? It seems that once the choices are pared down to:the build succeeds, but I don't know what other consequences this may have.