forked from lix-project/lix
Fix up float parsing.
This commit is contained in:
parent
494fc5acbb
commit
f872262e08
|
@ -130,6 +130,7 @@ static void printValue(std::ostream & str, std::set<const Value *> & active, con
|
||||||
break;
|
break;
|
||||||
case tFloat:
|
case tFloat:
|
||||||
str << v.fpoint;
|
str << v.fpoint;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
throw Error("invalid value");
|
throw Error("invalid value");
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,7 +85,7 @@ static Expr * unescapeStr(SymbolTable & symbols, const char * s)
|
||||||
|
|
||||||
ID [a-zA-Z\_][a-zA-Z0-9\_\'\-]*
|
ID [a-zA-Z\_][a-zA-Z0-9\_\'\-]*
|
||||||
INT [0-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\.\_\-\+]+)+
|
PATH [a-zA-Z0-9\.\_\-\+]*(\/[a-zA-Z0-9\.\_\-\+]+)+
|
||||||
HPATH \~(\/[a-zA-Z0-9\.\_\-\+]+)+
|
HPATH \~(\/[a-zA-Z0-9\.\_\-\+]+)+
|
||||||
SPATH \<[a-zA-Z0-9\.\_\-\+]+(\/[a-zA-Z0-9\.\_\-\+]+)*\>
|
SPATH \<[a-zA-Z0-9\.\_\-\+]+(\/[a-zA-Z0-9\.\_\-\+]+)*\>
|
||||||
|
@ -125,7 +125,7 @@ or { return OR_KW; }
|
||||||
return INT;
|
return INT;
|
||||||
}
|
}
|
||||||
{FLOAT} { errno = 0;
|
{FLOAT} { errno = 0;
|
||||||
yylval->n = strtod(yytext, 0);
|
yylval->nf = strtod(yytext, 0);
|
||||||
if (errno != 0)
|
if (errno != 0)
|
||||||
throw ParseError(format("invalid float ‘%1%’") % yytext);
|
throw ParseError(format("invalid float ‘%1%’") % yytext);
|
||||||
return FLOAT;
|
return FLOAT;
|
||||||
|
|
Loading…
Reference in a new issue