aboutsummaryrefslogtreecommitdiff
path: root/src/fexpr
diff options
context:
space:
mode:
authorDaniel <kingdread@gmx.de>2020-06-12 15:55:19 +0200
committerDaniel <kingdread@gmx.de>2020-06-12 15:55:19 +0200
commit4a3e7137334601828f56a3ee614f01d84bada4ce (patch)
tree3cf7fc84dfebeff11bd5d12230eb39368f45423f /src/fexpr
parent6e52b5f2ac6154eca35355b320b7fb8bbc8f23ee (diff)
downloadraidgrep-4a3e7137334601828f56a3ee614f01d84bada4ce.tar.gz
raidgrep-4a3e7137334601828f56a3ee614f01d84bada4ce.tar.bz2
raidgrep-4a3e7137334601828f56a3ee614f01d84bada4ce.zip
implement -after/-before in terms of -time
It makes sense to unify this implementation to avoid code duplication and bugs that might be hidden. -after and -before can stay for now, as shortcuts for -time < and -time >, the same way we have other shortcuts as well.
Diffstat (limited to 'src/fexpr')
-rw-r--r--src/fexpr/grammar.lalrpop8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/fexpr/grammar.lalrpop b/src/fexpr/grammar.lalrpop
index 700481c..092407e 100644
--- a/src/fexpr/grammar.lalrpop
+++ b/src/fexpr/grammar.lalrpop
@@ -52,8 +52,12 @@ LogPredicate: Box<dyn filters::log::LogFilter> = {
"-outcome" <Comma<FightOutcome>> => filters::log::outcome(<>),
"-weekday" <Comma<Weekday>> => filters::log::weekday(<>),
- "-before" <Date> => filters::log::before(<>),
- "-after" <Date> => filters::log::after(<>),
+ "-before" <Date> => filters::values::comparison(
+ filters::values::time(), filters::values::CompOp::Less, filters::values::constant(<>)
+ ),
+ "-after" <Date> => filters::values::comparison(
+ filters::values::time(), filters::values::CompOp::Greater, filters::values::constant(<>)
+ ),
"-log-before" <Date> => filters::log::log_before(<>),
"-log-after" <Date> => filters::log::log_after(<>),