aboutsummaryrefslogtreecommitdiff
path: root/src/fexpr/grammar.lalrpop
diff options
context:
space:
mode:
authorDaniel <kingdread@gmx.de>2020-06-12 13:03:44 +0200
committerDaniel <kingdread@gmx.de>2020-06-12 13:03:44 +0200
commit600683df83cea34f10341d7fe2a328559c578379 (patch)
tree21a60e9fca6ad7200cc3f0d000eb2c71b961287f /src/fexpr/grammar.lalrpop
parent47348c960072d62031490e923d7fe5a9122ff1cc (diff)
downloadraidgrep-600683df83cea34f10341d7fe2a328559c578379.tar.gz
raidgrep-600683df83cea34f10341d7fe2a328559c578379.tar.bz2
raidgrep-600683df83cea34f10341d7fe2a328559c578379.zip
allow durations with minutes as well
This allows things like "2m 50s" but also "5m". humantime would allow even more, but we need a regular expression to catch them for lalrpop, so for now this are the only two supported formats (together with "50s"). Considering the usual time of fights in GW2, I doubt we'll need anything bigger than minutes.
Diffstat (limited to 'src/fexpr/grammar.lalrpop')
-rw-r--r--src/fexpr/grammar.lalrpop4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/fexpr/grammar.lalrpop b/src/fexpr/grammar.lalrpop
index c2df097..9584536 100644
--- a/src/fexpr/grammar.lalrpop
+++ b/src/fexpr/grammar.lalrpop
@@ -182,7 +182,7 @@ Date: DateTime<Utc> = {
}
Duration: Duration = {
- duration => Duration::seconds(<>[..<>.len() - 1].parse().unwrap()),
+ duration => Duration::from_std(humantime::parse_duration(<>).unwrap()).unwrap(),
}
CompOp: filters::values::CompOp = {
@@ -226,7 +226,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"\d+s" => duration,
+ r"((\d+m ?)?\d+s)|(\d+m)" => duration,
r"[[:alpha:]][\w]*" => word,
r#""[^"]*""# => string,