diff options
author | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2023-09-28 15:15:45 +0200 |
---|---|---|
committer | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2023-09-28 15:40:57 +0200 |
commit | 5ab8813fe29cfbc034b6f99fc36064dcd1a5bd3e (patch) | |
tree | f4b8d1b43520675eb4164ed7d29154530df4d4eb /askama_parser/src/node.rs | |
parent | c8530493a1b6e773a4d2a16d01e7ed69ae160621 (diff) | |
download | askama-5ab8813fe29cfbc034b6f99fc36064dcd1a5bd3e.tar.gz askama-5ab8813fe29cfbc034b6f99fc36064dcd1a5bd3e.tar.bz2 askama-5ab8813fe29cfbc034b6f99fc36064dcd1a5bd3e.zip |
Yield a parser error when defining a macro named 'super'
Diffstat (limited to 'askama_parser/src/node.rs')
-rw-r--r-- | askama_parser/src/node.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/askama_parser/src/node.rs b/askama_parser/src/node.rs index 1ed4e40..a72c2fb 100644 --- a/askama_parser/src/node.rs +++ b/askama_parser/src/node.rs @@ -474,16 +474,17 @@ impl<'a> Macro<'a> { ))); let (i, (contents, (_, pws2, _, nws2))) = end(i)?; - assert_ne!(name, "super", "invalid macro name 'super'"); - - let params = params.unwrap_or_default(); + if name == "super" { + // TODO: yield a a better error message here + return Err(nom::Err::Failure(Error::new(i, ErrorKind::Fail))); + } Ok(( i, Self { ws1: Ws(pws1, nws1), name, - args: params, + args: params.unwrap_or_default(), nodes: contents, ws2: Ws(pws2, nws2), }, |