From: Wolfgang Bumiller Date: Thu, 29 Aug 2013 08:22:48 +0000 (+0200) Subject: this should allow for better detection of precedence issues X-Git-Tag: 0.3.5~118^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=ff6d55aafc9f5118be3935f0daa61e2e0929b6df;p=xonotic%2Fgmqcc.git this should allow for better detection of precedence issues --- diff --git a/parser.c b/parser.c index e086449..1cd74dd 100644 --- a/parser.c +++ b/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('+','=') || \