Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /sml/trunk/src/cm/smlfile/skel-io.sml
ViewVC logotype

Diff of /sml/trunk/src/cm/smlfile/skel-io.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 292, Mon May 24 22:03:46 1999 UTC revision 293, Tue May 25 03:04:50 1999 UTC
# Line 48  Line 48 
48              val ns = S.nameSpace n              val ns = S.nameSpace n
49              val prefix =              val prefix =
50                  case ns of                  case ns of
51                      S.STRspace => "#"                      S.SIGspace => ";"
52                    | S.SIGspace => "$"                    | S.FCTspace => "("
53                    | S.FCTspace => "%"                    | S.FSIGspace => ")"
54                    | S.FSIGspace => "&"                    | S.STRspace => ""    (* this should be safe now *)
55                    | _ => raise InternalError                    | _ => raise InternalError
56          in          in
57              prefix :: S.name n :: "." :: r              prefix :: S.name n :: "." :: r
58          end          end
59    
60          fun w_list w (l, r) = foldr w (";" :: r) l          fun w_list w ([], r) = "0" :: r
61              | w_list w ([a], r) = "1" :: w (a, r)
62              | w_list w ([a, b], r) = "2" :: w (a, w (b, r))
63              | w_list w ([a, b, c], r) = "3" :: w (a, w (b, w (c, r)))
64              | w_list w ([a, b, c, d], r) = "4" :: w (a, w (b, w (c, w (d, r))))
65              | w_list w (a :: b :: c :: d :: e :: x, r) =
66                "5" :: w (a, w (b, w (c, w (d, w (e, w_list w (x, r))))))
67    
68          fun w_path (SP.SPATH p, r) = w_list w_name (p, r)          fun w_path (SP.SPATH p, r) = w_list w_name (p, r)
69    
# Line 70  Line 76 
76            | w_decl (SK.Ref s, r) = "r" :: w_list w_name (SS.listItems s, r)            | w_decl (SK.Ref s, r) = "r" :: w_list w_name (SS.listItems s, r)
77    
78          and w_modExp (SK.Var p, r) = "v" :: w_path (p, r)          and w_modExp (SK.Var p, r) = "v" :: w_path (p, r)
79            | w_modExp (SK.Decl d, r) = "d" :: w_decl (d, r)            | w_modExp (SK.Decl d, r) = "d" :: w_list w_decl (d, r)
80            | w_modExp (SK.Let (d, m), r) = "l" :: w_decl (d, w_modExp (m, r))            | w_modExp (SK.Let (d, m), r) =
81                "l" :: w_list w_decl (d, w_modExp (m, r))
82            | w_modExp (SK.Ign1 (m1, m2), r) =            | w_modExp (SK.Ign1 (m1, m2), r) =
83              "i" :: w_modExp (m1, w_modExp (m2, r))              "i" :: w_modExp (m1, w_modExp (m2, r))
84      in      in
# Line 92  Line 99 
99                  loop ([], first)                  loop ([], first)
100              end              end
101          in          in
102              fun r_name (SOME #"#") = get (S.strSymbol, rd ())              fun r_name (SOME #";") = get (S.sigSymbol, rd ())
103                | r_name (SOME #"$") = get (S.sigSymbol, rd ())                | r_name (SOME #"(") = get (S.fctSymbol, rd ())
104                | r_name (SOME #"%") = get (S.fctSymbol, rd ())                | r_name (SOME #")") = get (S.fsigSymbol, rd ())
105                | r_name (SOME #"&") = get (S.fsigSymbol, rd ())                | r_name first = get (S.strSymbol, first)
               | r_name _ = raise FormatError  
106          end          end
107    
108          fun r_list r = let          fun r_list r = let
109              fun loop (accu, NONE) = raise FormatError              fun n () = r (rd ())
110                | loop (accu, SOME #";") = rev accu              fun rl (SOME #"0") = []
111                | loop (accu, cur) = loop ((r cur) :: accu, rd ())                | rl (SOME #"1") = [n ()]
112                  | rl (SOME #"2") = [n (), n ()]
113                  | rl (SOME #"3") = [n (), n (), n ()]
114                  | rl (SOME #"4") = [n (), n (), n (), n ()]
115                  | rl (SOME #"5") =
116                    n () :: n () :: n () :: n () :: n () :: rl (rd ())
117                  | rl _ = raise FormatError
118          in          in
119              fn first => loop ([], first)              rl
120          end          end
121    
122          fun r_path first = SP.SPATH (r_list r_name first)          fun r_path first = SP.SPATH (r_list r_name first)
# Line 118  Line 130 
130            | r_decl _ = raise FormatError            | r_decl _ = raise FormatError
131    
132          and r_modExp (SOME #"v") = SK.Var (r_path (rd ()))          and r_modExp (SOME #"v") = SK.Var (r_path (rd ()))
133            | r_modExp (SOME #"d") = SK.Decl (r_decl (rd ()))            | r_modExp (SOME #"d") = SK.Decl (r_list r_decl (rd ()))
134            | r_modExp (SOME #"l") = SK.Let (r_decl (rd ()), r_modExp (rd ()))            | r_modExp (SOME #"l") =
135                SK.Let (r_list r_decl (rd ()), r_modExp (rd ()))
136            | r_modExp (SOME #"i") = SK.Ign1 (r_modExp (rd ()), r_modExp (rd ()))            | r_modExp (SOME #"i") = SK.Ign1 (r_modExp (rd ()), r_modExp (rd ()))
137            | r_modExp _ = raise FormatError            | r_modExp _ = raise FormatError
138    

Legend:
Removed from v.292  
changed lines
  Added in v.293

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0