mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2025-01-18 14:21:36 +00:00
adding missing wantop flag and some related parentheses code
This commit is contained in:
parent
ba207cc04c
commit
dca9dd56d1
1 changed files with 12 additions and 5 deletions
17
parser.c
17
parser.c
|
@ -1991,9 +1991,13 @@ static ast_expression* parse_expression_leave(parser_t *parser, bool stopatcomma
|
|||
}
|
||||
}
|
||||
else if (parser->tok == ')') {
|
||||
while (vec_size(sy.paren) && vec_last(sy.paren) == PAREN_TERNARY2) {
|
||||
if (!parser_sy_apply_operator(parser, &sy))
|
||||
goto onerr;
|
||||
}
|
||||
if (!vec_size(sy.paren))
|
||||
break;
|
||||
if (wantop) {
|
||||
if (!vec_size(sy.paren))
|
||||
break;
|
||||
if (vec_last(sy.paren) == PAREN_TERNARY1) {
|
||||
parseerror(parser, "mismatched parentheses (closing paren in ternary expression?)");
|
||||
goto onerr;
|
||||
|
@ -2002,8 +2006,6 @@ static ast_expression* parse_expression_leave(parser_t *parser, bool stopatcomma
|
|||
goto onerr;
|
||||
} else {
|
||||
/* must be a function call without parameters */
|
||||
if (!vec_size(sy.paren))
|
||||
break;
|
||||
if (vec_last(sy.paren) != PAREN_FUNC) {
|
||||
parseerror(parser, "closing paren in invalid position");
|
||||
goto onerr;
|
||||
|
@ -2022,14 +2024,19 @@ static ast_expression* parse_expression_leave(parser_t *parser, bool stopatcomma
|
|||
goto onerr;
|
||||
}
|
||||
else if (parser->tok == ']') {
|
||||
while (vec_size(sy.paren) && vec_last(sy.paren) == PAREN_TERNARY2) {
|
||||
if (!parser_sy_apply_operator(parser, &sy))
|
||||
goto onerr;
|
||||
}
|
||||
if (!vec_size(sy.paren))
|
||||
break;
|
||||
if (!vec_size(sy.paren) || vec_last(sy.paren) != PAREN_INDEX) {
|
||||
if (vec_last(sy.paren) != PAREN_INDEX) {
|
||||
parseerror(parser, "mismatched parentheses, unexpected ']'");
|
||||
goto onerr;
|
||||
}
|
||||
if (!parser_close_paren(parser, &sy))
|
||||
goto onerr;
|
||||
wantop = true;
|
||||
}
|
||||
else if (!wantop) {
|
||||
if (!parse_sya_operand(parser, &sy, with_labels))
|
||||
|
|
Loading…
Reference in a new issue