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 <mattst88@gmail.com>
This commit is contained in:
parent
9d8aa88693
commit
c97cbd7e3d
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue