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:
parent
b0e4c60d6e
commit
4fcdaff32c
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user