pike.git / src / lex.c

version» Context lines:

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.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"   #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:1471:    {    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, *p2; +  int isfloat=0; +  double d; +     UNGETC(c); -  READBUF(isdigit(C) || C=='.' || C=='e' || C=='E'); +  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;    }    } -  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    yylval->number=STRTOL(buf,NULL,10);    return F_NUMBER;    }       case '-':    if(GOBBLE('=')) return F_SUB_EQ;    if(GOBBLE('>')) return F_ARROW;