From 288b9133e1c756e5755affc556b57de6cba3bcd4 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Fri, 17 Feb 2017 17:12:15 +0100 Subject: Import alphanumeric from nom to simplify macro handling --- askama/src/parser.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/askama/src/parser.rs b/askama/src/parser.rs index e3758fe..b34492a 100644 --- a/askama/src/parser.rs +++ b/askama/src/parser.rs @@ -1,4 +1,4 @@ -use nom::{self, IResult}; +use nom::{self, alphanumeric, IResult}; use std::str; #[derive(Debug)] @@ -77,11 +77,11 @@ named!(expr_str_lit, map!( |s| Expr::StrLit(str::from_utf8(s).unwrap()) )); -named!(expr_var, map!(nom::alphanumeric, +named!(expr_var, map!(alphanumeric, |s| Expr::Var(str::from_utf8(s).unwrap()) )); -named!(target_single, map!(nom::alphanumeric, +named!(target_single, map!(alphanumeric, |s| Target::Name(str::from_utf8(s).unwrap()) )); @@ -92,7 +92,7 @@ fn expr_filtered(i: &[u8]) -> IResult<&[u8], Expr> { IResult::Done(left, res) => (left, res), }; while left[0] == b'|' { - match nom::alphanumeric(&left[1..]) { + match alphanumeric(&left[1..]) { IResult::Error(err) => { return IResult::Error(err); }, @@ -218,7 +218,7 @@ named!(block_block, do_parse!( tag_s!("{%") >> pws1: opt!(tag_s!("-")) >> ws!(tag_s!("block")) >> - name: ws!(nom::alphanumeric) >> + name: ws!(alphanumeric) >> nws1: opt!(tag_s!("-")) >> tag_s!("%}") >> contents: parse_template >> -- cgit