From 06ad86b1e1c7f8ff95841e91e0557f67cbbde6d5 Mon Sep 17 00:00:00 2001 From: René Kijewski Date: Wed, 2 Aug 2023 10:21:28 +0200 Subject: parser: allow negative numbers in patterns --- askama_parser/src/lib.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'askama_parser/src/lib.rs') diff --git a/askama_parser/src/lib.rs b/askama_parser/src/lib.rs index 65d2eff..67f516c 100644 --- a/askama_parser/src/lib.rs +++ b/askama_parser/src/lib.rs @@ -191,7 +191,11 @@ fn bool_lit(i: &str) -> IResult<&str, &str> { } fn num_lit(i: &str) -> IResult<&str, &str> { - recognize(pair(digit1, opt(pair(char('.'), digit1))))(i) + recognize(tuple(( + opt(char('-')), + digit1, + opt(pair(char('.'), digit1)), + )))(i) } fn str_lit(i: &str) -> IResult<&str, &str> { -- cgit