=================================================================== RCS file: /home/cvs/OpenXM_contrib2/asir2000/parse/lex.c,v retrieving revision 1.20 retrieving revision 1.27 diff -u -p -r1.20 -r1.27 --- OpenXM_contrib2/asir2000/parse/lex.c 2002/09/09 12:23:51 1.20 +++ OpenXM_contrib2/asir2000/parse/lex.c 2003/11/27 02:34:11 1.27 @@ -45,7 +45,7 @@ * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. * - * $OpenXM: OpenXM_contrib2/asir2000/parse/lex.c,v 1.19 2001/12/21 08:23:15 noro Exp $ + * $OpenXM: OpenXM_contrib2/asir2000/parse/lex.c,v 1.26 2003/08/21 08:05:02 saito Exp $ */ #include #include "ca.h" @@ -144,7 +144,7 @@ int yylex() while ( ( c = Getc() ) == '0' ); if ( c == '.' ) { Ungetc(c); c = '0'; - } else if ( c == 'x' ) { + } else if ( c == 'x' || c == 'X' ) { for ( i = 0; i < 8; i++ ) nbuf[i] = '0'; READ_ALNUM_NBUF @@ -153,7 +153,7 @@ int yylex() NTOQ(n1,1,q); r = (Obj)q; yylvalp->p = (pointer)r; return ( FORMULA ); - } else if ( c == 'b' ) { + } else if ( c == 'b' || c == 'B' ) { for ( i = 0; i < 32; i++ ) nbuf[i] = '0'; READ_ALNUM_NBUF @@ -186,8 +186,26 @@ int yylex() c = Getc(); if ( c == '\\' ) { c1 = Getc(); - if ( c1 == 'n' ) + if ( c1 == 'n' ) { c1 = '\n'; + }else if ( c1 == 't' ) { + c1 = '\t'; + }else if ( isdigit(c1) ){ + d = c1 - '0'; + c1 = Getc(); + if ( isdigit(c1) ) { + d = 8*d + (c1 - '0'); + c1 = Getc(); + if ( isdigit(c1) ) { + d = 8*d + (c1 - '0'); + }else { + Ungetc(c1); + } + }else { + Ungetc(c1); + } + c1 = d; + } REALLOC_NBUF nbuf[i++] = c1; } else { REALLOC_NBUF nbuf[i++] = c; @@ -256,7 +274,7 @@ int yylex() REALLOC_NBUF nbuf[i++] = c; READ_DIGIT_NBUF - if ( c == 'e' ) { + if ( c == 'e' || c == 'E' ) { REALLOC_NBUF nbuf[i++] = c; c = Getc(); if ( (c == '+') || (c == '-') ) { @@ -265,7 +283,7 @@ int yylex() Ungetc(c); READ_DIGIT_NBUF } - } else if ( c == 'e' ) { + } else if ( c == 'e' || c == 'E' ) { floatingpoint = 1; REALLOC_NBUF nbuf[i++] = c; c = Getc(); @@ -277,7 +295,7 @@ int yylex() } if ( floatingpoint ) { Ungetc(c); REALLOC_NBUF nbuf[i] = 0; -#if PARI +#if defined(PARI) if ( !bigfloat ) { dbl = (double)atof(nbuf+DLENGTH); MKReal(dbl,real); r = (Obj)real; @@ -299,12 +317,29 @@ int yylex() } yylvalp->p = (pointer)r; return ( FORMULA ); - } else if ( isalpha(c) ) { - i = 0; - tbuf[i++] = c; + } else if ( isalpha(c) || c == ':' ) { + if ( c == ':' ) { + c1 = Getc(); + if ( c1 != ':' ) { + Ungetc(c1); + return c; + } + c1 = Getc(); + if ( !isalpha(c1) ) { + Ungetc(c1); + return COLONCOLON; + } + i = 0; + tbuf[i++] = ':'; + tbuf[i++] = ':'; + tbuf[i++] = c1; + } else { + i = 0; + tbuf[i++] = c; + } while ( 1 ) { c = Getc(); - if ( isalpha(c)||isdigit(c)||(c=='_') ) { + if ( isalpha(c)||isdigit(c)||(c=='_')||(c=='.') ) { REALLOC_TBUF tbuf[i++] = c; } else break; @@ -427,7 +462,7 @@ void purge_stdin() w_purge_stdin(); #elif defined(sparc) || defined(__alpha) || defined(__SVR4) || defined(mips) || defined(VISUAL) || defined(_IBMR2) stdin->_ptr = stdin->_base; stdin->_cnt = 0; -#elif (defined(__MACH__) && defined(__ppc__)) || defined(__CYGWIN__) +#elif (defined(__MACH__) && defined(__ppc__)) || defined(__CYGWIN__) || defined(__FreeBSD__) stdin->_r = 0; stdin->_p = stdin->_bf._base; #else --->FIXIT