freedreno/afuc: Make 0 a valid number
authorConnor Abbott <cwabbott0@gmail.com>
Tue, 18 Aug 2020 12:36:37 +0000 (14:36 +0200)
committerMarge Bot <eric+marge@anholt.net>
Tue, 18 Aug 2020 16:17:31 +0000 (16:17 +0000)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6368>

src/freedreno/afuc/lexer.l

index 8c3113d1c16f6f4e569f5b55ba89c98c734faaac..830ba83db706b15ce408b44809bd58579340e23e 100644 (file)
@@ -40,7 +40,7 @@ extern YYSTYPE yylval;
 "\n"                              yylineno++;
 [ \t]                             ; /* ignore whitespace */
 ";"[^\n]*"\n"                     yylineno++; /* ignore comments */
 "\n"                              yylineno++;
 [ \t]                             ; /* ignore whitespace */
 ";"[^\n]*"\n"                     yylineno++; /* ignore comments */
-[1-9][0-9]*                       yylval.num = strtoul(yytext, NULL, 0);    return T_INT;
+0|[1-9][0-9]*                     yylval.num = strtoul(yytext, NULL, 0);    return T_INT;
 "0x"[0-9a-fA-F]*                  yylval.num = strtoul(yytext, NULL, 0);    return T_HEX;
 
 "$"[0-9a-fA-F][0-9a-fA-F]         yylval.num = parse_reg(yytext); return T_REGISTER;
 "0x"[0-9a-fA-F]*                  yylval.num = strtoul(yytext, NULL, 0);    return T_HEX;
 
 "$"[0-9a-fA-F][0-9a-fA-F]         yylval.num = parse_reg(yytext); return T_REGISTER;