Update vhal_const_generate to emit all known values
Instead of hard coding the enum collections of interest, the generator
now iterates over all known enums in the VHAL API and emits python
symbols for all of them.
This change also includes updates to the symbol names to standardize
them to facilitate machine generation.
Test: Run vhal_emulator_test.py (fails on one value, it does that
before my change)
Change-Id: Iaa6bc492159180cc5ad597ec5cc666fdb25b290e
diff --git a/tools/hidl_parser/parser.py b/tools/hidl_parser/parser.py
index 3096804..8618a4c 100644
--- a/tools/hidl_parser/parser.py
+++ b/tools/hidl_parser/parser.py
@@ -246,7 +246,7 @@
for case in enum.cases:
if case.name == self.ref: return case.value.resolve(enum, document)
-class EnumValueRShift(EnumValue):
+class EnumValueLShift(EnumValue):
def __init__(self, base, offset):
self.base = base
self.offset = offset
@@ -368,7 +368,7 @@
t[0] = EnumValueConstant(t[1])
def p_enum_value_2(t):
'enum_value : enum_value SHIFT NUMBER'
- t[0] = EnumValueRShift(t[1], t[3])
+ t[0] = EnumValueLShift(t[1], EnumValueConstant(t[3]))
def p_enum_value_3(t):
'enum_value : enum_value OR enum_value'
t[0] = EnumValueOr(t[1], t[3])