From 57181752917c67a007c86fdbe133d2c64db7c749 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Thu, 28 Sep 2023 15:20:04 +0200 Subject: Move Level into the crate root --- askama_parser/src/expr.rs | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) (limited to 'askama_parser/src/expr.rs') diff --git a/askama_parser/src/expr.rs b/askama_parser/src/expr.rs index ad0c19e..d676e85 100644 --- a/askama_parser/src/expr.rs +++ b/askama_parser/src/expr.rs @@ -10,7 +10,7 @@ use nom::sequence::{pair, preceded, terminated, tuple}; use nom::{error_position, IResult}; use super::{ - char_lit, identifier, not_ws, num_lit, path_or_identifier, str_lit, ws, PathOrIdentifier, + char_lit, identifier, not_ws, num_lit, path_or_identifier, str_lit, ws, Level, PathOrIdentifier, }; macro_rules! expr_prec_layer { @@ -363,18 +363,3 @@ impl<'a> Suffix<'a> { map(preceded(take_till(not_ws), char('?')), |_| Self::Try)(i) } } - -#[derive(Clone, Copy, Default)] -pub(crate) struct Level(u8); - -impl Level { - fn nest(self, i: &str) -> Result>> { - if self.0 >= Self::MAX_EXPR_DEPTH { - return Err(nom::Err::Failure(error_position!(i, ErrorKind::TooLarge))); - } - - Ok(Level(self.0 + 1)) - } - - const MAX_EXPR_DEPTH: u8 = 64; -} -- cgit