1
1
mirror of https://github.com/github/semantic.git synced 2024-12-21 05:41:54 +03:00

Revise binaryOperator assignment

This commit is contained in:
Rick Winfrey 2017-05-18 16:10:55 -07:00
parent b0e4c60d6e
commit 4fcdaff32c

View File

@ -86,10 +86,9 @@ unaryOperator = makeTerm <$> symbol UnaryOperator <*> children ( Expression.UCo
<|> Expression.UPlus <$> (symbol AnonPlus *> expression)) <|> Expression.UPlus <$> (symbol AnonPlus *> expression))
binaryOperator :: HasCallStack => Assignment (Node Grammar) (Term Syntax Location) binaryOperator :: HasCallStack => Assignment (Node Grammar) (Term Syntax Location)
binaryOperator = symbol BinaryOperator >>= \ location -> children (expression >>= \ lexpression -> binaryOperator = symbol BinaryOperator >>= \ location -> exit location arithmetic <|> exit location bitwise
makeTerm location <$> arithmetic lexpression
<|> makeTerm location <$> bitwise lexpression)
where where
exit location constructor = children (expression >>= \ lexpression -> makeTerm location <$> constructor lexpression)
arithmetic lexpression = symbol AnonPlus *> (Expression.Plus lexpression <$> expression) arithmetic lexpression = symbol AnonPlus *> (Expression.Plus lexpression <$> expression)
<|> symbol AnonMinus *> (Expression.Minus lexpression <$> expression) <|> symbol AnonMinus *> (Expression.Minus lexpression <$> expression)
<|> symbol AnonStar *> (Expression.Times lexpression <$> expression) <|> symbol AnonStar *> (Expression.Times lexpression <$> expression)