From d564421e9fb71da21ef02d8b711af0e8471bb602 Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 29 Apr 2020 15:54:45 +0200 Subject: 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. --- src/fexpr/grammar.lalrpop | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src') 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 = { } Regex: Regex = { - =>? Regex::new(&s[1..s.len() - 1]).map_err(|error| ParseError::User { + =>? 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, } }), + + =>? 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, _ } -- cgit v1.2.3