aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2017-02-17 14:58:40 +0100
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2017-02-17 14:58:40 +0100
commit3003e5865801d912c075fc0c04412a8a65956d96 (patch)
tree47805166f9d27a2be1f23298c204323f160042fe
parent1121af3dd03bb000b935036232b11ae4f284195e (diff)
downloadaskama-3003e5865801d912c075fc0c04412a8a65956d96.tar.gz
askama-3003e5865801d912c075fc0c04412a8a65956d96.tar.bz2
askama-3003e5865801d912c075fc0c04412a8a65956d96.zip
Add support for most binary operators
-rw-r--r--askama/src/parser.rs9
1 files changed, 8 insertions, 1 deletions
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<Node>, do_parse!(
tag_s!("{{") >>