Better handling of EOF - encountering EOF in parser_next will not return false yet, this is a more elegant way...

This commit is contained in:
Wolfgang (Blub) Bumiller 2012-08-20 18:15:31 +02:00
parent 5a0995c767
commit 0d64e555e2

View file

@ -129,7 +129,7 @@ bool parser_next(parser_t *parser)
/* lex_do kills the previous token */ /* lex_do kills the previous token */
parser->tok = lex_do(parser->lex); parser->tok = lex_do(parser->lex);
if (parser->tok == TOKEN_EOF) if (parser->tok == TOKEN_EOF)
return false; return true;
if (parser->tok >= TOKEN_ERROR) { if (parser->tok >= TOKEN_ERROR) {
parseerror(parser, "lex error"); parseerror(parser, "lex error");
return false; return false;