diff options
Diffstat (limited to 'askama_derive')
-rw-r--r-- | askama_derive/src/parser.rs | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/askama_derive/src/parser.rs b/askama_derive/src/parser.rs index fb591d4..96e0f09 100644 --- a/askama_derive/src/parser.rs +++ b/askama_derive/src/parser.rs @@ -623,15 +623,20 @@ named!(block_macro<Input, Node>, do_parse!( pws2: opt!(tag_s!("-")) >> ws!(tag_s!("endmacro")) >> nws2: opt!(tag_s!("-")) >> - (Node::Macro( - name, - Macro { - ws1: WS(pws1.is_some(), nws1.is_some()), - args: params, - nodes: contents, - ws2: WS(pws2.is_some(), nws2.is_some()) - } - )) + ({ + if name == "super" { + panic!("invalid macro name 'super'"); + } + Node::Macro( + name, + Macro { + ws1: WS(pws1.is_some(), nws1.is_some()), + args: params, + nodes: contents, + ws2: WS(pws2.is_some(), nws2.is_some()) + } + ) + }) )); named!(block_node<Input, Node>, do_parse!( |