diff options
author | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2021-08-21 15:10:27 +0200 |
---|---|---|
committer | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2021-08-21 19:13:38 +0200 |
commit | 81429636eb295ec03ef35cf77648d1626970fd4e (patch) | |
tree | 622dc2fa4f44a2b72443ca7a941d060898b261ff /askama_shared | |
parent | 47c6bca8ac0b7bf0ddf879130692029321db7ed9 (diff) | |
download | askama-81429636eb295ec03ef35cf77648d1626970fd4e.tar.gz askama-81429636eb295ec03ef35cf77648d1626970fd4e.tar.bz2 askama-81429636eb295ec03ef35cf77648d1626970fd4e.zip |
Upgrade to nom 7
Diffstat (limited to '')
-rw-r--r-- | askama_shared/Cargo.toml | 2 | ||||
-rw-r--r-- | askama_shared/src/parser.rs | 14 |
2 files changed, 10 insertions, 6 deletions
diff --git a/askama_shared/Cargo.toml b/askama_shared/Cargo.toml index 524f535..9fb6674 100644 --- a/askama_shared/Cargo.toml +++ b/askama_shared/Cargo.toml @@ -19,7 +19,7 @@ yaml = ["serde", "serde_yaml"] [dependencies] askama_escape = { version = "0.10", path = "../askama_escape" } humansize = { version = "1.1.0", optional = true } -nom = { version = "6.2.1", features = ["std"], default-features = false } # Gets us a newer version of bitvec https://github.com/Geal/nom/issues/1311#issuecomment-880902973 +nom = "7" num-traits = { version = "0.2.6", optional = true } proc-macro2 = "1" quote = "1" diff --git a/askama_shared/src/parser.rs b/askama_shared/src/parser.rs index 957c778..22f9a1e 100644 --- a/askama_shared/src/parser.rs +++ b/askama_shared/src/parser.rs @@ -5,7 +5,7 @@ use nom::combinator::{complete, cut, map, opt, recognize, value}; use nom::error::{Error, ParseError}; use nom::multi::{fold_many0, many0, many1, separated_list0, separated_list1}; use nom::sequence::{delimited, pair, preceded, terminated, tuple}; -use nom::{self, error_position, Compare, IResult, InputTake}; +use nom::{self, error_position, Compare, IResult, InputLength, InputTake}; use std::str; use crate::{CompileError, Syntax}; @@ -126,7 +126,7 @@ pub struct CondTest<'a> { fn ws<F, I, O, E>(mut inner: F) -> impl FnMut(I) -> IResult<I, O, E> where F: FnMut(I) -> IResult<I, O, E>, - I: InputTake + Clone + PartialEq + for<'a> Compare<&'a [u8; 1]>, + I: InputLength + InputTake + Clone + PartialEq + for<'a> Compare<&'a [u8; 1]>, E: ParseError<I>, { move |i: I| { @@ -388,9 +388,13 @@ fn target(i: &[u8]) -> IResult<&[u8], Target<'_>> { let mut targets = vec![first_target]; let (i, _) = cut(tuple(( - fold_many0(preceded(ws(tag(",")), target), (), |_, target| { - targets.push(target); - }), + fold_many0( + preceded(ws(tag(",")), target), + || (), + |_, target| { + targets.push(target); + }, + ), opt(ws(tag(","))), ws(cut(tag(")"))), )))(i)?; |