From c21a9cd3da1c6d7c24448e8627d1f1eef5d1acef Mon Sep 17 00:00:00 2001 From: dcw <dcw> Date: Fri, 24 Nov 1989 16:11:11 +0000 Subject: [PATCH] fixed pushback screwup whereby id & int weren't pushed back! --- lexer.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lexer.c b/lexer.c index 5b0023f..9d6c4a9 100644 --- a/lexer.c +++ b/lexer.c @@ -42,6 +42,8 @@ FILE *lexfile; static BOOL havepushedtok = FALSE; static TOKEN curtok; +static char curid[ MAXIDSIZE ]; +static int curint; /* ----------------- Private procedures ---------------- */ @@ -105,6 +107,8 @@ TOKEN nexttok() { lexidval[pos++] = '\0'; } + strcpy( curid, lexidval ); + curtok = tSTR; break; default: if( isalpha( c ) ) @@ -119,17 +123,19 @@ TOKEN nexttok() ungetc( c, lexfile ); while( pos<MAXIDSIZE ) lexidval[pos++] = '\0'; + strcpy( curid, lexidval ); } else if( isdigit( c ) ) { int t; 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); } ungetc( c, lexfile ); - lexintval = t; + curint = lexintval = t; } else { curtok = tERROR; -- GitLab