diff options
author | tomsmeding <tom.smeding@gmail.com> | 2017-02-03 16:30:40 +0100 |
---|---|---|
committer | tomsmeding <tom.smeding@gmail.com> | 2017-02-03 16:30:40 +0100 |
commit | e72a2b8e778fff230848769643a125ae995fbe58 (patch) | |
tree | 23c2aa9b0640b5c2cf57f7e035d5cb6ae33b8e19 /ast.hs | |
parent | 8eb3171845497a1d6025a3f59c09048d1975cd12 (diff) |
Diffstat (limited to 'ast.hs')
-rw-r--r-- | ast.hs | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -49,6 +49,7 @@ data BinaryOperator = Plus | Minus | Times | Divide | Modulo | Equal | Unequal | Greater | Less | GEqual | LEqual | BoolAnd | BoolOr + | Index deriving (Show, Eq) data UnaryOperator @@ -151,6 +152,7 @@ instance PShow BinaryOperator where pshow LEqual = "<=" pshow BoolAnd = "&&" pshow BoolOr = "||" + pshow Index = "[~]" instance PShow UnaryOperator where pshow Negate = "-" @@ -163,6 +165,8 @@ instance PShow Expression where pshow (ExLit lit Nothing) = pshow lit pshow (ExLit lit (Just t)) = concat ["(", pshow lit, " :: ", pshow t, ")"] pshow (ExCast t ex) = concat ["cast(", pshow t, ")(", pshow ex, ")"] + pshow (ExBinOp Index a b Nothing) = concat ["(", pshow a, ")[", pshow b, "]"] + pshow (ExBinOp Index a b (Just t)) = concat ["((", pshow a, ")[", pshow b, "] :: ", pshow t, ")"] pshow (ExBinOp op a b Nothing) = concat ["(", pshow a, " ", pshow op, " ", pshow b, ")"] pshow (ExBinOp op a b (Just t)) = concat ["(", pshow a, " ", pshow op, " ", pshow b, " :: ", pshow t, ")"] pshow (ExUnOp op a Nothing) = concat [pshow op, pshow a] |