mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2024-11-27 14:12:36 +00:00
fixed a bug which allowed some statements to end in tokens other than semicolons... (ie closing parens)
This commit is contained in:
parent
428453a132
commit
81cc4194dc
1 changed files with 7 additions and 2 deletions
9
parser.c
9
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;
|
||||
|
|
Loading…
Reference in a new issue