Skip to content
Snippets Groups Projects
Commit c21a9cd3 authored by dcw's avatar dcw
Browse files

fixed pushback screwup whereby id & int weren't pushed back!

parent 261b7c79
Branches
No related tags found
No related merge requests found
...@@ -42,6 +42,8 @@ FILE *lexfile; ...@@ -42,6 +42,8 @@ FILE *lexfile;
static BOOL havepushedtok = FALSE; static BOOL havepushedtok = FALSE;
static TOKEN curtok; static TOKEN curtok;
static char curid[ MAXIDSIZE ];
static int curint;
/* ----------------- Private procedures ---------------- */ /* ----------------- Private procedures ---------------- */
...@@ -105,6 +107,8 @@ TOKEN nexttok() ...@@ -105,6 +107,8 @@ TOKEN nexttok()
{ {
lexidval[pos++] = '\0'; lexidval[pos++] = '\0';
} }
strcpy( curid, lexidval );
curtok = tSTR;
break; break;
default: default:
if( isalpha( c ) ) if( isalpha( c ) )
...@@ -119,17 +123,19 @@ TOKEN nexttok() ...@@ -119,17 +123,19 @@ TOKEN nexttok()
ungetc( c, lexfile ); ungetc( c, lexfile );
while( pos<MAXIDSIZE ) while( pos<MAXIDSIZE )
lexidval[pos++] = '\0'; lexidval[pos++] = '\0';
strcpy( curid, lexidval );
} else if( isdigit( c ) ) } else if( isdigit( c ) )
{ {
int t; int t;
curtok = tNUM; curtok = tNUM;
for( t=0; isdigit(c); t = t*10 + (c-'0')) for( t=0; isdigit(c); )
{ {
t = t*10 + c-'0';
c=getc(lexfile); c=getc(lexfile);
} }
ungetc( c, lexfile ); ungetc( c, lexfile );
lexintval = t; curint = lexintval = t;
} else } else
{ {
curtok = tERROR; curtok = tERROR;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment