summaryrefslogtreecommitdiffstats
path: root/src/glsl/glsl_lexer.ll
diff options
context:
space:
mode:
authorNeil Roberts <neil@linux.intel.com>2014-11-26 17:57:42 +0000
committerNeil Roberts <neil@linux.intel.com>2014-11-27 11:43:59 +0000
commitc97cbd7e3d9faae1185a740d2a94c48e9a75d8b9 (patch)
tree13447098989c9d417727d039c49e8d54678b7aee /src/glsl/glsl_lexer.ll
parent9d8aa886938c7476a911f8cf8051d87d76755394 (diff)
downloadexternal_mesa3d-c97cbd7e3d9faae1185a740d2a94c48e9a75d8b9.zip
external_mesa3d-c97cbd7e3d9faae1185a740d2a94c48e9a75d8b9.tar.gz
external_mesa3d-c97cbd7e3d9faae1185a740d2a94c48e9a75d8b9.tar.bz2
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>
Diffstat (limited to 'src/glsl/glsl_lexer.ll')
-rw-r--r--src/glsl/glsl_lexer.ll15
1 files changed, 3 insertions, 12 deletions
diff --git a/src/glsl/glsl_lexer.ll b/src/glsl/glsl_lexer.ll
index 419a07b..57c46be 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;