diff options
author | Adam Chlipala <adamc@hcoop.net> | 2009-02-15 12:33:41 -0500 |
---|---|---|
committer | Adam Chlipala <adamc@hcoop.net> | 2009-02-15 12:33:41 -0500 |
commit | b228a55b0c40fc309c5bbbc9e4c15c3eebf82880 (patch) | |
tree | 82ba6f2b8547742ce5c12abb628e21a7843db234 /src/cjr_print.sml | |
parent | e2d8010cf8e5334b58713404e9e146b18292ef73 (diff) |
Initial parsing of RPC results
Diffstat (limited to 'src/cjr_print.sml')
-rw-r--r-- | src/cjr_print.sml | 53 |
1 files changed, 30 insertions, 23 deletions
diff --git a/src/cjr_print.sml b/src/cjr_print.sml index fcd18fb7..c1911c8d 100644 --- a/src/cjr_print.sml +++ b/src/cjr_print.sml @@ -863,30 +863,37 @@ fun urlify env t = val xts = E.lookupStruct env i - val (blocks, _) = ListUtil.foldlMap - (fn ((x, t), wasEmpty) => - (box [string "{", - newline, - p_typ env t, - space, - string ("it" ^ Int.toString (level + 1)), - space, - string "=", - space, - string ("it" ^ Int.toString level ^ ".__uwf_" ^ x ^ ";"), - newline, - box (if wasEmpty then - [] - else - [string "uw_write(ctx, \"/\");", - newline]), - urlify' rf (level + 1) t, - string "}", - newline], - empty t)) - false xts + val (blocks, _) = foldl + (fn ((x, t), (blocks, printingSinceLastSlash)) => + let + val thisEmpty = empty t + in + if thisEmpty then + (blocks, printingSinceLastSlash) + else + (box [string "{", + newline, + p_typ env t, + space, + string ("it" ^ Int.toString (level + 1)), + space, + string "=", + space, + string ("it" ^ Int.toString level ^ ".__uwf_" ^ x ^ ";"), + newline, + box (if printingSinceLastSlash then + [string "uw_write(ctx, \"/\");", + newline] + else + []), + urlify' rf (level + 1) t, + string "}", + newline] :: blocks, + true) + end) + ([], false) xts in - box blocks + box (rev blocks) end | TDatatype (Enum, i, _) => box [] |