aboutsummaryrefslogtreecommitdiffstats
path: root/askama_parser/src/node.rs
diff options
context:
space:
mode:
authorLibravatar René Kijewski <rene.kijewski@fu-berlin.de>2023-09-28 17:09:29 +0200
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2023-09-28 17:28:26 +0200
commit238e4bbad7712ccc3a3ea4a5b09c63bd147c692e (patch)
tree6cf335c2365a99115d931e4657576d902526bdb1 /askama_parser/src/node.rs
parent36f4442978674a79aaebefcd4f04c7bfe6fe54c4 (diff)
downloadaskama-238e4bbad7712ccc3a3ea4a5b09c63bd147c692e.tar.gz
askama-238e4bbad7712ccc3a3ea4a5b09c63bd147c692e.tar.bz2
askama-238e4bbad7712ccc3a3ea4a5b09c63bd147c692e.zip
Limit nesting in parser nodes, too
Diffstat (limited to '')
-rw-r--r--askama_parser/src/node.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/askama_parser/src/node.rs b/askama_parser/src/node.rs
index f25f25a..1909f6c 100644
--- a/askama_parser/src/node.rs
+++ b/askama_parser/src/node.rs
@@ -47,7 +47,7 @@ impl<'a> Node<'a> {
}
fn parse(i: &'a str, s: &State<'_>) -> IResult<&'a str, Self> {
- let mut p = tuple((
+ let mut p = delimited(
|i| s.tag_block_start(i),
alt((
map(Call::parse, Self::Call),
@@ -65,9 +65,13 @@ impl<'a> Node<'a> {
|i| Self::r#continue(i, s),
)),
cut(|i| s.tag_block_end(i)),
- ));
- let (i, (_, contents, _)) = p(i)?;
- Ok((i, contents))
+ );
+
+ s.nest(i)?;
+ let result = p(i);
+ s.leave();
+
+ result
}
fn r#break(i: &'a str, s: &State<'_>) -> IResult<&'a str, Self> {