From 4fcdaff32c666633f51741b5c85607e3e0615380 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Thu, 18 May 2017 16:10:55 -0700 Subject: [PATCH] Revise binaryOperator assignment --- src/Language/Python/Syntax.hs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Language/Python/Syntax.hs b/src/Language/Python/Syntax.hs index c6930f0ba..ef3173deb 100644 --- a/src/Language/Python/Syntax.hs +++ b/src/Language/Python/Syntax.hs @@ -86,10 +86,9 @@ unaryOperator = makeTerm <$> symbol UnaryOperator <*> children ( Expression.UCo <|> Expression.UPlus <$> (symbol AnonPlus *> expression)) binaryOperator :: HasCallStack => Assignment (Node Grammar) (Term Syntax Location) -binaryOperator = symbol BinaryOperator >>= \ location -> children (expression >>= \ lexpression -> - makeTerm location <$> arithmetic lexpression - <|> makeTerm location <$> bitwise lexpression) +binaryOperator = symbol BinaryOperator >>= \ location -> exit location arithmetic <|> exit location bitwise where + exit location constructor = children (expression >>= \ lexpression -> makeTerm location <$> constructor lexpression) arithmetic lexpression = symbol AnonPlus *> (Expression.Plus lexpression <$> expression) <|> symbol AnonMinus *> (Expression.Minus lexpression <$> expression) <|> symbol AnonStar *> (Expression.Times lexpression <$> expression)