Skip to content

Commit

Permalink
Fixed vincenthz#8: Distinguish between infix operation and combinatio…
Browse files Browse the repository at this point in the history
…n of infix operation
  • Loading branch information
dvekeman committed Oct 4, 2016
1 parent 781a70d commit 4f7924f
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions Language/Java/Parser.hs
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,10 @@ infixExp = do

infixExpSuffix :: P (Exp -> Exp)
infixExpSuffix =
(do
op <- infixCombineOp
ie2 <- infixExp
return $ \ie1 -> BinOp ie1 op ie2) <|>
(do op <- infixOp
e2 <- unaryExp
return $ \e1 -> BinOp e1 op e2) <|>
Expand Down Expand Up @@ -1012,6 +1016,15 @@ assignOp =
(tok Op_CaretE >> return XorA ) <|>
(tok Op_OrE >> return OrA )

infixCombineOp :: P Op
infixCombineOp =
(tok Op_And >> return And ) <|>
(tok Op_Caret >> return Xor ) <|>
(tok Op_Or >> return Or ) <|>
(tok Op_AAnd >> return CAnd ) <|>
(tok Op_OOr >> return COr )


infixOp :: P Op
infixOp =
(tok Op_Star >> return Mult ) <|>
Expand All @@ -1036,12 +1049,7 @@ infixOp =
(tok Op_LThanE >> return LThanE ) <|>
(tok Op_GThanE >> return GThanE ) <|>
(tok Op_Equals >> return Equal ) <|>
(tok Op_BangE >> return NotEq ) <|>
(tok Op_And >> return And ) <|>
(tok Op_Caret >> return Xor ) <|>
(tok Op_Or >> return Or ) <|>
(tok Op_AAnd >> return CAnd ) <|>
(tok Op_OOr >> return COr )
(tok Op_BangE >> return NotEq )


----------------------------------------------------------------------------
Expand Down

0 comments on commit 4f7924f

Please sign in to comment.