From: Wolfgang Bumiller Date: Thu, 10 Jan 2013 14:23:04 +0000 (+0100) Subject: fixed a bug which allowed some statements to end in tokens other than semicolons... X-Git-Tag: before-library~330 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=81cc4194dca1a128851fb0a5aed86e30df2542e3;p=xonotic%2Fgmqcc.git fixed a bug which allowed some statements to end in tokens other than semicolons... (ie closing parens) --- diff --git a/parser.c b/parser.c index b15280b..9912f56 100644 --- a/parser.c +++ b/parser.c @@ -1957,7 +1957,7 @@ static ast_expression* parse_expression_leave(parser_t *parser, bool stopatcomma goto onerr; } if (parser->tok == ';' || - (!parens && parser->tok == ']')) + (!parens && (parser->tok == ']' || parser->tok == ')'))) { break; } @@ -1996,8 +1996,13 @@ static ast_expression* parse_expression(parser_t *parser, bool stopatcomma, bool ast_expression *e = parse_expression_leave(parser, stopatcomma, false, with_labels); if (!e) return NULL; + if (parser->tok != ';') { + parseerror(parser, "semicolon expected after expression"); + ast_unref(e); + return NULL; + } if (!parser_next(parser)) { - ast_delete(e); + ast_unref(e); return NULL; } return e;