Skip to content

Commit 98fb22b

Browse files
Fix acc position
1 parent f99b977 commit 98fb22b

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/ocamlutil/pretty.ml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,31 +71,31 @@ type doc =
7171

7272
(* Break a string at \n *)
7373
(* 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 =
7575
if s = "" then
76-
init
76+
Nil
7777
else
78-
let r = ref init in
78+
let r = ref Nil in
7979
let j = ref (String.length s) in
8080
for i = String.length s - 1 downto 0 do
8181
if String.unsafe_get s i = '\n' then begin
8282
let text = (String.sub s (i + 1) (!j - i - 1)) in
8383
(if !r = Nil then
84-
r := CText(Line, text)
84+
r := Concat(Line,Text text)
8585
else
86-
r := Concat(Line, CText(!r, text)));
86+
r := Concat(Line, Concat(Text text, !r)));
8787
j := i
8888
end
8989
done;
9090
let text = String.sub s 0 !j in
9191
if !r = Nil then
9292
Text text
9393
else
94-
CText(!r, text)
94+
Concat(Text text,!r)
9595

9696

9797
let nil = Nil
98-
let text s = breakString nil s
98+
let text s = breakString s
9999
let num i = text (string_of_int i)
100100
let num64 i = text (Int64.to_string i)
101101
let real f = text (string_of_float f)
@@ -707,7 +707,7 @@ let gprintf (finish : doc -> 'b)
707707
else
708708
s
709709
in
710-
collect (breakString acc str) (succ j))
710+
collect (Concat(acc, breakString str)) (succ j))
711711
| 'c' ->
712712
Obj.magic(fun c ->
713713
collect (dctext1 acc (String.make 1 c)) (succ j))

0 commit comments

Comments
 (0)