about summary refs log tree commit diff
path: root/src/libexpr/lexer.l
diff options
context:
space:
mode:
authorChristian Theune <ct@flyingcircus.io>2016-01-05T08·46+0100
committerChristian Theune <ct@flyingcircus.io>2016-01-05T08·46+0100
commitf872262e0818ae1000826cfca3ad17619f50b60c (patch)
tree5c2bb0a2d7a29746bf3822b08b8de2e6e2bb1902 /src/libexpr/lexer.l
parent494fc5acbb104371a80ca17bd9f1e35c3859ed27 (diff)
Fix up float parsing.
Diffstat (limited to 'src/libexpr/lexer.l')
-rw-r--r--src/libexpr/lexer.l4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libexpr/lexer.l b/src/libexpr/lexer.l
index 158ca915266f..5fdcb25dd483 100644
--- a/src/libexpr/lexer.l
+++ b/src/libexpr/lexer.l
@@ -85,7 +85,7 @@ static Expr * unescapeStr(SymbolTable & symbols, const char * s)
 
 ID          [a-zA-Z\_][a-zA-Z0-9\_\'\-]*
 INT         [0-9]+
-FLOAT       {INT}\.{INT}
+FLOAT       (([1-9][0-9]*\.?[0-9]*)|(\.[0-9]+))([Ee][+-]?[0-9]+)?
 PATH        [a-zA-Z0-9\.\_\-\+]*(\/[a-zA-Z0-9\.\_\-\+]+)+
 HPATH       \~(\/[a-zA-Z0-9\.\_\-\+]+)+
 SPATH       \<[a-zA-Z0-9\.\_\-\+]+(\/[a-zA-Z0-9\.\_\-\+]+)*\>
@@ -125,7 +125,7 @@ or          { return OR_KW; }
               return INT;
             }
 {FLOAT}     { errno = 0;
-              yylval->n = strtod(yytext, 0);
+              yylval->nf = strtod(yytext, 0);
               if (errno != 0)
                   throw ParseError(format("invalid float ‘%1%’") % yytext);
               return FLOAT;