File tree 1 file changed +8
-8
lines changed 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -71,31 +71,31 @@ type doc =
71
71
72
72
(* Break a string at \n *)
73
73
(* Replaces an earlier implementation that relied on repeatedly calling sub, with one inspired by the standard library *)
74
- let breakString init s =
74
+ let breakString s =
75
75
if s = " " then
76
- init
76
+ Nil
77
77
else
78
- let r = ref init in
78
+ let r = ref Nil in
79
79
let j = ref (String. length s) in
80
80
for i = String. length s - 1 downto 0 do
81
81
if String. unsafe_get s i = '\n' then begin
82
82
let text = (String. sub s (i + 1 ) (! j - i - 1 )) in
83
83
(if ! r = Nil then
84
- r := CText (Line , text)
84
+ r := Concat (Line ,Text text)
85
85
else
86
- r := Concat (Line , CText ( ! r, text)));
86
+ r := Concat (Line , Concat ( Text text, ! r )));
87
87
j := i
88
88
end
89
89
done ;
90
90
let text = String. sub s 0 ! j in
91
91
if ! r = Nil then
92
92
Text text
93
93
else
94
- CText ( ! r, text)
94
+ Concat ( Text text, ! r )
95
95
96
96
97
97
let nil = Nil
98
- let text s = breakString nil s
98
+ let text s = breakString s
99
99
let num i = text (string_of_int i)
100
100
let num64 i = text (Int64. to_string i)
101
101
let real f = text (string_of_float f)
@@ -707,7 +707,7 @@ let gprintf (finish : doc -> 'b)
707
707
else
708
708
s
709
709
in
710
- collect (breakString acc str) (succ j))
710
+ collect (Concat ( acc, breakString str) ) (succ j))
711
711
| 'c' ->
712
712
Obj. magic(fun c ->
713
713
collect (dctext1 acc (String. make 1 c)) (succ j))
You can’t perform that action at this time.
0 commit comments