diff options
author | Adam Chlipala <adamc@hcoop.net> | 2008-07-24 15:02:03 -0400 |
---|---|---|
committer | Adam Chlipala <adamc@hcoop.net> | 2008-07-24 15:02:03 -0400 |
commit | 92af3391b64df0a2082006c39ed1335dd1bf7256 (patch) | |
tree | 88b7d3545d1b46e288c0f1f0d41a9be6abdb0ce1 /src/source_print.sml | |
parent | 84f7c995c0ad553d3fc91d1b31f320fc9de58d79 (diff) |
Start of datatype support
Diffstat (limited to 'src/source_print.sml')
-rw-r--r-- | src/source_print.sml | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/source_print.sml b/src/source_print.sml index ba9219be..b69b0b58 100644 --- a/src/source_print.sml +++ b/src/source_print.sml @@ -241,6 +241,18 @@ fun p_exp' par (e, _) = and p_exp e = p_exp' false e +fun p_datatype (x, cons) = + box [string "datatype", + space, + string x, + space, + string "=", + space, + p_list_sep (box [space, string "|", space]) + (fn (x, NONE) => string x + | (x, SOME t) => box [string x, space, string "of", space, p_con t]) + cons] + fun p_sgn_item (sgi, _) = case sgi of SgiConAbs (x, k) => box [string "con", @@ -268,6 +280,17 @@ fun p_sgn_item (sgi, _) = string "=", space, p_con c] + | SgiDatatype x => p_datatype x + | SgiDatatypeImp (x, ms, x') => + box [string "datatype", + space, + string x, + space, + string "=", + space, + string "datatype", + space, + p_list_sep (string ".") string (ms @ [x'])] | SgiVal (x, c) => box [string "val", space, string x, @@ -371,6 +394,17 @@ fun p_decl ((d, _) : decl) = string "=", space, p_con c] + | DDatatype x => p_datatype x + | DDatatypeImp (x, ms, x') => + box [string "datatype", + space, + string x, + space, + string "=", + space, + string "datatype", + space, + p_list_sep (string ".") string (ms @ [x'])] | DVal vi => box [string "val", space, p_vali vi] |