diff options
author | Daniel <kingdread@gmx.de> | 2020-04-25 13:14:30 +0200 |
---|---|---|
committer | Daniel <kingdread@gmx.de> | 2020-04-25 13:19:42 +0200 |
commit | 5dbea93266c3a30dac5ec6f5a7915d73a440f573 (patch) | |
tree | 9b7bba1b25b2ccebd0b5ed705bf8b7238ddb0893 /src/fexpr | |
parent | 509e5817e6e035e762840c00fb95b18253b1d269 (diff) | |
download | raidgrep-5dbea93266c3a30dac5ec6f5a7915d73a440f573.tar.gz raidgrep-5dbea93266c3a30dac5ec6f5a7915d73a440f573.tar.bz2 raidgrep-5dbea93266c3a30dac5ec6f5a7915d73a440f573.zip |
use free functions instead of Filter::new
Having a ::new on each of the filter types was a bit weird, especially
because we returned Box<dyn ...> instead of Self (and clippy rightfully
complained). With this patch, we now have a bunch of normal functions,
and we don't show to the outside how a filter is actually implemented
(or what struct is behind it).
Diffstat (limited to 'src/fexpr')
-rw-r--r-- | src/fexpr/grammar.lalrpop | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/fexpr/grammar.lalrpop b/src/fexpr/grammar.lalrpop index caaaf7f..d8f64fa 100644 --- a/src/fexpr/grammar.lalrpop +++ b/src/fexpr/grammar.lalrpop @@ -44,19 +44,19 @@ Negation<T>: T = { } LogPredicate: Box<dyn filters::log::LogFilter> = { - "-success" => filters::log::OutcomeFilter::success(), - "-wipe" => filters::log::OutcomeFilter::wipe(), - "-outcome" <Comma<FightOutcome>> => filters::log::OutcomeFilter::new(<>), + "-success" => filters::log::success(), + "-wipe" => filters::log::wipe(), + "-outcome" <Comma<FightOutcome>> => filters::log::outcome(<>), - "-weekday" <Comma<Weekday>> => filters::log::WeekdayFilter::new(<>), - "-before" <Date> => filters::log::TimeFilter::new(None, Some(<>)), - "-after" <Date> => filters::log::TimeFilter::new(Some(<>), None), + "-weekday" <Comma<Weekday>> => filters::log::weekday(<>), + "-before" <Date> => filters::log::before(<>), + "-after" <Date> => filters::log::after(<>), - "-boss" <Comma<Boss>> => filters::log::BossFilter::new(<>), + "-boss" <Comma<Boss>> => filters::log::boss(<>), "-player" <Regex> => filters::player::any( - filters::player::NameFilter::new(SearchField::Character, <>.clone()) - | filters::player::NameFilter::new(SearchField::Account, <>) + filters::player::character(<>.clone()) + | filters::player::account(<>) ), "all" "(" "player" ":" <PlayerFilter> ")" => filters::player::all(<>), @@ -67,11 +67,11 @@ LogPredicate: Box<dyn filters::log::LogFilter> = { } PlayerPredicate: Box<dyn filters::player::PlayerFilter> = { - "-character" <Regex> => filters::player::NameFilter::new(SearchField::Character, <>), - "-account" <Regex> => filters::player::NameFilter::new(SearchField::Account, <>), + "-character" <Regex> => filters::player::character(<>), + "-account" <Regex> => filters::player::account(<>), "-name" <Regex> => - filters::player::NameFilter::new(SearchField::Account, <>.clone()) - | filters::player::NameFilter::new(SearchField::Character, <>), + filters::player::account(<>.clone()) + | filters::player::character(<>), "(" <PlayerFilter> ")", } |