From ff6d55aafc9f5118be3935f0daa61e2e0929b6df Mon Sep 17 00:00:00 2001
From: Wolfgang Bumiller <wry.git@bumiller.com>
Date: Thu, 29 Aug 2013 10:22:48 +0200
Subject: [PATCH] this should allow for better detection of precedence issues

---
 parser.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

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('+','=') || \
-- 
2.39.5