diff options
Diffstat (limited to 'askama_derive/src')
-rw-r--r-- | askama_derive/src/parser.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/askama_derive/src/parser.rs b/askama_derive/src/parser.rs index d5cea5b..8b5ec4e 100644 --- a/askama_derive/src/parser.rs +++ b/askama_derive/src/parser.rs @@ -364,7 +364,14 @@ named!(parse_template<Vec<Node<'a>>>, many0!(alt!( pub fn parse(src: &str) -> Vec<Node> { match parse_template(src.as_bytes()) { - IResult::Done(_, res) => res, + IResult::Done(left, res) => { + if left.len() > 0 { + let s = str::from_utf8(left).unwrap(); + panic!("unable to parse template:\n\n{:?}", s); + } else { + res + } + }, IResult::Error(err) => panic!("problems parsing template source: {}", err), IResult::Incomplete(_) => panic!("parsing incomplete"), } |