diff --git a/src/obj.cpp b/src/obj.cpp index d7b7985d..92e5abf9 100644 --- a/src/obj.cpp +++ b/src/obj.cpp @@ -94,9 +94,9 @@ static uint64_t readParenExpression(const string &s, const map &d, exit(1); } -int lexerBytes; +int lexerFloatBytes; Obj *AsmReader::read(std::istream &input) { - lexerBytes = wordSize; + lexerFloatBytes = wordSize; FlexLexer *f = new yyFlexLexer(&input); Obj *o = new Obj(); std::vector::reverse_iterator cur; diff --git a/src/scanner.lex b/src/scanner.lex index 15c52305..0b935d97 100644 --- a/src/scanner.lex +++ b/src/scanner.lex @@ -16,14 +16,14 @@ #include "include/asm-tokens.h" #include "include/harpfloat.h" -extern int lexerBytes; +extern int lexerFloatBytes; static int64_t read_number(const char *s) { while (!isdigit(*s) && *s != '-' && *s != '+') s++; - if (strchr(s, 'f') || strchr(s, '.')) { + if (strchr(s, 'f') && !strchr(s, 'x') || strchr(s, '.')) { double d; - sscanf(s, "%f", &d); - return Harp::Word_u(Harp::Float(d, lexerBytes)); + sscanf(s, "%lf", &d); + return Harp::Word_u(Harp::Float(d, lexerFloatBytes)); } else { long long u; sscanf(s, "%lli", &u);