diff options
Diffstat (limited to 'Sil/Syntax.icl')
-rw-r--r-- | Sil/Syntax.icl | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/Sil/Syntax.icl b/Sil/Syntax.icl index e28d616..ce69920 100644 --- a/Sil/Syntax.icl +++ b/Sil/Syntax.icl @@ -27,16 +27,16 @@ instance toString Arg where toString arg = arg.arg_type <+ " " <+ arg.arg_name instance toString Expression where - toString (Name n) = n - toString (Literal lit) = toString lit - toString (App n args) = n <+ "(" <+ printersperse ", " args <+ ")" - 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 (Field f e) = "(" <+ e <+ ")." <+ f + toString (Name _ n) = n + toString (Literal _ lit) = toString lit + toString (App _ n args) = n <+ "(" <+ printersperse ", " args <+ ")" + 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 (Field _ f e) = "(" <+ e <+ ")." <+ f instance toString Op1 where @@ -77,6 +77,17 @@ where getPos (While p _ _) = p getPos (MachineStm p _) = p +instance getPos Expression +where + getPos (Name p _) = p + getPos (Literal p _) = p + getPos (App p _ _) = p + getPos (BuiltinApp p _ _) = p + getPos (BuiltinApp2 p _ _ _) = p + getPos (Tuple p _ _) = p + getPos (List p _ _) = p + getPos (Field p _ _) = p + instance allStatements Program where allStatements p = concatMap allStatements p.p_funs |