pike.git/
src/
lex.c
Branch:
Tag:
Non-build tags
All tags
No tags
1997-05-19
1997-05-19 09:32:40 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>
04364869e2726ad3a9cddb0f5ee26ad93eda622a (
49
lines) (+
33
/-
16
)
[
Show
|
Annotate
]
Branch:
7.9
1e-1 now works
Rev: src/lex.c:1.23
Rev: src/testsuite.in:1.41
4:
||| See the files COPYING and DISCLAIMER for more information. \*/ #include "global.h"
-
RCSID("$Id: lex.c,v 1.
22
1997/05/
13
15
:
49
:
54
grubba
Exp $");
+
RCSID("$Id: lex.c,v 1.
23
1997/05/
19
09
:
32
:
39
hubbe
Exp $");
#include "language.h" #include "array.h" #include "lex.h"
1478:
case '5': case '6': case '7': case '8': case '9': { char *p, *p2;
+
int isfloat=0;
+
double d;
+
UNGETC(c);
-
READBUF(isdigit(C) || C=='.'
|| C=='e' || C=='E'
);
+
READBUF(isdigit(C) || C=='.');
p=STRCHR(buf,'.');
1495:
UNGETSTR(p,strlen(p)); *p=0; }
+
if((p=STRCHR(buf,'.'))) {
-
yylval->fnum
=
STRTOD(buf,NULL)
;
-
return F_FLOAT;
+
isfloat
=
1
;
} }
-
p
=
STRCHR
(buf,
'e'
);
-
p2
=
STRCHR
(
buf,
'E');
-
if
(
p
||
p2)
{
-
if
(
p
)
{
-
if
(
p2
&&
(
p
>
p2
))
{
-
p
=
p2
;
+
+
d
=
STRTOD
(buf,
NULL
);
+
+
if(GOBBLE('e')
||
GOBBLE
('E')
)
+
{
+
int neg
;
+
if(
GOBBLE('-'))
+
neg=1;
+
else
if(
GOBBLE('+'
)
)
+
neg=0;
+
else
+
neg=0;
+
+
READBUF
(
isdigit(C));
+
if
(
neg)
+
d /= pow(10.0,STRTOD(buf,NULL
))
;
+
else
+
d *
=
pow(10.0,STRTOD(buf,NULL))
;
+
isfloat=1;
}
-
}
else
{
-
p
=
p2
;
+
if(isfloat)
+
{
+
yylval->fnum=(float)d;
+
return F_FLOAT
;
}
-
UNGETSTR(p, strlen(p));
-
*p = 0;
-
}
+
if(buf[0]=='0') yylval->number=STRTOL(buf,NULL,8); else