diff options
author | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2023-09-28 15:22:58 +0200 |
---|---|---|
committer | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2023-09-28 17:28:26 +0200 |
commit | 36f4442978674a79aaebefcd4f04c7bfe6fe54c4 (patch) | |
tree | 40c53ded4ae37734cfce66c51db19df27db4d02d /askama_parser/src/node.rs | |
parent | 57181752917c67a007c86fdbe133d2c64db7c749 (diff) | |
download | askama-36f4442978674a79aaebefcd4f04c7bfe6fe54c4.tar.gz askama-36f4442978674a79aaebefcd4f04c7bfe6fe54c4.tar.bz2 askama-36f4442978674a79aaebefcd4f04c7bfe6fe54c4.zip |
Require Expr::parse() callers to supply Level
Diffstat (limited to 'askama_parser/src/node.rs')
-rw-r--r-- | askama_parser/src/node.rs | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/askama_parser/src/node.rs b/askama_parser/src/node.rs index c3a59c6..f25f25a 100644 --- a/askama_parser/src/node.rs +++ b/askama_parser/src/node.rs @@ -101,7 +101,7 @@ impl<'a> Node<'a> { |i| s.tag_expr_start(i), cut(tuple(( opt(Whitespace::parse), - ws(Expr::parse), + ws(|i| Expr::parse(i, Level::default())), opt(Whitespace::parse), |i| s.tag_expr_end(i), ))), @@ -325,7 +325,7 @@ impl<'a> CondTest<'a> { ws(Target::parse), ws(char('=')), )), - ws(Expr::parse), + ws(|i| Expr::parse(i, Level::default())), ))), ); let (i, (target, expr)) = p(i)?; @@ -371,7 +371,10 @@ impl<'a> Loop<'a> { result } - let if_cond = preceded(ws(keyword("if")), cut(ws(Expr::parse))); + let if_cond = preceded( + ws(keyword("if")), + cut(ws(|i| Expr::parse(i, Level::default()))), + ); let else_block = |i| { let mut p = preceded( ws(keyword("else")), @@ -395,7 +398,7 @@ impl<'a> Loop<'a> { ws(Target::parse), ws(keyword("in")), cut(tuple(( - ws(Expr::parse), + ws(|i| Expr::parse(i, Level::default())), opt(if_cond), opt(Whitespace::parse), |i| s.tag_block_end(i), @@ -570,7 +573,7 @@ impl<'a> Match<'a> { opt(Whitespace::parse), ws(keyword("match")), cut(tuple(( - ws(Expr::parse), + ws(|i| Expr::parse(i, Level::default())), opt(Whitespace::parse), |i| s.tag_block_end(i), cut(tuple(( @@ -738,7 +741,10 @@ impl<'a> Let<'a> { ws(alt((keyword("let"), keyword("set")))), cut(tuple(( ws(Target::parse), - opt(preceded(ws(char('=')), ws(Expr::parse))), + opt(preceded( + ws(char('=')), + ws(|i| Expr::parse(i, Level::default())), + )), opt(Whitespace::parse), ))), )); |