about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/libexpr/eval.cc1
-rw-r--r--src/libexpr/lexer.l4
2 files changed, 3 insertions, 2 deletions
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc
index e5a108a4385e..b951daacaf0c 100644
--- a/src/libexpr/eval.cc
+++ b/src/libexpr/eval.cc
@@ -130,6 +130,7 @@ static void printValue(std::ostream & str, std::set<const Value *> & active, con
         break;
     case tFloat:
         str << v.fpoint;
+        break;
     default:
         throw Error("invalid value");
     }
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;