From 600683df83cea34f10341d7fe2a328559c578379 Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 12 Jun 2020 13:03:44 +0200 Subject: 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. --- src/fexpr/grammar.lalrpop | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/fexpr') 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 = { } 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, -- cgit v1.2.3