scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit eb09f99efa9107704d1903abe8aa69fe9d298b3a
parent 27a96ef16da16b72fd0917120f5235f4fa9d94e9
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Mon,  4 Jun 2012 21:00:17 +0200

Fixed correct value of yytoken in EOF

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

Diffstat:
Mlex.c | 5+++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lex.c b/lex.c @@ -131,8 +131,9 @@ unsigned char next(void) 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 == '_') {