pike.git
/
src
/
lex.c
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/lex.c:1:
/*\ ||| This file a part of Pike, and is copyright by Fredrik Hubinette ||| Pike is distributed as GPL (General Public License) ||| 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.21
.2.1
1997/
05
/
19
09:
04:55
hubbe Exp $");
#include "language.h" #include "array.h" #include "lex.h" #include "stralloc.h" #include "dynamic_buffer.h" #include "constants.h" #include "hashtable.h" #include "stuff.h" #include "memory.h" #include "interpret.h"
pike.git/src/lex.c:1470:
if(GOBBLE('x')) { READBUF(isxdigit(C)); yylval->number=STRTOL(buf,NULL,16); return F_NUMBER; } case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': {
-
char *p;
+
char *p
, *p2
;
+
int isfloat=0;
+
double d;
+
UNGETC(c); READBUF(isdigit(C) || C=='.'); p=STRCHR(buf,'.'); if(p) { if(p[1]=='.') { UNGETSTR(p,strlen(p)); *p=0; p=NULL; }else if((p=STRCHR(p+1,'.'))) { UNGETSTR(p,strlen(p)); *p=0; }
-
+
if((p=STRCHR(buf,'.'))) {
-
yylval->fnum
=
STRTOD(buf,NULL)
;
-
return F_FLOAT;
+
isfloat
=
1
;
} }
-
+
+
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;
+
}
+
if(isfloat)
+
{
+
yylval->fnum=(float)d;
+
return F_FLOAT;
+
}
+
if(buf[0]=='0') yylval->number=STRTOL(buf,NULL,8); else yylval->number=STRTOL(buf,NULL,10); return F_NUMBER; } case '-': if(GOBBLE('=')) return F_SUB_EQ; if(GOBBLE('>')) return F_ARROW;