aboutsummaryrefslogtreecommitdiff
path: root/Sil/Syntax.icl
diff options
context:
space:
mode:
authorCamil Staps2021-01-04 20:27:45 +0100
committerCamil Staps2021-01-04 20:27:45 +0100
commit88de5784428bec9a4b32bdf447c160da29b3745e (patch)
tree4b5a52c8fe2560e98aca0d74ec8dcd5cb09b2b70 /Sil/Syntax.icl
parentFix error reporting for illegal command line arguments (diff)
Make up to date
Diffstat (limited to 'Sil/Syntax.icl')
-rw-r--r--Sil/Syntax.icl33
1 files changed, 16 insertions, 17 deletions
diff --git a/Sil/Syntax.icl b/Sil/Syntax.icl
index ce69920..c2baf70 100644
--- a/Sil/Syntax.icl
+++ b/Sil/Syntax.icl
@@ -6,7 +6,6 @@ import StdString
import StdTuple
import Data.List
-import Data.Maybe
import Text
import Sil.Types
@@ -15,13 +14,13 @@ import Sil.Util.Printer
instance toString Statement
where
- toString (Declaration _ n a) = n <+ " := " <+ a <+ ";"
- toString (Application _ e) = toString e <+ ";"
- toString (Return _ Nothing) = "return;"
- toString (Return _ (Just a)) = "return " <+ a <+ ";"
- toString (If _ bs e) = "if ..."
- toString (MachineStm _ s) = "|~" <+ s
- toString _ = "<<unimplemented Statement>>"
+ toString (Declaration _ n a) = n <+ " := " <+ a <+ ";"
+ toString (Application _ e) = toString e <+ ";"
+ toString (Return _ ?None) = "return;"
+ toString (Return _ (?Just a)) = "return " <+ a <+ ";"
+ toString (If _ bs e) = "if ..."
+ toString (MachineStm _ s) = "|~" <+ s
+ toString _ = "<<unimplemented Statement>>"
instance toString Arg where toString arg = arg.arg_type <+ " " <+ arg.arg_name
@@ -33,9 +32,9 @@ where
toString (BuiltinApp _ op e) = op <+ "(" <+ e <+ ")"
toString (BuiltinApp2 _ e1 op e2) = "(" <+ e1 <+ ") " <+ op <+ " (" <+ e2 <+ ")"
toString (Tuple _ _ es) = "(" <+ printersperse ", " es <+ ")"
- toString (List _ (Just t) []) = "[" <+ t <+ "]"
- toString (List _ (Just t) es) = "[" <+ t <+ ":" <+ printersperse ", " es <+ "]"
- toString (List _ Nothing es) = "[" <+ printersperse ", " es <+ "]"
+ toString (List _ (?Just t) []) = "[" <+ t <+ "]"
+ toString (List _ (?Just t) es) = "[" <+ t <+ ":" <+ printersperse ", " es <+ "]"
+ toString (List _ ?None es) = "[" <+ printersperse ", " es <+ "]"
toString (Field _ f e) = "(" <+ e <+ ")." <+ f
instance toString Op1
@@ -102,8 +101,8 @@ where
allStatements st=:(Declaration _ _ _) = [st]
allStatements st=:(Application _ _) = [st]
allStatements st=:(Return _ _) = [st]
- allStatements st=:(If _ bs Nothing) = [st:concatMap (allStatements o snd) bs]
- allStatements st=:(If _ bs (Just e)) = [st:allStatements e ++ concatMap (allStatements o snd) bs]
+ allStatements st=:(If _ bs ?None) = [st:concatMap (allStatements o snd) bs]
+ allStatements st=:(If _ bs (?Just e)) = [st:allStatements e ++ concatMap (allStatements o snd) bs]
allStatements st=:(While _ _ cb) = [st:allStatements cb]
allStatements st=:(MachineStm _ _) = [st]
@@ -114,10 +113,10 @@ where allCodeBlocks cb = [cb:concatMap allCodeBlocks cb.cb_content]
instance allCodeBlocks Statement
where
- allCodeBlocks (If _ bs Nothing) = concatMap (allCodeBlocks o snd) bs
- allCodeBlocks (If _ bs (Just e)) = [e:concatMap (allCodeBlocks o snd) bs]
- allCodeBlocks (While _ _ cb) = [cb]
- allCodeBlocks _ = []
+ allCodeBlocks (If _ bs ?None) = concatMap (allCodeBlocks o snd) bs
+ allCodeBlocks (If _ bs (?Just e)) = [e:concatMap (allCodeBlocks o snd) bs]
+ allCodeBlocks (While _ _ cb) = [cb]
+ allCodeBlocks _ = []
instance allLocals Function
where