Use colon syntax for FQNames for enum values.
example: android.hardware.foo@1.0::IFoo.IFooInternal.FooEnum:ENUM_OK
In constant expressions they are emitted as-is, so the emit code won't
compile.
Also split regex rule 4 into two rules in FQName.cpp, to single out
the case for identifiers.
Test: not tested. This CL require child CLs to work.
Bug: 31682916
Change-Id: Ib376dc8c4a27894f7b0eb6d017d9f69242d25b45
diff --git a/hidl-gen_y.yy b/hidl-gen_y.yy
index 65dfaee..ce6a49a 100644
--- a/hidl-gen_y.yy
+++ b/hidl-gen_y.yy
@@ -368,10 +368,13 @@
const_expr
: INTEGER { $$ = new ConstantExpression($1, ConstantExpression::kConstExprLiteral); }
- | IDENTIFIER { $$ = new ConstantExpression($1, ConstantExpression::kConstExprUnknown); }
+ | fqname
+ {
+ $$ = new ConstantExpression($1->string().c_str(), ConstantExpression::kConstExprUnknown);
+ }
| const_expr '?' const_expr ':' const_expr
{
- $$ = new ConstantExpression($1, $3, $5);
+ $$ = new ConstantExpression($1, $3, $5);
}
| const_expr LOGICAL_OR const_expr { $$ = new ConstantExpression($1, "||", $3); }
| const_expr LOGICAL_AND const_expr { $$ = new ConstantExpression($1, "&&", $3); }