diff options
author | Eevee (Alex Munroe) <eevee.git@veekun.com> | 2013-08-14 18:37:36 -0700 |
---|---|---|
committer | Eevee (Alex Munroe) <eevee.git@veekun.com> | 2013-08-23 15:54:31 -0700 |
commit | 444ac8f8b4e5d167050b3d0eb0869bce5335aa33 (patch) | |
tree | 75edabe71167ca49939bd10945911f872890c76d | |
parent | ea5bad0e55884234f08ce58750d72c3f10571bdd (diff) | |
download | pyscss-444ac8f8b4e5d167050b3d0eb0869bce5335aa33.tar.gz |
Refactor binary op rules a bit.
-rw-r--r-- | scss/expression.parsley | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/scss/expression.parsley b/scss/expression.parsley index e839ac0..77b41fa 100644 --- a/scss/expression.parsley +++ b/scss/expression.parsley @@ -53,22 +53,34 @@ and_test = not_test:head ( not_test = comparison | ( 'n' 'o' 't' not_test:node -> NotOp(node) ) comparison = add_expr:node ( - ows '<' ows add_expr:operand (-> BinaryOp(operator.lt, node, operand)):node - | ows '>' ows add_expr:operand (-> BinaryOp(operator.gt, node, operand)):node - | ows '<' '=' ows add_expr:operand (-> BinaryOp(operator.le, node, operand)):node - | ows '>' '=' ows add_expr:operand (-> BinaryOp(operator.ge, node, operand)):node - | ows '=' '=' ows add_expr:operand (-> BinaryOp(operator.eq, node, operand)):node - | ows '!' '=' ows add_expr:operand (-> BinaryOp(operator.ne, node, operand)):node + ows ( + '<' '=' !(operator.le):op + | '>' '=' !(operator.ge):op + | '<' !(operator.lt):op + | '>' !(operator.gt):op + | '=' '=' !(operator.eq):op + | '!' '=' !(operator.ne):op + ) ows + add_expr:operand + !(BinaryOp(op, node, operand)):node )* -> node add_expr = mult_expr:node ( - ows '+' ows mult_expr:operand (-> BinaryOp(operator.add, node, operand)):node - | ows '-' ows mult_expr:operand (-> BinaryOp(operator.sub, node, operand)):node + ows ( + '+' !(operator.add):op + | '-' !(operator.sub):op + ) ows + mult_expr:operand + !(BinaryOp(op, node, operand)):node )* -> node mult_expr = unary_expr:node ( - ows '*' ows unary_expr:operand (-> BinaryOp(operator.mul, node, operand)):node - | ows '/' ows unary_expr:operand (-> BinaryOp(operator.truediv, node, operand)):node + ows ( + '*' !(operator.mul):op + | '/' !(operator.truediv):op + ) ows + unary_expr:operand + !(BinaryOp(op, node, operand)):node )* -> node unary_expr = ( |