aboutsummaryrefslogtreecommitdiff
path: root/src/parser.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2019-10-06 18:14:02 +0100
committergingerBill <bill@gingerbill.org>2019-10-06 18:14:02 +0100
commitd62503d031855534adddc37f84bd2e92dc2a5467 (patch)
tree23e00899d59a0269dc807b209e4ec5b302ef29c8 /src/parser.cpp
parent4e8a801b3504f402e06d6928e889b33c7872f88f (diff)
Change precedence for `in` and `notin` to match + - | ~
Diffstat (limited to 'src/parser.cpp')
-rw-r--r--src/parser.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/parser.cpp b/src/parser.cpp
index fb093ffd9..29254d7e8 100644
--- a/src/parser.cpp
+++ b/src/parser.cpp
@@ -2479,17 +2479,18 @@ i32 token_precedence(AstFile *f, TokenKind t) {
case Token_LtEq:
case Token_GtEq:
return 5;
+
case Token_in:
case Token_notin:
- if (f->expr_level >= 0 || f->allow_in_expr) {
- return 6;
+ if (f->expr_level < 0 && !f->allow_in_expr) {
+ return 0;
}
- return 0;
+ /*fallthrough*/
case Token_Add:
case Token_Sub:
case Token_Or:
case Token_Xor:
- return 7;
+ return 6;
case Token_Mul:
case Token_Quo:
case Token_Mod:
@@ -2498,7 +2499,7 @@ i32 token_precedence(AstFile *f, TokenKind t) {
case Token_AndNot:
case Token_Shl:
case Token_Shr:
- return 8;
+ return 7;
}
return 0;
}