aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel <kingdread@gmx.de>2020-04-21 14:06:15 +0200
committerDaniel <kingdread@gmx.de>2020-04-21 14:06:15 +0200
commit0ad7a333dc2b45f0ba658ea455284d086294a088 (patch)
tree0aef7a0a3cac0fe5467f9397d41dc6910cb44311
parentd1f277892ec127b1fb83ad56de59b29c32695661 (diff)
downloadraidgrep-0ad7a333dc2b45f0ba658ea455284d086294a088.tar.gz
raidgrep-0ad7a333dc2b45f0ba658ea455284d086294a088.tar.bz2
raidgrep-0ad7a333dc2b45f0ba658ea455284d086294a088.zip
grammar: fix precendence rules
If we don't allow the higher-tier on the left side, we cannot chain multiple or/and on the same level. Since or is associative, we shouldn't expect the user to write (... or (... or ...)) and instead provide the flattened version as well.
-rw-r--r--src/fexpr/grammar.lalrpop8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/fexpr/grammar.lalrpop b/src/fexpr/grammar.lalrpop
index f559ff1..caaaf7f 100644
--- a/src/fexpr/grammar.lalrpop
+++ b/src/fexpr/grammar.lalrpop
@@ -28,18 +28,18 @@ PlayerFilter: Box<dyn filters::player::PlayerFilter> = {
}
Disjunction<T>: T = {
- <a:Conjunction<T>> "or" <b:Conjunction<T>> => a | b,
+ <a:Disjunction<T>> "or" <b:Conjunction<T>> => a | b,
Conjunction<T>,
}
Conjunction<T>: T = {
- <a:Negation<T>> "and"? <b:Negation<T>> => a & b,
+ <a:Conjunction<T>> "and"? <b:Negation<T>> => a & b,
Negation<T>,
}
Negation<T>: T = {
- "not" <T> => ! <>,
- "!" <T> => ! <>,
+ "not" <Negation<T>> => ! <>,
+ "!" <Negation<T>> => ! <>,
T,
}