]> git.rm.cloudns.org Git - xonotic/gmqcc.git/commitdiff
this should allow for better detection of precedence issues
authorWolfgang Bumiller <wry.git@bumiller.com>
Thu, 29 Aug 2013 08:22:48 +0000 (10:22 +0200)
committerWolfgang Bumiller <wry.git@bumiller.com>
Thu, 29 Aug 2013 08:22:48 +0000 (10:22 +0200)
parser.c

index e0864493eab449bff48a727478933df9a48e4744..1cd74dd8ef49c9141e005abccc4280b376869d0c 100644 (file)
--- 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('+','=') || \