diff options
Diffstat (limited to 'AST.hs')
-rw-r--r-- | AST.hs | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -27,6 +27,7 @@ data Statement | SAs AsExpression Expression | SIf Expression Block Block | SWhile Expression Block + | SBreak Int | SReturn (Maybe Expression) | SExpr Expression deriving (Show, Eq) @@ -111,6 +112,10 @@ instance Pretty Statement where "if " ++ prettyI i c ++ " " ++ prettyI i b1 ++ " else " ++ prettyI i b2 prettyI i (SWhile c b) = "while " ++ prettyI i c ++ " " ++ prettyI i b + prettyI _ (SBreak 0) = + "break;" + prettyI _ (SBreak n) = + "break " ++ show n ++ ";" prettyI _ (SReturn Nothing) = "return;" prettyI i (SReturn (Just e)) = |