mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-08-20 08:55:06 +00:00
Add support for phandle arrays in DevicetreeCompiler
This commit is contained in:
parent
f93c04e016
commit
019a8ee026
@ -88,6 +88,7 @@ def property_to_string(property: DeviceProperty, devices: list[Device]) -> str:
|
|||||||
value_list.append(property_to_string(DeviceProperty(name="", type=item.type, value=item.value), devices))
|
value_list.append(property_to_string(DeviceProperty(name="", type=item.type, value=item.value), devices))
|
||||||
else:
|
else:
|
||||||
value_list.append(str(item))
|
value_list.append(str(item))
|
||||||
|
value_list.append("{ 0 }")
|
||||||
return "{ " + ",".join(value_list) + " }"
|
return "{ " + ",".join(value_list) + " }"
|
||||||
elif isinstance(property.value, str):
|
elif isinstance(property.value, str):
|
||||||
# If it's a string, assume it's a #define and show it as-is
|
# If it's a string, assume it's a #define and show it as-is
|
||||||
|
|||||||
@ -37,7 +37,10 @@ value: VALUE
|
|||||||
values: VALUE+
|
values: VALUE+
|
||||||
array: NUMBER+
|
array: NUMBER+
|
||||||
|
|
||||||
property_value: quoted_text_array | QUOTED_TEXT | "<" value ">" | "<" values ">" | "[" array "]" | PHANDLE
|
phandle_array_entry: "<" values ">"
|
||||||
|
phandle_array: phandle_array_entry ("," phandle_array_entry)+
|
||||||
|
|
||||||
|
property_value: quoted_text_array | QUOTED_TEXT | phandle_array | "<" value ">" | "<" values ">" | "[" array "]" | PHANDLE
|
||||||
device_property: PROPERTY_NAME ["=" property_value] ";"
|
device_property: PROPERTY_NAME ["=" property_value] ";"
|
||||||
|
|
||||||
NODE_ALIAS: /[a-zA-Z0-9_\-\/]+/
|
NODE_ALIAS: /[a-zA-Z0-9_\-\/]+/
|
||||||
|
|||||||
@ -70,6 +70,10 @@ class DtsTransformer(Transformer):
|
|||||||
if isinstance(object[0], PropertyValue):
|
if isinstance(object[0], PropertyValue):
|
||||||
return object[0]
|
return object[0]
|
||||||
return PropertyValue(type="value", value=object[0])
|
return PropertyValue(type="value", value=object[0])
|
||||||
|
def phandle_array_entry(self, tokens: list):
|
||||||
|
return tokens[0]
|
||||||
|
def phandle_array(self, tokens: list):
|
||||||
|
return PropertyValue(type="phandle-array", value=tokens)
|
||||||
def array(self, object):
|
def array(self, object):
|
||||||
return PropertyValue(type="array", value=object)
|
return PropertyValue(type="array", value=object)
|
||||||
def VALUE(self, token: Token):
|
def VALUE(self, token: Token):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user