diff options
author | Daniel <kingdread@gmx.de> | 2020-04-29 15:54:45 +0200 |
---|---|---|
committer | Daniel <kingdread@gmx.de> | 2020-04-29 15:54:45 +0200 |
commit | d564421e9fb71da21ef02d8b711af0e8471bb602 (patch) | |
tree | 248beefb56d405dc80057e02197a8804c11c6cac | |
parent | 16019515dffe4dd790adc72ed8a8ece8fc54c260 (diff) | |
download | raidgrep-d564421e9fb71da21ef02d8b711af0e8471bb602.tar.gz raidgrep-d564421e9fb71da21ef02d8b711af0e8471bb602.tar.bz2 raidgrep-d564421e9fb71da21ef02d8b711af0e8471bb602.zip |
allow quoted strings as boss names
With evtclib 0.2, every boss has at least one name without space, so
every boss can be used. Still, for completeness's and consistency's
sake, we want to allow users to also specify boss names with spaces in
them. For example, if we print "Qadim the Peerless" as the name of the
boss, we might expect
raidgrep -- -boss "Qadim the Peerless"
to work (instead of -boss qadimp). Therefore, we now allow boss names to
be quoted, so that we can properly persist the whitespace.
-rw-r--r-- | src/fexpr/grammar.lalrpop | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/fexpr/grammar.lalrpop b/src/fexpr/grammar.lalrpop index a406490..f193a90 100644 --- a/src/fexpr/grammar.lalrpop +++ b/src/fexpr/grammar.lalrpop @@ -80,7 +80,7 @@ PlayerPredicate: Box<dyn filters::player::PlayerFilter> = { } Regex: Regex = { - <l:@L> <s:regex> =>? Regex::new(&s[1..s.len() - 1]).map_err(|error| ParseError::User { + <l:@L> <s:string> =>? Regex::new(&s[1..s.len() - 1]).map_err(|error| ParseError::User { error: FError { location: l, data: s.to_string(), @@ -124,6 +124,14 @@ Boss: Boss = { kind: FErrorKind::InvalidBoss, } }), + + <l:@L> <s:string> =>? s[1..s.len() -1].parse().map_err(|_| ParseError::User { + error: FError { + location: l, + data: s.into(), + kind: FErrorKind::InvalidBoss, + } + }), } Date: NaiveDateTime = { @@ -165,7 +173,7 @@ match { r"\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d" => datetime, r"\d\d\d\d-\d\d-\d\d" => date, r"\w+" => word, - r#""[^"]*""# => regex, + r#""[^"]*""# => string, _ } |