summaryrefslogtreecommitdiff
path: root/py/grammar.h
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2018-06-19 14:20:42 +1000
committerDamien George <damien.p.george@gmail.com>2018-06-22 17:00:29 +1000
commit25ae98f07cb3c4488cb955403dfe56b8bb8db6f0 (patch)
treefc103db11a8b160c0a0a3a9f7d5f1e2422b43552 /py/grammar.h
parent36e474e83fa26cb78a9312dce5dc53a467c5d8b7 (diff)
py/compile: Combine expr, xor_expr and and_expr into one function.
This and the previous 4 commits combined have change in code size of: bare-arm: -92 minimal x86: -544 unix x64: -544 unix nanbox: -712 stm32: -116 cc3200: -128 esp8266: -348 esp32: -232
Diffstat (limited to 'py/grammar.h')
-rw-r--r--py/grammar.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/py/grammar.h b/py/grammar.h
index 37b97a191..5a5b682ac 100644
--- a/py/grammar.h
+++ b/py/grammar.h
@@ -241,9 +241,9 @@ DEF_RULE_NC(comp_op_not_in, and(2), tok(KW_NOT), tok(KW_IN))
DEF_RULE_NC(comp_op_is, and(2), tok(KW_IS), opt_rule(comp_op_is_not))
DEF_RULE_NC(comp_op_is_not, and(1), tok(KW_NOT))
DEF_RULE(star_expr, c(star_expr), and(2), tok(OP_STAR), rule(expr))
-DEF_RULE(expr, c(expr), list, rule(xor_expr), tok(OP_PIPE))
-DEF_RULE(xor_expr, c(xor_expr), list, rule(and_expr), tok(OP_CARET))
-DEF_RULE(and_expr, c(and_expr), list, rule(shift_expr), tok(OP_AMPERSAND))
+DEF_RULE(expr, c(binary_op), list, rule(xor_expr), tok(OP_PIPE))
+DEF_RULE(xor_expr, c(binary_op), list, rule(and_expr), tok(OP_CARET))
+DEF_RULE(and_expr, c(binary_op), list, rule(shift_expr), tok(OP_AMPERSAND))
DEF_RULE(shift_expr, c(term), list, rule(arith_expr), rule(shift_op))
DEF_RULE_NC(shift_op, or(2), tok(OP_DBL_LESS), tok(OP_DBL_MORE))
DEF_RULE(arith_expr, c(term), list, rule(term), rule(arith_op))