From: Neil Roberts Date: Wed, 26 Nov 2014 17:57:42 +0000 (+0000) Subject: glsl: Use | action in the lexer source to avoid duplicating the float action X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c97cbd7e3d9faae1185a740d2a94c48e9a75d8b9;p=mesa.git glsl: Use | action in the lexer source to avoid duplicating the float action Flex and lex have a special action ‘|’ which means to use the same action as the next rule. We can use this to reduce a bit of code duplication in the rules for the various float literal formats. Reviewed-by: Matt Turner --- diff --git a/src/glsl/glsl_lexer.ll b/src/glsl/glsl_lexer.ll index 419a07b1daf..57c46be84ca 100644 --- a/src/glsl/glsl_lexer.ll +++ b/src/glsl/glsl_lexer.ll @@ -450,18 +450,9 @@ layout { return LITERAL_INTEGER(8); } -[0-9]+\.[0-9]+([eE][+-]?[0-9]+)?[fF]? { - yylval->real = _mesa_strtof(yytext, NULL); - return FLOATCONSTANT; - } -\.[0-9]+([eE][+-]?[0-9]+)?[fF]? { - yylval->real = _mesa_strtof(yytext, NULL); - return FLOATCONSTANT; - } -[0-9]+\.([eE][+-]?[0-9]+)?[fF]? { - yylval->real = _mesa_strtof(yytext, NULL); - return FLOATCONSTANT; - } +[0-9]+\.[0-9]+([eE][+-]?[0-9]+)?[fF]? | +\.[0-9]+([eE][+-]?[0-9]+)?[fF]? | +[0-9]+\.([eE][+-]?[0-9]+)?[fF]? | [0-9]+[eE][+-]?[0-9]+[fF]? { yylval->real = _mesa_strtof(yytext, NULL); return FLOATCONSTANT;