Mercurial > urweb
diff src/expl_print.sml @ 146:80ac94b54e41
Fix opening and corifying of functors
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Tue, 22 Jul 2008 18:20:13 -0400 |
parents | 541282b81454 |
children | 7420fa18d657 |
line wrap: on
line diff
--- a/src/expl_print.sml Tue Jul 22 15:22:34 2008 -0400 +++ b/src/expl_print.sml Tue Jul 22 18:20:13 2008 -0400 @@ -100,7 +100,7 @@ else m1x in - p_list_sep (string ".") string (m1x :: ms @ [x]) + p_list_sep (string ".") string (m1s :: ms @ [x]) end | CApp (c1, c2) => parenIf par (box [p_con env c1, @@ -155,7 +155,7 @@ CName s => string s | _ => p_con env all -fun p_exp' par env (e, _) = +fun p_exp' par env (e, loc) = case e of EPrim p => Prim.p_t p | ERel n => @@ -171,13 +171,14 @@ | EModProj (m1, ms, x) => let val (m1x, sgn) = E.lookupStrNamed env m1 + handle E.UnboundNamed _ => ("UNBOUND", (SgnConst [], loc)) val m1s = if !debug then m1x ^ "__" ^ Int.toString m1 else m1x in - p_list_sep (string ".") string (m1x :: ms @ [x]) + p_list_sep (string ".") string (m1s :: ms @ [x]) end | EApp (e1, e2) => parenIf par (box [p_exp env e1, @@ -294,7 +295,7 @@ space, p_sgn env sgn] -and p_sgn env (sgn, _) = +and p_sgn env (sgn, loc) = case sgn of SgnConst sgis => box [string "sig", newline, @@ -308,7 +309,8 @@ end, newline, string "end"] - | SgnVar n => string (#1 (E.lookupSgnNamed env n)) + | SgnVar n => string ((#1 (E.lookupSgnNamed env n)) + handle E.UnboundNamed _ => "UNBOUND") | SgnFun (x, n, sgn, sgn') => box [string "functor", space, string "(", @@ -336,6 +338,7 @@ | SgnProj (m1, ms, x) => let val (m1x, sgn) = E.lookupStrNamed env m1 + handle E.UnboundNamed _ => ("UNBOUND", (SgnConst [], loc)) val m1s = if !debug then m1x ^ "__" ^ Int.toString m1 @@ -424,7 +427,18 @@ p_file env ds, newline, string "end"] - | StrVar n => string (#1 (E.lookupStrNamed env n)) + | StrVar n => + let + val x = #1 (E.lookupStrNamed env n) + handle E.UnboundNamed _ => "UNBOUND" + + val s = if !debug then + x ^ "__" ^ Int.toString n + else + x + in + string s + end | StrProj (str, s) => box [p_str env str, string ".", string s]