mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-22 22:10:10 +01:00
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
1 changed files with 3 additions and 12 deletions
|
|
@ -450,18 +450,9 @@ layout {
|
||||||
return LITERAL_INTEGER(8);
|
return LITERAL_INTEGER(8);
|
||||||
}
|
}
|
||||||
|
|
||||||
[0-9]+\.[0-9]+([eE][+-]?[0-9]+)?[fF]? {
|
[0-9]+\.[0-9]+([eE][+-]?[0-9]+)?[fF]? |
|
||||||
yylval->real = _mesa_strtof(yytext, NULL);
|
\.[0-9]+([eE][+-]?[0-9]+)?[fF]? |
|
||||||
return FLOATCONSTANT;
|
[0-9]+\.([eE][+-]?[0-9]+)?[fF]? |
|
||||||
}
|
|
||||||
\.[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]? {
|
[0-9]+[eE][+-]?[0-9]+[fF]? {
|
||||||
yylval->real = _mesa_strtof(yytext, NULL);
|
yylval->real = _mesa_strtof(yytext, NULL);
|
||||||
return FLOATCONSTANT;
|
return FLOATCONSTANT;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue