comparison src/cjr_print.sml @ 613:c5991cdb0c4b

Initial parsing of RPC results
author Adam Chlipala <adamc@hcoop.net>
date Sun, 15 Feb 2009 12:33:41 -0500
parents a8704dfc58cf
children 3ee6bb48f6e8
comparison
equal deleted inserted replaced
612:d80256efc160 613:c5991cdb0c4b
861 List.all (fn (_, t) => empty t) (E.lookupStruct env j) 861 List.all (fn (_, t) => empty t) (E.lookupStruct env j)
862 | _ => false 862 | _ => false
863 863
864 val xts = E.lookupStruct env i 864 val xts = E.lookupStruct env i
865 865
866 val (blocks, _) = ListUtil.foldlMap 866 val (blocks, _) = foldl
867 (fn ((x, t), wasEmpty) => 867 (fn ((x, t), (blocks, printingSinceLastSlash)) =>
868 (box [string "{", 868 let
869 newline, 869 val thisEmpty = empty t
870 p_typ env t, 870 in
871 space, 871 if thisEmpty then
872 string ("it" ^ Int.toString (level + 1)), 872 (blocks, printingSinceLastSlash)
873 space, 873 else
874 string "=", 874 (box [string "{",
875 space, 875 newline,
876 string ("it" ^ Int.toString level ^ ".__uwf_" ^ x ^ ";"), 876 p_typ env t,
877 newline, 877 space,
878 box (if wasEmpty then 878 string ("it" ^ Int.toString (level + 1)),
879 [] 879 space,
880 else 880 string "=",
881 [string "uw_write(ctx, \"/\");", 881 space,
882 newline]), 882 string ("it" ^ Int.toString level ^ ".__uwf_" ^ x ^ ";"),
883 urlify' rf (level + 1) t, 883 newline,
884 string "}", 884 box (if printingSinceLastSlash then
885 newline], 885 [string "uw_write(ctx, \"/\");",
886 empty t)) 886 newline]
887 false xts 887 else
888 []),
889 urlify' rf (level + 1) t,
890 string "}",
891 newline] :: blocks,
892 true)
893 end)
894 ([], false) xts
888 in 895 in
889 box blocks 896 box (rev blocks)
890 end 897 end
891 898
892 | TDatatype (Enum, i, _) => box [] 899 | TDatatype (Enum, i, _) => box []
893 (*let 900 (*let
894 val (x, xncs) = E.lookupDatatype env i 901 val (x, xncs) = E.lookupDatatype env i