Commit 087841a2 by Zachary Snow

fix generate default case printing

parent dcca974f
...@@ -34,10 +34,13 @@ instance Show GenItem where ...@@ -34,10 +34,13 @@ instance Show GenItem where
printf "begin%s\n%s\nend" printf "begin%s\n%s\nend"
(maybe "" (" : " ++) mx) (maybe "" (" : " ++) mx)
(indent $ unlines' $ map show i) (indent $ unlines' $ map show i)
show (GenCase e c md) = show (GenCase e cs def) =
printf "case (%s)\n%s%s\nendcase" (show e) printf "case (%s)\n%s%s\nendcase" (show e) bodyStr defStr
(indent $ unlines' $ map showCase c) where
(maybe "" (indent . indent . show) md) bodyStr = indent $ unlines' $ map showCase cs
defStr = case def of
Nothing -> ""
Just c -> printf "\n\tdefault: %s" (show c)
show (GenIf e a GenNull) = printf "if (%s) %s" (show e) (show a) show (GenIf e a GenNull) = printf "if (%s) %s" (show e) (show a)
show (GenIf e a b ) = printf "if (%s) %s\nelse %s" (show e) (show a) (show b) show (GenIf e a b ) = printf "if (%s) %s\nelse %s" (show e) (show a) (show b)
show (GenFor (new, x1, e1) c (x2, o2, e2) mx is) = show (GenFor (new, x1, e1) c (x2, o2, e2) mx is) =
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment