mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2025-01-18 22:31: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 == ')') {
|
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 (wantop) {
|
||||||
if (!vec_size(sy.paren))
|
|
||||||
break;
|
|
||||||
if (vec_last(sy.paren) == PAREN_TERNARY1) {
|
if (vec_last(sy.paren) == PAREN_TERNARY1) {
|
||||||
parseerror(parser, "mismatched parentheses (closing paren in ternary expression?)");
|
parseerror(parser, "mismatched parentheses (closing paren in ternary expression?)");
|
||||||
goto onerr;
|
goto onerr;
|
||||||
|
@ -2002,8 +2006,6 @@ static ast_expression* parse_expression_leave(parser_t *parser, bool stopatcomma
|
||||||
goto onerr;
|
goto onerr;
|
||||||
} else {
|
} else {
|
||||||
/* must be a function call without parameters */
|
/* must be a function call without parameters */
|
||||||
if (!vec_size(sy.paren))
|
|
||||||
break;
|
|
||||||
if (vec_last(sy.paren) != PAREN_FUNC) {
|
if (vec_last(sy.paren) != PAREN_FUNC) {
|
||||||
parseerror(parser, "closing paren in invalid position");
|
parseerror(parser, "closing paren in invalid position");
|
||||||
goto onerr;
|
goto onerr;
|
||||||
|
@ -2022,14 +2024,19 @@ static ast_expression* parse_expression_leave(parser_t *parser, bool stopatcomma
|
||||||
goto onerr;
|
goto onerr;
|
||||||
}
|
}
|
||||||
else if (parser->tok == ']') {
|
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))
|
if (!vec_size(sy.paren))
|
||||||
break;
|
break;
|
||||||
if (!vec_size(sy.paren) || vec_last(sy.paren) != PAREN_INDEX) {
|
if (vec_last(sy.paren) != PAREN_INDEX) {
|
||||||
parseerror(parser, "mismatched parentheses, unexpected ']'");
|
parseerror(parser, "mismatched parentheses, unexpected ']'");
|
||||||
goto onerr;
|
goto onerr;
|
||||||
}
|
}
|
||||||
if (!parser_close_paren(parser, &sy))
|
if (!parser_close_paren(parser, &sy))
|
||||||
goto onerr;
|
goto onerr;
|
||||||
|
wantop = true;
|
||||||
}
|
}
|
||||||
else if (!wantop) {
|
else if (!wantop) {
|
||||||
if (!parse_sya_operand(parser, &sy, with_labels))
|
if (!parse_sya_operand(parser, &sy, with_labels))
|
||||||
|
|
Loading…
Reference in a new issue