shithub: scc

Download patch

ref: eb09f99efa9107704d1903abe8aa69fe9d298b3a
parent: 27a96ef16da16b72fd0917120f5235f4fa9d94e9
author: Roberto E. Vargas Caballero <[email protected]>
date: Mon Jun 4 17:00:17 EDT 2012

Fixed correct value of yytoken in EOF

When EOF (end of file) was returned by getc, yytoken hasn't the correct value.

--- a/lex.c
+++ b/lex.c
@@ -131,8 +131,9 @@
 	if (c == EOF) {
 		if (parser_out_home)
 			error("Find EOF while parsing");
-		else
-			return EOFTOK;
+		ch = EOFTOK;
+		memcpy(yytext, "EOF", sizeof("EOF"));
+		goto return_token;
 	}
 	ch = c;
 	if (isalpha(ch) || ch == '_') {