mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2025-01-31 12:00:38 +00:00
this should allow for better detection of precedence issues
This commit is contained in:
parent
fa468e0673
commit
ff6d55aafc
1 changed files with 11 additions and 0 deletions
11
parser.c
11
parser.c
|
@ -1692,6 +1692,17 @@ static ast_expression* parse_expression_leave(parser_t *parser, bool stopatcomma
|
|||
if (vec_size(sy.ops) && !vec_last(sy.ops).isparen)
|
||||
olast = &operators[vec_last(sy.ops).etype-1];
|
||||
|
||||
/* first only apply higher precedences, assoc_left+equal comes after we warn about precedence rules */
|
||||
while (olast && op->prec < olast->prec)
|
||||
{
|
||||
if (!parser_sy_apply_operator(parser, &sy))
|
||||
goto onerr;
|
||||
if (vec_size(sy.ops) && !vec_last(sy.ops).isparen)
|
||||
olast = &operators[vec_last(sy.ops).etype-1];
|
||||
else
|
||||
olast = NULL;
|
||||
}
|
||||
|
||||
#define IsAssignOp(x) (\
|
||||
(x) == opid1('=') || \
|
||||
(x) == opid2('+','=') || \
|
||||
|
|
Loading…
Reference in a new issue