From 3003e5865801d912c075fc0c04412a8a65956d96 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Fri, 17 Feb 2017 14:58:40 +0100 Subject: Add support for most binary operators --- askama/src/parser.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/askama/src/parser.rs b/askama/src/parser.rs index 7d67f86..425f148 100644 --- a/askama/src/parser.rs +++ b/askama/src/parser.rs @@ -125,9 +125,16 @@ macro_rules! expr_prec_layer { } expr_prec_layer!(expr_muldivmod, expr_single, "*", "/", "%"); -expr_prec_layer!(expr_any, expr_muldivmod, +expr_prec_layer!(expr_addsub, expr_muldivmod, "+", "-"); +expr_prec_layer!(expr_shifts, expr_addsub, ">>", "<<"); +expr_prec_layer!(expr_band, expr_shifts, "&"); +expr_prec_layer!(expr_bxor, expr_band, "^"); +expr_prec_layer!(expr_bor, expr_bxor, "|"); +expr_prec_layer!(expr_compare, expr_bor, "==", "!=", ">=", ">", "<=", "<" ); +expr_prec_layer!(expr_and, expr_compare, "&&"); +expr_prec_layer!(expr_any, expr_and, "||"); named!(expr_node, do_parse!( tag_s!("{{") >> -- cgit