diff --git a/lexer.c b/lexer.c
index 5b0023f9a7c66d810ce03e6dc6e57de5c7a3f2c0..9d6c4a925337eb0092853a73d0886672220c002e 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;