aboutsummaryrefslogtreecommitdiffstats
path: root/askama_shared/src/parser.rs
diff options
context:
space:
mode:
authorLibravatar René Kijewski <kijewski@library.vetmed.fu-berlin.de>2021-10-11 16:39:23 +0200
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2021-10-12 20:09:55 +0200
commitb6ae443103c546fce5dbfbbe5f25a0d030a33beb (patch)
treeeb0fafcaf0449120e5849ecfe26f95f2c2779528 /askama_shared/src/parser.rs
parent5c4d169a41969f0823ac549b72c8a7af8ecbea9f (diff)
downloadaskama-b6ae443103c546fce5dbfbbe5f25a0d030a33beb.tar.gz
askama-b6ae443103c546fce5dbfbbe5f25a0d030a33beb.tar.bz2
askama-b6ae443103c546fce5dbfbbe5f25a0d030a33beb.zip
Remove custom ParserError type
Diffstat (limited to 'askama_shared/src/parser.rs')
-rw-r--r--askama_shared/src/parser.rs8
1 files changed, 3 insertions, 5 deletions
diff --git a/askama_shared/src/parser.rs b/askama_shared/src/parser.rs
index 995fc19..3c91855 100644
--- a/askama_shared/src/parser.rs
+++ b/askama_shared/src/parser.rs
@@ -187,7 +187,7 @@ struct State<'a> {
loop_depth: Cell<usize>,
}
-fn take_content<'a>(i: &'a [u8], s: &State<'_>) -> ParserError<'a, Node<'a>> {
+fn take_content<'a>(i: &'a [u8], s: &State<'_>) -> IResult<&'a [u8], Node<'a>> {
use crate::parser::ContentState::*;
let bs = s.syntax.block_start.as_bytes()[0];
let be = s.syntax.block_start.as_bytes()[1];
@@ -230,7 +230,7 @@ fn take_content<'a>(i: &'a [u8], s: &State<'_>) -> ParserError<'a, Node<'a>> {
}
}
-fn identifier(input: &[u8]) -> ParserError<'_, &str> {
+fn identifier(input: &[u8]) -> IResult<&[u8], &str> {
if !nom::character::is_alphabetic(input[0]) && input[0] != b'_' && !non_ascii(input[0]) {
return Err(nom::Err::Error(nom::error::Error::new(
input,
@@ -475,7 +475,7 @@ fn macro_arguments(i: &[u8]) -> IResult<&[u8], &str> {
delimited(char('('), nested_parenthesis, char(')'))(i)
}
-fn nested_parenthesis(i: &[u8]) -> ParserError<'_, &str> {
+fn nested_parenthesis(i: &[u8]) -> IResult<&[u8], &str> {
let mut nested = 0;
let mut last = 0;
let mut in_str = false;
@@ -1636,5 +1636,3 @@ mod tests {
);
}
}
-
-type ParserError<'a, T> = Result<(&'a [u8], T), nom::Err<nom::error::Error<&'a [u8]>>>;