THRIFT-3477 Parser fails on enum item that starts with 'E' letter and continues with number
Client: Compiler (general)
Patch: Jens Geyer
diff --git a/compiler/cpp/src/thriftl.ll b/compiler/cpp/src/thriftl.ll
index 76acda1..7e68dbc 100644
--- a/compiler/cpp/src/thriftl.ll
+++ b/compiler/cpp/src/thriftl.ll
@@ -325,11 +325,6 @@
return tok_int_constant;
}
-{dubconstant} {
- yylval.dconst = atof(yytext);
- return tok_dub_constant;
-}
-
{identifier} {
yylval.id = strdup(yytext);
return tok_identifier;
@@ -340,6 +335,12 @@
return tok_st_identifier;
}
+{dubconstant} {
+ /* Deliberately placed after identifier, since "e10" is NOT a double literal (THRIFT-3477) */
+ yylval.dconst = atof(yytext);
+ return tok_dub_constant;
+}
+
{literal_begin} {
char mark = yytext[0];
std::string result;