mirror of
https://github.com/askama-rs/askama.git
synced 2025-10-02 15:25:19 +00:00
refactor(parser): Update for take_till->take_till0 rename
This commit is contained in:
parent
3ada145a41
commit
3fd1d905e6
@ -3,7 +3,7 @@ use std::str;
|
|||||||
|
|
||||||
use winnow::Parser;
|
use winnow::Parser;
|
||||||
use winnow::branch::alt;
|
use winnow::branch::alt;
|
||||||
use winnow::bytes::complete::take_till;
|
use winnow::bytes::take_till0;
|
||||||
use winnow::character::complete::digit1;
|
use winnow::character::complete::digit1;
|
||||||
use winnow::combinator::{consumed, cut_err, fail, map, not, opt, peek, recognize, value};
|
use winnow::combinator::{consumed, cut_err, fail, map, not, opt, peek, recognize, value};
|
||||||
use winnow::error::{ErrorKind, ParseError as _};
|
use winnow::error::{ErrorKind, ParseError as _};
|
||||||
@ -558,6 +558,6 @@ impl<'a> Suffix<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn r#try(i: &'a str) -> ParseResult<'a, Self> {
|
fn r#try(i: &'a str) -> ParseResult<'a, Self> {
|
||||||
map(preceded(take_till(not_ws), '?'), |_| Self::Try).parse_next(i)
|
map(preceded(take_till0(not_ws), '?'), |_| Self::Try).parse_next(i)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,8 +12,8 @@ use std::{fmt, str};
|
|||||||
|
|
||||||
use winnow::Parser;
|
use winnow::Parser;
|
||||||
use winnow::branch::alt;
|
use winnow::branch::alt;
|
||||||
use winnow::bytes::complete::{escaped, tag, take_till, take_while_m_n, take_while1};
|
use winnow::bytes::complete::{escaped, tag, take_while_m_n, take_while1};
|
||||||
use winnow::bytes::{any, take_till1};
|
use winnow::bytes::{any, take_till0, take_till1};
|
||||||
use winnow::character::complete::{one_of, satisfy};
|
use winnow::character::complete::{one_of, satisfy};
|
||||||
use winnow::combinator::{consumed, cut_err, fail, map, not, opt, recognize, value};
|
use winnow::combinator::{consumed, cut_err, fail, map, not, opt, recognize, value};
|
||||||
use winnow::error::{ErrorKind, FromExternalError};
|
use winnow::error::{ErrorKind, FromExternalError};
|
||||||
@ -289,7 +289,7 @@ fn not_ws(c: char) -> bool {
|
|||||||
fn ws<'a, O>(
|
fn ws<'a, O>(
|
||||||
inner: impl Parser<&'a str, O, ErrorContext<'a>>,
|
inner: impl Parser<&'a str, O, ErrorContext<'a>>,
|
||||||
) -> impl Parser<&'a str, O, ErrorContext<'a>> {
|
) -> impl Parser<&'a str, O, ErrorContext<'a>> {
|
||||||
delimited(take_till(not_ws), inner, take_till(not_ws))
|
delimited(take_till0(not_ws), inner, take_till0(not_ws))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Skips input until `end` was found, but does not consume it.
|
/// Skips input until `end` was found, but does not consume it.
|
||||||
@ -880,7 +880,7 @@ fn filter<'a>(
|
|||||||
i: &'a str,
|
i: &'a str,
|
||||||
level: &mut Level,
|
level: &mut Level,
|
||||||
) -> ParseResult<'a, (&'a str, Option<Vec<WithSpan<'a, Expr<'a>>>>)> {
|
) -> ParseResult<'a, (&'a str, Option<Vec<WithSpan<'a, Expr<'a>>>>)> {
|
||||||
let (j, _) = take_till(not_ws).parse_next(i)?;
|
let (j, _) = take_till0(not_ws).parse_next(i)?;
|
||||||
let had_spaces = i.len() != j.len();
|
let had_spaces = i.len() != j.len();
|
||||||
let (j, _) = ('|', not('|')).parse_next(j)?;
|
let (j, _) = ('|', not('|')).parse_next(j)?;
|
||||||
|
|
||||||
|
@ -2,8 +2,8 @@ use std::str;
|
|||||||
|
|
||||||
use winnow::Parser;
|
use winnow::Parser;
|
||||||
use winnow::branch::alt;
|
use winnow::branch::alt;
|
||||||
use winnow::bytes::any;
|
use winnow::bytes::complete::tag;
|
||||||
use winnow::bytes::complete::{tag, take_till};
|
use winnow::bytes::{any, take_till0};
|
||||||
use winnow::combinator::{
|
use winnow::combinator::{
|
||||||
consumed, cut_err, eof, fail, map, map_opt, not, opt, peek, recognize, value,
|
consumed, cut_err, eof, fail, map, map_opt, not, opt, peek, recognize, value,
|
||||||
};
|
};
|
||||||
@ -89,7 +89,7 @@ impl<'a> Node<'a> {
|
|||||||
let (j, tag) = preceded(
|
let (j, tag) = preceded(
|
||||||
|i| s.tag_block_start(i),
|
|i| s.tag_block_start(i),
|
||||||
peek(preceded(
|
peek(preceded(
|
||||||
(opt(Whitespace::parse), take_till(not_ws)),
|
(opt(Whitespace::parse), take_till0(not_ws)),
|
||||||
identifier,
|
identifier,
|
||||||
)),
|
)),
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user