Devicetree DTS alias support (#483)

* **New Features**
  * Phandle support for device-to-device property references.
  * Recognition of #define-style declarations in device trees.
  * Device nodes may include optional aliases alongside node names.

* **Improvements**
  * Flatter, consistent device hierarchy processing for generation.
  * Error and log messages now reference node names for clearer diagnostics.

* **Other**
  * Added a static ESP32-based device tree and minor DTS comment updates.
This commit is contained in:
Ken Van Hoeylandt
2026-02-05 23:10:11 +01:00
committed by GitHub
parent ecc0a9c076
commit 626d0d9776
7 changed files with 172 additions and 52 deletions
@@ -21,6 +21,7 @@ BOOLEAN: "true" | "false"
// Main
INCLUDE_C: /#include <[\w\/.\-]+>/
DEFINE_C: /#define[^\n]+/
PROPERTY_NAME: /#?[a-zA-Z0-9_\-,]+/
@@ -29,20 +30,21 @@ QUOTED_TEXT: QUOTE /[^"]+/ QUOTE
quoted_text_array: QUOTED_TEXT ("," " "* QUOTED_TEXT)+
HEX_NUMBER: "0x" HEXDIGIT+
NUMBER: SIGNED_NUMBER | HEX_NUMBER
PHANDLE: /&[0-9a-zA-Z\-]+/
PHANDLE: /&[0-9a-zA-Z_\-]+/
C_VARIABLE: /[0-9a-zA-Z_]+/
VALUE: NUMBER | PHANDLE | C_VARIABLE
value: VALUE
values: VALUE+
array: NUMBER+
property_value: quoted_text_array | QUOTED_TEXT | "<" value ">" | "<" values ">" | "[" array "]"
property_value: quoted_text_array | QUOTED_TEXT | "<" value ">" | "<" values ">" | "[" array "]" | PHANDLE
device_property: PROPERTY_NAME ["=" property_value] ";"
DEVICE_IDENTIFIER: /[a-zA-Z0-9_\-\/@]+/
NODE_ALIAS: /[a-zA-Z0-9_\-\/@]+/
NODE_NAME: /[a-zA-Z0-9_\-\/@]+/
device: DEVICE_IDENTIFIER "{" (device | device_property)* "};"
device: (NODE_ALIAS ":")? NODE_NAME "{" (device | device_property)* "};"
dts_version: /[0-9a-zA-Z\-]+/
start: "/" dts_version "/;" INCLUDE_C* device+
start: "/" dts_version "/;" (INCLUDE_C | DEFINE_C)* device+