aboutsummaryrefslogtreecommitdiffstats
path: root/askama_parser/src/lib.rs
diff options
context:
space:
mode:
authorLibravatar René Kijewski <rene.kijewski@fu-berlin.de>2023-08-02 10:21:28 +0200
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2023-08-02 11:09:05 +0200
commit06ad86b1e1c7f8ff95841e91e0557f67cbbde6d5 (patch)
tree54dac9d6dc8a9a8e4104c2ed533d19e0f926780d /askama_parser/src/lib.rs
parent50745e41c28eb9248045164e3615602225788019 (diff)
downloadaskama-06ad86b1e1c7f8ff95841e91e0557f67cbbde6d5.tar.gz
askama-06ad86b1e1c7f8ff95841e91e0557f67cbbde6d5.tar.bz2
askama-06ad86b1e1c7f8ff95841e91e0557f67cbbde6d5.zip
parser: allow negative numbers in patterns
Diffstat (limited to 'askama_parser/src/lib.rs')
-rw-r--r--askama_parser/src/lib.rs6
1 files changed, 5 insertions, 1 deletions
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> {