From 81429636eb295ec03ef35cf77648d1626970fd4e Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Sat, 21 Aug 2021 15:10:27 +0200 Subject: Upgrade to nom 7 --- askama_shared/src/parser.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'askama_shared/src/parser.rs') 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(mut inner: F) -> impl FnMut(I) -> IResult where F: FnMut(I) -> IResult, - I: InputTake + Clone + PartialEq + for<'a> Compare<&'a [u8; 1]>, + I: InputLength + InputTake + Clone + PartialEq + for<'a> Compare<&'a [u8; 1]>, E: ParseError, { 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)?; -- cgit