tokenizer.c

changeset 20
3f11f764772a
parent 14
91f0c87b62a7
child 21
6d4282804e73
--- a/tokenizer.c	Mon Jul 24 16:38:12 2000 +0200
+++ b/tokenizer.c	Sun Aug 27 21:21:29 2000 +0200
@@ -115,19 +115,14 @@
 	}else{
 		c=getc(tokz->file);
 	}
-/*	if(c=='\n')
-		tokz->line++;*/
-	
+
 	return c;
 }
 
 
 static void _ungetch(Tokenizer *tokz, int c)
 {
-/*	if(c=='\n')
-		tokz->line--;*/
 	tokz->ungetc=c;
-	/*ungetc(c, tokz->file);*/
 }
 
 
@@ -557,10 +552,17 @@
 	if(e==E_TOKZ_UNEXPECTED_EOF)
 		line=0;
 	
-	if(e<0)
-		warn_obj_line(tokz->name, line, "%s", strerror(-e));
-	else
-		warn_obj_line(tokz->name, line, "%s", TR(errors[e]));
+	if(tokz!=NULL){
+		if(e<0)
+			warn_obj_line(tokz->name, line, "%s", strerror(-e));
+		else
+			warn_obj_line(tokz->name, line, "%s", TR(errors[e]));
+	}else{
+		if(e<0)
+			warn("%s", strerror(-e));
+		else
+			warn("%s", TR(errors[e]));
+	}
 }
 
 

mercurial