aboutsummaryrefslogtreecommitdiff
path: root/AST.hs
diff options
context:
space:
mode:
Diffstat (limited to 'AST.hs')
-rw-r--r--AST.hs5
1 files changed, 5 insertions, 0 deletions
diff --git a/AST.hs b/AST.hs
index 3e80830..5217d46 100644
--- a/AST.hs
+++ b/AST.hs
@@ -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)) =