Don't CHECK on too large literal.
If a literal is too large to parse, show correct user error.
Test: manual, run_all_host_tests.sh
Change-Id: Ic1b8f0cfcba8754050373e9846e51950ae284a57
Fixes: 64616572
diff --git a/hidl-gen_y.yy b/hidl-gen_y.yy
index e1d472f..b034951 100644
--- a/hidl-gen_y.yy
+++ b/hidl-gen_y.yy
@@ -693,7 +693,15 @@
;
const_expr
- : INTEGER { $$ = new LiteralConstantExpression($1); }
+ : INTEGER {
+ $$ = LiteralConstantExpression::tryParse($1);
+
+ if ($$ == nullptr) {
+ std::cerr << "ERROR: Could not parse literal: "
+ << $1 << " at " << @1 << ".\n";
+ YYERROR;
+ }
+ }
| fqname
{
if(!$1->isValidValueName()) {