diff options
author | 2009-02-15 12:33:41 -0500 | |
---|---|---|
committer | 2009-02-15 12:33:41 -0500 | |
commit | f083e82c95ac4a9d3a22e032f81b6dc88a88f499 (patch) | |
tree | 82ba6f2b8547742ce5c12abb628e21a7843db234 /src/cjr_print.sml | |
parent | e7fdb6e0f6ab265f3cd850d3663a91b531de8ba8 (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 [] |