diff options
author | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2017-02-17 17:12:15 +0100 |
---|---|---|
committer | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2017-02-17 17:12:15 +0100 |
commit | 288b9133e1c756e5755affc556b57de6cba3bcd4 (patch) | |
tree | 9acdabf346a807ee8119b12acb73dfc4602865a4 | |
parent | 12ef905754d00d824e711610fca8bedc1b885e40 (diff) | |
download | askama-288b9133e1c756e5755affc556b57de6cba3bcd4.tar.gz askama-288b9133e1c756e5755affc556b57de6cba3bcd4.tar.bz2 askama-288b9133e1c756e5755affc556b57de6cba3bcd4.zip |
Import alphanumeric from nom to simplify macro handling
Diffstat (limited to '')
-rw-r--r-- | askama/src/parser.rs | 10 |
1 files 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<Expr>, map!( |s| Expr::StrLit(str::from_utf8(s).unwrap()) )); -named!(expr_var<Expr>, map!(nom::alphanumeric, +named!(expr_var<Expr>, map!(alphanumeric, |s| Expr::Var(str::from_utf8(s).unwrap()) )); -named!(target_single<Target>, map!(nom::alphanumeric, +named!(target_single<Target>, 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<Node>, 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 >> |