aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--askama/src/parser.rs27
1 files changed, 14 insertions, 13 deletions
diff --git a/askama/src/parser.rs b/askama/src/parser.rs
index 5f14482..2654c9b 100644
--- a/askama/src/parser.rs
+++ b/askama/src/parser.rs
@@ -105,22 +105,23 @@ fn expr_filtered(i: &[u8]) -> IResult<&[u8], Expr> {
IResult::Done(left, expr)
}
-named!(expr_compare<Expr>, do_parse!(
- left: expr_filtered >>
- op: ws!(alt!(
- tag_s!("==") | tag_s!("!=") |
- tag_s!(">=") | tag_s!(">") |
- tag_s!("<=") | tag_s!("<")
- )) >>
- right: expr_filtered >>
- (Expr::BinOp(str::from_utf8(op).unwrap(),
- Box::new(left), Box::new(right)))
+named!(expr_single<Expr>, alt!(
+ expr_filtered |
+ expr_str_lit
));
named!(expr_any<Expr>, alt!(
- expr_compare |
- expr_filtered |
- expr_str_lit
+ do_parse!(
+ left: expr_single >>
+ op: ws!(alt!(
+ tag_s!("==") | tag_s!("!=") |
+ tag_s!(">=") | tag_s!(">") |
+ tag_s!("<=") | tag_s!("<")
+ )) >>
+ right: expr_single >>
+ (Expr::BinOp(str::from_utf8(op).unwrap(),
+ Box::new(left), Box::new(right)))
+ ) | expr_single
));
named!(expr_node<Node>, do_parse!(