zephyr/scripts/dts/python-devicetree
Martí Bolívar ffa1515978 dtlib: fix issue which allowed invalid node names
Node names are subject to the rules in table 2.1 of the devicetree
specification v0.3, while properties are subject to rules in table
2.2. These rules mean that some property names are invalid node names.

However, the same regular expression is being used to validate the
names of nodes and properties in dtlib. This leads to invalid node
names being allowed to pass. Fix this issue by moving the node name
handling code to the Node constructor and checking against the
characters in table 2.1.

The test cases claim that the existing behavior matches dtc. I can't
reproduce that. I get errors when I use invalid characters (like "?")
in a node name. For example:

foo.dts:3.8-11: ERROR (node_name_chars): /node?: Bad character '?' in
node name

Try to make the dtlib error message reminiscent of that.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-08-31 19:36:31 -04:00
..
src/devicetree dtlib: fix issue which allowed invalid node names 2021-08-31 19:36:31 -04:00
tests dtlib: fix issue which allowed invalid node names 2021-08-31 19:36:31 -04:00
.gitignore
requirements.txt
setup.py
tox.ini python-devicetree: tox: fix mypy 2021-06-09 21:01:55 -04:00