diff --git a/src/lex.c b/src/lex.c index e6dcfed7987511ac9f7f28bf4561e5e4ec7dac63..1e60f725390027173191398de1142814db7839fd 100644 --- a/src/lex.c +++ b/src/lex.c @@ -4,7 +4,7 @@ ||| See the files COPYING and DISCLAIMER for more information. \*/ #include "global.h" -RCSID("$Id: lex.c,v 1.21 1997/04/16 03:09:12 hubbe Exp $"); +RCSID("$Id: lex.c,v 1.22 1997/05/13 15:49:54 grubba Exp $"); #include "language.h" #include "array.h" #include "lex.h" @@ -1477,9 +1477,9 @@ static int do_lex2(int literal, YYSTYPE *yylval) case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { - char *p; + char *p, *p2; UNGETC(c); - READBUF(isdigit(C) || C=='.'); + READBUF(isdigit(C) || C=='.' || C=='e' || C=='E'); p=STRCHR(buf,'.'); @@ -1501,6 +1501,19 @@ static int do_lex2(int literal, YYSTYPE *yylval) return F_FLOAT; } } + p = STRCHR(buf, 'e'); + p2 = STRCHR(buf, 'E'); + if (p || p2) { + if (p) { + if (p2 && (p > p2)) { + p = p2; + } + } else { + p = p2; + } + UNGETSTR(p, strlen(p)); + *p = 0; + } if(buf[0]=='0') yylval->number=STRTOL(buf,NULL,8); else