diff options
author | Daniel <kingdread@gmx.de> | 2020-04-20 14:27:42 +0200 |
---|---|---|
committer | Daniel <kingdread@gmx.de> | 2020-04-20 14:27:42 +0200 |
commit | 0e4e148a0890ba206df40cffe5a5f1cc47c8079e (patch) | |
tree | 8df2906ee40c84fbab0aa223b13f89a787aa22c6 /src/fexpr/mod.rs | |
parent | 569c17607297dbbd57462a9603861d9fe619fd2d (diff) | |
download | raidgrep-0e4e148a0890ba206df40cffe5a5f1cc47c8079e.tar.gz raidgrep-0e4e148a0890ba206df40cffe5a5f1cc47c8079e.tar.bz2 raidgrep-0e4e148a0890ba206df40cffe5a5f1cc47c8079e.zip |
hook up new expression parser to command line args
This method is not perfect yet, because
1. The items are not documented as they were before
2. You need to separate the args with --, otherwise Clap tries to parse
them as optional flags
This should be fixed (especially the documentation part) before merging
into master.
Diffstat (limited to 'src/fexpr/mod.rs')
-rw-r--r-- | src/fexpr/mod.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/fexpr/mod.rs b/src/fexpr/mod.rs index f2b1090..aafdea7 100644 --- a/src/fexpr/mod.rs +++ b/src/fexpr/mod.rs @@ -4,7 +4,7 @@ //! type and convert it to a [`Filter`][super::filters::Filter]. // Make it available in the grammar mod. use super::{filters, FightOutcome, SearchField, Weekday}; -use lalrpop_util::lalrpop_mod; +use lalrpop_util::{lalrpop_mod, lexer::Token, ParseError}; use thiserror::Error; @@ -23,3 +23,9 @@ pub enum FError { #[error("invalid boss name: {0}")] InvalidBoss(String), } + +pub fn parse_logfilter( + input: &str, +) -> Result<Box<dyn filters::log::LogFilter>, ParseError<usize, Token, FError>> { + grammar::LogFilterParser::new().parse(input) +} |