comparison src/mono_print.sml @ 288:4260ad920c36

Converting string to int
author Adam Chlipala <adamc@hcoop.net>
date Sun, 07 Sep 2008 11:33:13 -0400
parents c0e4ac23522d
children df00701f2323
comparison
equal deleted inserted replaced
287:3ed7a7c7b060 288:4260ad920c36
60 string (#1 (E.lookupDatatype env n) ^ "__" ^ Int.toString n) 60 string (#1 (E.lookupDatatype env n) ^ "__" ^ Int.toString n)
61 else 61 else
62 string (#1 (E.lookupDatatype env n))) 62 string (#1 (E.lookupDatatype env n)))
63 handle E.UnboundNamed _ => string ("UNBOUND_DATATYPE_" ^ Int.toString n)) 63 handle E.UnboundNamed _ => string ("UNBOUND_DATATYPE_" ^ Int.toString n))
64 | TFfi (m, x) => box [string "FFI(", string m, string ".", string x, string ")"] 64 | TFfi (m, x) => box [string "FFI(", string m, string ".", string x, string ")"]
65 | TOption t =>
66 (case #1 t of
67 TDatatype _ => p_typ env t
68 | TFfi ("Basis", "string") => p_typ env t
69 | _ => box [p_typ env t, string "*"])
65 70
66 and p_typ env = p_typ' false env 71 and p_typ env = p_typ' false env
67 72
68 fun p_enamed env n = 73 fun p_enamed env n =
69 (if !debug then 74 (if !debug then
93 PWild => string "_" 98 PWild => string "_"
94 | PVar (s, _) => string s 99 | PVar (s, _) => string s
95 | PPrim p => Prim.p_t p 100 | PPrim p => Prim.p_t p
96 | PCon (_, n, NONE) => p_patCon env n 101 | PCon (_, n, NONE) => p_patCon env n
97 | PCon (_, n, SOME p) => parenIf par (box [p_patCon env n, 102 | PCon (_, n, SOME p) => parenIf par (box [p_patCon env n,
98 space, 103 space,
99 p_pat' true env p]) 104 p_pat' true env p])
100 | PRecord xps => 105 | PRecord xps =>
101 box [string "{", 106 box [string "{",
102 p_list_sep (box [string ",", space]) (fn (x, p, _) => 107 p_list_sep (box [string ",", space]) (fn (x, p, _) =>
103 box [string x, 108 box [string x,
104 space, 109 space,
105 string "=", 110 string "=",
106 space, 111 space,
107 p_pat env p]) xps, 112 p_pat env p]) xps,
108 string "}"] 113 string "}"]
114 | PNone _ => string "None"
115 | PSome (_, p) => box [string "Some",
116 space,
117 p_pat' true env p]
109 118
110 and p_pat x = p_pat' false x 119 and p_pat x = p_pat' false x
111 120
112 fun p_exp' par env (e, _) = 121 fun p_exp' par env (e, _) =
113 case e of 122 case e of