mirror of
https://github.com/askama-rs/askama.git
synced 2025-09-30 14:31:36 +00:00
refactor(parser): Simplify keyword parser
This commit is contained in:
parent
4319be2e52
commit
51322071fe
@ -315,11 +315,8 @@ fn skip_till<'a, 'b, O>(
|
||||
}
|
||||
}
|
||||
|
||||
fn keyword<'a>(k: &'a str) -> impl Parser<&'a str, &'a str, ErrorContext<'a>> {
|
||||
move |i: &'a str| -> ParseResult<'a> {
|
||||
let (j, v) = identifier.parse_next(i)?;
|
||||
if k == v { Ok((j, v)) } else { fail(i) }
|
||||
}
|
||||
fn keyword(k: &str) -> impl Parser<&str, &str, ErrorContext<'_>> {
|
||||
identifier.verify(move |v: &str| v == k)
|
||||
}
|
||||
|
||||
fn identifier(input: &str) -> ParseResult<'_> {
|
||||
|
Loading…
x
Reference in New Issue
Block a user