some bug fixing. (Code is in a messed up/broken/deoptimised stated, but I will fix that once all bugs are address.)
This commit is contained in:
682
src/line_gap.sml
682
src/line_gap.sml
@@ -19,7 +19,7 @@ struct
|
|||||||
if prevChar = #"\r" then
|
if prevChar = #"\r" then
|
||||||
helpCountLineBreaks (pos - 2, (pos - 1) :: acc, str)
|
helpCountLineBreaks (pos - 2, (pos - 1) :: acc, str)
|
||||||
else
|
else
|
||||||
helpCountLineBreaks (pos - 2, pos :: acc, str)
|
helpCountLineBreaks (pos - 1, pos :: acc, str)
|
||||||
end
|
end
|
||||||
else if chr = #"\r" then
|
else if chr = #"\r" then
|
||||||
helpCountLineBreaks (pos - 1, pos :: acc, str)
|
helpCountLineBreaks (pos - 1, pos :: acc, str)
|
||||||
@@ -41,6 +41,56 @@ struct
|
|||||||
, rightLines: int vector list
|
, rightLines: int vector list
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun lineBreaksToString vec =
|
||||||
|
(Vector.foldr (fn (el, acc) => Int.toString el ^ ", " ^ acc) "" vec) ^ "\n"
|
||||||
|
|
||||||
|
fun checkLineBreaks (v1, v2) =
|
||||||
|
if v1 = v2 then
|
||||||
|
()
|
||||||
|
else
|
||||||
|
let
|
||||||
|
val _ = print ("broken: " ^ (lineBreaksToString v1))
|
||||||
|
val _ = print ("fixed: " ^ (lineBreaksToString v2))
|
||||||
|
in
|
||||||
|
()
|
||||||
|
end
|
||||||
|
|
||||||
|
fun checkLineBreaksWithString (dir, str, lines) =
|
||||||
|
if countLineBreaks str <> lines then
|
||||||
|
let
|
||||||
|
val _ = print (dir ^ "\n")
|
||||||
|
val _ = print ("broken: " ^ lineBreaksToString lines)
|
||||||
|
val _ = print ("fixed: " ^ (lineBreaksToString (countLineBreaks str)))
|
||||||
|
val _ = raise Size
|
||||||
|
in
|
||||||
|
()
|
||||||
|
end
|
||||||
|
else
|
||||||
|
()
|
||||||
|
|
||||||
|
fun verifyReturn (buffer: t) =
|
||||||
|
let
|
||||||
|
val _ =
|
||||||
|
case (#leftStrings buffer, #leftLines buffer) of
|
||||||
|
(sHd :: _, lHd :: _) =>
|
||||||
|
let val _ = checkLineBreaksWithString ("left", sHd, lHd)
|
||||||
|
in ()
|
||||||
|
end
|
||||||
|
| (_, _) => ()
|
||||||
|
|
||||||
|
val _ =
|
||||||
|
case (#rightStrings buffer, #rightLines buffer) of
|
||||||
|
(sHd :: _, lHd :: _) =>
|
||||||
|
let val _ = checkLineBreaksWithString ("right", sHd, lHd)
|
||||||
|
in ()
|
||||||
|
end
|
||||||
|
| (_, _) => ()
|
||||||
|
|
||||||
|
in
|
||||||
|
buffer
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
local
|
local
|
||||||
fun goToStart (leftStrings, leftLines, accStrings, accLines) =
|
fun goToStart (leftStrings, leftLines, accStrings, accLines) =
|
||||||
case (leftStrings, leftLines) of
|
case (leftStrings, leftLines) of
|
||||||
@@ -57,8 +107,11 @@ struct
|
|||||||
if checkLines = lHd then
|
if checkLines = lHd then
|
||||||
verifyLineList (strTl, lTl)
|
verifyLineList (strTl, lTl)
|
||||||
else
|
else
|
||||||
let val _ = print "line metadata is incorrect\n"
|
let
|
||||||
in raise Empty
|
val _ = print "line metadata is incorrect\n"
|
||||||
|
val _ = checkLineBreaks (lHd, checkLines)
|
||||||
|
in
|
||||||
|
raise Empty
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
| (_, _) => print "verified lines; no problems\n"
|
| (_, _) => print "verified lines; no problems\n"
|
||||||
@@ -108,7 +161,18 @@ struct
|
|||||||
andalso Vector.length v1 + Vector.length v2 <= vecLimit
|
andalso Vector.length v1 + Vector.length v2 <= vecLimit
|
||||||
|
|
||||||
local
|
local
|
||||||
fun helpBinSearch (findNum, lines, low, high) =
|
fun reverseLinearSearch (findNum, idx, lines) =
|
||||||
|
if idx < 0 then
|
||||||
|
idx
|
||||||
|
else
|
||||||
|
let
|
||||||
|
val curVal = Vector.sub (lines, idx)
|
||||||
|
in
|
||||||
|
if curVal < findNum then idx
|
||||||
|
else reverseLinearSearch (findNum, idx, lines)
|
||||||
|
end
|
||||||
|
|
||||||
|
fun helpBinSearch (findNum, lines, low, high, prevLow, prevHigh) =
|
||||||
let
|
let
|
||||||
val mid = low + ((high - low) div 2)
|
val mid = low + ((high - low) div 2)
|
||||||
in
|
in
|
||||||
@@ -117,19 +181,36 @@ struct
|
|||||||
val midVal = Vector.sub (lines, mid)
|
val midVal = Vector.sub (lines, mid)
|
||||||
in
|
in
|
||||||
if midVal = findNum then
|
if midVal = findNum then
|
||||||
mid
|
(print "return 173\n"; mid)
|
||||||
else if midVal < findNum then
|
else if midVal < findNum then
|
||||||
helpBinSearch (findNum, lines, mid + 1, high)
|
helpBinSearch (findNum, lines, mid + 1, high, low, high)
|
||||||
else
|
else
|
||||||
helpBinSearch (findNum, lines, low, mid - 1)
|
helpBinSearch (findNum, lines, low, mid - 1, low, high)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
Int.max (0, mid)
|
let
|
||||||
|
val prevLowVal = Vector.sub (lines, prevLow)
|
||||||
|
val prevHighVal = Vector.sub (lines, prevHigh)
|
||||||
|
val _ = print ("prevLowVal: " ^ Int.toString prevLowVal ^ "\n")
|
||||||
|
val _ = print ("prevHighVal: " ^ Int.toString prevHighVal ^ "\n")
|
||||||
|
val _ = print ("findNum: " ^ Int.toString findNum ^ "\n")
|
||||||
|
in
|
||||||
|
(print "return 180\n"; reverseLinearSearch (findNum, mid, lines))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
in
|
in
|
||||||
fun binSearch (findNum, lines) =
|
fun binSearch (findNum, lines) =
|
||||||
if Vector.length lines = 0 then 0
|
if Vector.length lines = 0 then
|
||||||
else helpBinSearch (findNum, lines, 0, Vector.length lines - 1)
|
0
|
||||||
|
else
|
||||||
|
helpBinSearch
|
||||||
|
( findNum
|
||||||
|
, lines
|
||||||
|
, 0
|
||||||
|
, Vector.length lines - 1
|
||||||
|
, 0
|
||||||
|
, Vector.length lines - 1
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
fun insWhenIdxAndCurIdxAreEqual
|
fun insWhenIdxAndCurIdxAreEqual
|
||||||
@@ -141,12 +222,13 @@ struct
|
|||||||
, leftLines
|
, leftLines
|
||||||
, rightStrings
|
, rightStrings
|
||||||
, rightLines
|
, rightLines
|
||||||
) =
|
) : t =
|
||||||
case (leftStrings, leftLines) of
|
case (leftStrings, leftLines) of
|
||||||
(strHd :: strTl, lineHd :: lineTl) =>
|
(strHd :: strTl, lineHd :: lineTl) =>
|
||||||
if isInLimit (strHd, newString, lineHd, newLines) then
|
if isInLimit (strHd, newString, lineHd, newLines) then
|
||||||
(* Fits in limit, so we can add to existing string/line vector.*)
|
(* Fits in limit, so we can add to existing string/line vector.*)
|
||||||
let
|
let
|
||||||
|
(* VERIFIED TO WORK *)
|
||||||
val _ = print "line 110\n"
|
val _ = print "line 110\n"
|
||||||
val newIdx = curIdx + String.size newString
|
val newIdx = curIdx + String.size newString
|
||||||
val newStrHd = strHd ^ newString
|
val newStrHd = strHd ^ newString
|
||||||
@@ -164,26 +246,29 @@ struct
|
|||||||
)
|
)
|
||||||
val newLeftLines = newLinesHd :: lineTl
|
val newLeftLines = newLinesHd :: lineTl
|
||||||
in
|
in
|
||||||
{ idx = newIdx
|
verifyReturn
|
||||||
, line = newLine
|
{ idx = newIdx
|
||||||
, leftStrings = newLeftString
|
, line = newLine
|
||||||
, leftLines = newLeftLines
|
, leftStrings = newLeftString
|
||||||
, rightStrings = rightStrings
|
, leftLines = newLeftLines
|
||||||
, rightLines = rightLines
|
, rightStrings = rightStrings
|
||||||
}
|
, rightLines = rightLines
|
||||||
|
}
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
let
|
let
|
||||||
val _ = print "line 137\n"
|
val _ = print "line 137\n"
|
||||||
|
(* VERIFIED TO WORK *)
|
||||||
in
|
in
|
||||||
(* Does not fit in limit, so cons instead.*)
|
(* Does not fit in limit, so cons instead.*)
|
||||||
{ idx = curIdx + String.size newString
|
verifyReturn
|
||||||
, line = curLine + Vector.length newLines
|
{ idx = curIdx + String.size newString
|
||||||
, leftStrings = newString :: leftStrings
|
, line = curLine + Vector.length newLines
|
||||||
, leftLines = newLines :: leftLines
|
, leftStrings = newString :: leftStrings
|
||||||
, rightStrings = rightStrings
|
, leftLines = newLines :: leftLines
|
||||||
, rightLines = rightLines
|
, rightStrings = rightStrings
|
||||||
}
|
, rightLines = rightLines
|
||||||
|
}
|
||||||
end
|
end
|
||||||
| (_, _) =>
|
| (_, _) =>
|
||||||
(*
|
(*
|
||||||
@@ -194,14 +279,16 @@ struct
|
|||||||
*)
|
*)
|
||||||
let
|
let
|
||||||
val _ = print "line 156\n"
|
val _ = print "line 156\n"
|
||||||
|
(* VERIFIED TO WORK *)
|
||||||
in
|
in
|
||||||
{ idx = String.size newString
|
verifyReturn
|
||||||
, line = Vector.length newLines
|
{ idx = String.size newString
|
||||||
, leftStrings = [newString]
|
, line = Vector.length newLines
|
||||||
, leftLines = [newLines]
|
, leftStrings = [newString]
|
||||||
, rightStrings = rightStrings
|
, leftLines = [newLines]
|
||||||
, rightLines = rightLines
|
, rightStrings = rightStrings
|
||||||
}
|
, rightLines = rightLines
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
fun insInLeftList
|
fun insInLeftList
|
||||||
@@ -222,9 +309,15 @@ struct
|
|||||||
) : t =
|
) : t =
|
||||||
if idx = prevIdx then
|
if idx = prevIdx then
|
||||||
(* Need to insert at the start of the left list. *)
|
(* Need to insert at the start of the left list. *)
|
||||||
if isInLimit (newString, leftStringsHd, newLines, leftLinesHd) then
|
if
|
||||||
|
(*
|
||||||
|
isInLimit (newString, leftStringsHd, newLines, leftLinesHd)
|
||||||
|
*)
|
||||||
|
false
|
||||||
|
then
|
||||||
let
|
let
|
||||||
(* Create new vector, adjusting indices as needed. *)
|
(* Create new vector, adjusting indices as needed. *)
|
||||||
|
(* VERIFIED TO WORK *)
|
||||||
val _ = print "line 188\n"
|
val _ = print "line 188\n"
|
||||||
val joinedLines =
|
val joinedLines =
|
||||||
Vector.tabulate
|
Vector.tabulate
|
||||||
@@ -237,26 +330,29 @@ struct
|
|||||||
+ String.size newString
|
+ String.size newString
|
||||||
)
|
)
|
||||||
in
|
in
|
||||||
{ idx = curIdx + String.size newString
|
verifyReturn
|
||||||
, line = curLine + Vector.length newLines
|
{ idx = curIdx + String.size newString
|
||||||
, leftStrings = (newString ^ leftStringsHd) :: leftStringsTl
|
, line = curLine + Vector.length newLines
|
||||||
, leftLines = joinedLines :: leftLinesTl
|
, leftStrings = (newString ^ leftStringsHd) :: leftStringsTl
|
||||||
, rightStrings = rightStrings
|
, leftLines = joinedLines :: leftLinesTl
|
||||||
, rightLines = rightLines
|
, rightStrings = rightStrings
|
||||||
}
|
, rightLines = rightLines
|
||||||
|
}
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
(* Just cons everything; no way we can join while staying in limit. *)
|
(* Just cons everything; no way we can join while staying in limit. *)
|
||||||
let
|
let
|
||||||
|
(* VERIFIED TO WORK *)
|
||||||
val _ = print "line 210\n"
|
val _ = print "line 210\n"
|
||||||
in
|
in
|
||||||
{ idx = curIdx + String.size newString
|
verifyReturn
|
||||||
, line = curLine + Vector.length newLines
|
{ idx = curIdx + String.size newString
|
||||||
, leftStrings = leftStringsHd :: newString :: leftStringsTl
|
, line = curLine + Vector.length newLines
|
||||||
, leftLines = leftLinesHd :: newLines :: leftLinesTl
|
, leftStrings = leftStringsHd :: newString :: leftStringsTl
|
||||||
, rightStrings = rightStrings
|
, leftLines = leftLinesHd :: newLines :: leftLinesTl
|
||||||
, rightLines = rightLines
|
, rightStrings = rightStrings
|
||||||
}
|
, rightLines = rightLines
|
||||||
|
}
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
(* Need to insert in the middle of the left list. *)
|
(* Need to insert in the middle of the left list. *)
|
||||||
@@ -266,43 +362,52 @@ struct
|
|||||||
val strSub1 = String.substring (leftStringsHd, 0, strLength)
|
val strSub1 = String.substring (leftStringsHd, 0, strLength)
|
||||||
val strSub2 = String.substring
|
val strSub2 = String.substring
|
||||||
(leftStringsHd, strLength, String.size leftStringsHd - strLength)
|
(leftStringsHd, strLength, String.size leftStringsHd - strLength)
|
||||||
val midpoint = binSearch (String.size strSub1, leftLinesHd)
|
val midpoint = binSearch (String.size strSub1 - 1, leftLinesHd)
|
||||||
|
val _ = print ("lines in vec: " ^ lineBreaksToString leftLinesHd ^ "\n")
|
||||||
val _ = print
|
val _ = print
|
||||||
("str size:" ^ Int.toString (Vector.length leftLinesHd) ^ "\n")
|
("vec size:" ^ Int.toString (Vector.length leftLinesHd) ^ "\n")
|
||||||
val _ = print ("midpoint:" ^ Int.toString (midpoint) ^ "\n")
|
val _ = print ("midpoint:" ^ Int.toString (midpoint) ^ "\n")
|
||||||
in
|
in
|
||||||
if
|
if
|
||||||
isThreeInLimit (strSub1, newString, strSub2, leftLinesHd, newLines)
|
(* isThreeInLimit (strSub1, newString, strSub2, leftLinesHd, newLines)
|
||||||
|
* *) false
|
||||||
then
|
then
|
||||||
(* Join three strings together. *)
|
(* Join three strings together. *)
|
||||||
let
|
let
|
||||||
|
(* VERIFIED TO WORK *)
|
||||||
val _ = print "line 233\n"
|
val _ = print "line 233\n"
|
||||||
|
val joinedString = String.concat [strSub1, newString, strSub2]
|
||||||
val joinedLines =
|
val joinedLines =
|
||||||
Vector.tabulate
|
if Vector.length leftLinesHd > 0 then
|
||||||
( Vector.length leftLinesHd + Vector.length newLines
|
Vector.tabulate
|
||||||
, fn idx =>
|
( Vector.length leftLinesHd + Vector.length newLines
|
||||||
if idx < midpoint then
|
, fn idx =>
|
||||||
Vector.sub (leftLinesHd, idx)
|
if idx <= midpoint then
|
||||||
else if idx < midpoint + Vector.length newLines then
|
Vector.sub (leftLinesHd, idx)
|
||||||
Vector.sub (newLines, idx - midpoint)
|
else if idx <= midpoint + Vector.length newLines then
|
||||||
+ String.size strSub1
|
Vector.sub (newLines, (idx - midpoint) - 1)
|
||||||
else
|
+ String.size strSub1
|
||||||
Vector.sub (leftLinesHd, idx - Vector.length newLines)
|
else
|
||||||
+ String.size newString
|
Vector.sub (leftLinesHd, (idx - Vector.length newLines))
|
||||||
)
|
+ String.size newString
|
||||||
|
)
|
||||||
|
else
|
||||||
|
Vector.map (fn el => el + String.size strSub1) newLines
|
||||||
in
|
in
|
||||||
{ idx = curIdx + String.size newString
|
verifyReturn
|
||||||
, line = curLine + Vector.length newLines
|
{ idx = curIdx + String.size newString
|
||||||
, leftStrings =
|
, line = curLine + Vector.length newLines
|
||||||
String.concat [strSub1, newString, strSub2] :: leftStringsTl
|
, leftStrings = joinedString :: leftStringsTl
|
||||||
, leftLines = joinedLines :: leftLinesTl
|
, leftLines = joinedLines :: leftLinesTl
|
||||||
, rightStrings = rightStrings
|
, rightStrings = rightStrings
|
||||||
, rightLines = rightLines
|
, rightLines = rightLines
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
else if
|
else if
|
||||||
String.size strSub1 + String.size newString <= stringLimit
|
true (*
|
||||||
andalso midpoint + Vector.length newLines <= vecLimit
|
String.size strSub1 + String.size newString <= stringLimit
|
||||||
|
andalso midpoint + Vector.length newLines <= vecLimit
|
||||||
|
*)
|
||||||
then
|
then
|
||||||
(* If we can join newString/lines with sub1 while
|
(* If we can join newString/lines with sub1 while
|
||||||
* staying in limit. *)
|
* staying in limit. *)
|
||||||
@@ -311,85 +416,109 @@ struct
|
|||||||
val _ = print
|
val _ = print
|
||||||
("vector length: " ^ Int.toString (Vector.length newLines) ^ "\n")
|
("vector length: " ^ Int.toString (Vector.length newLines) ^ "\n")
|
||||||
val _ = print ("midpoint: " ^ Int.toString (midpoint) ^ "\n")
|
val _ = print ("midpoint: " ^ Int.toString (midpoint) ^ "\n")
|
||||||
|
|
||||||
|
val newLeftLines = countLineBreaks (strSub1 ^ newString)
|
||||||
|
(*
|
||||||
val newLeftLines =
|
val newLeftLines =
|
||||||
Vector.tabulate (midpoint + Vector.length newLines, fn idx =>
|
Vector.tabulate (midpoint + Vector.length newLines, fn idx =>
|
||||||
if idx < midpoint then Vector.sub (leftLinesHd, idx)
|
if idx < midpoint then Vector.sub (leftLinesHd, idx)
|
||||||
else Vector.sub (newLines, idx - midpoint) + String.size strSub1)
|
else Vector.sub (newLines, idx - midpoint) + String.size strSub1)
|
||||||
|
*)
|
||||||
val _ = print "line 275\n"
|
val _ = print "line 275\n"
|
||||||
val newRightLines = VectorSlice.slice (leftLinesHd, midpoint, SOME
|
|
||||||
(Vector.length leftLinesHd - midpoint))
|
(*
|
||||||
val newRightLines = VectorSlice.vector newRightLines
|
val newRightLines = VectorSlice.slice (leftLinesHd, midpoint, SOME
|
||||||
|
(Vector.length leftLinesHd - midpoint))
|
||||||
|
val newRightLines = VectorSlice.vector newRightLines
|
||||||
|
*)
|
||||||
in
|
in
|
||||||
{ idx = prevIdx + String.size strSub1 + String.size newString
|
verifyReturn
|
||||||
, line =
|
{ idx = prevIdx + String.size strSub1 + String.size newString
|
||||||
(curLine - Vector.length leftLinesHd)
|
, line =
|
||||||
+ Vector.length newLeftLines
|
(curLine - Vector.length leftLinesHd)
|
||||||
, leftStrings = (strSub1 ^ newString) :: leftStringsTl
|
+ Vector.length newLeftLines
|
||||||
, leftLines = newLeftLines :: leftLinesTl
|
, leftStrings = (strSub1 ^ newString) :: leftStringsTl
|
||||||
, rightStrings = strSub2 :: rightStrings
|
, leftLines = countLineBreaks (strSub1 ^ newString) :: leftLinesTl
|
||||||
, rightLines = newRightLines :: rightLines
|
, rightStrings = strSub2 :: rightStrings
|
||||||
}
|
, rightLines = countLineBreaks strSub2 :: rightLines
|
||||||
|
}
|
||||||
end
|
end
|
||||||
else if
|
else if
|
||||||
String.size newString + String.size strSub2 <= stringLimit
|
(*
|
||||||
andalso
|
String.size newString + String.size strSub2 <= stringLimit
|
||||||
(Vector.length leftLinesHd - midpoint) + Vector.length newLines
|
andalso
|
||||||
<= vecLimit
|
(Vector.length leftLinesHd - midpoint) + Vector.length newLines
|
||||||
|
<= vecLimit
|
||||||
|
*)
|
||||||
|
false
|
||||||
then
|
then
|
||||||
(* If we can join newString/line with sub2 while staying
|
(* If we can join newString/line with sub2 while staying
|
||||||
* in limit. *)
|
* in limit. *)
|
||||||
let
|
let
|
||||||
val _ = print "line 292\n"
|
val _ = print "line 292\n"
|
||||||
val newLeftLines = VectorSlice.slice (leftLinesHd, 0, SOME midpoint)
|
(*
|
||||||
val newLeftLines = VectorSlice.vector newLeftLines
|
val newLeftLines = VectorSlice.slice (leftLinesHd, 0, SOME midpoint)
|
||||||
|
val newLeftLines = VectorSlice.vector newLeftLines
|
||||||
|
|
||||||
val newRightLines =
|
val newRightLines =
|
||||||
Vector.tabulate
|
Vector.tabulate
|
||||||
( (Vector.length leftLinesHd - midpoint)
|
( (Vector.length leftLinesHd - midpoint)
|
||||||
+ Vector.length newLines
|
+ Vector.length newLines
|
||||||
, fn idx =>
|
, fn idx =>
|
||||||
if idx < Vector.length newLines then
|
if idx < Vector.length newLines then
|
||||||
Vector.sub (newLines, idx)
|
Vector.sub (newLines, idx)
|
||||||
else
|
else
|
||||||
(Vector.sub (leftLinesHd, idx - Vector.length newLines)
|
(Vector.sub (leftLinesHd, idx - Vector.length newLines)
|
||||||
- String.size strSub1) + String.size newString
|
- String.size strSub1) + String.size newString
|
||||||
)
|
) *)
|
||||||
in
|
in
|
||||||
{ idx = prevIdx + String.size strSub1
|
verifyReturn
|
||||||
, line = (curLine - Vector.length leftLinesHd) + midpoint
|
{ idx = prevIdx + String.size strSub1
|
||||||
, leftStrings = strSub1 :: leftStringsTl
|
, line = (curLine - Vector.length leftLinesHd) + midpoint
|
||||||
, leftLines = newLeftLines :: leftLinesTl
|
, leftStrings = strSub1 :: leftStringsTl
|
||||||
, rightStrings = (newString ^ strSub2) :: rightStrings
|
, leftLines = countLineBreaks strSub1 :: leftLinesTl
|
||||||
, rightLines = newRightLines :: rightLines
|
, rightStrings = (newString ^ strSub2) :: rightStrings
|
||||||
}
|
, rightLines = countLineBreaks (newString ^ strSub2) :: rightLines
|
||||||
|
}
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
(* Can't join on either side while staying in limit. *)
|
(* Can't join on either side while staying in limit. *)
|
||||||
let
|
let
|
||||||
val _ = print "line 319\n"
|
(* VERIFIED TO WORK *)
|
||||||
val lineSub1 = VectorSlice.slice (leftLinesHd, 0, SOME midpoint)
|
val lineSub1 =
|
||||||
val lineSub1 = VectorSlice.vector lineSub1
|
if midpoint >= 0 andalso Vector.length leftLinesHd > 0 then
|
||||||
|
let
|
||||||
|
val lineSub1 = VectorSlice.slice
|
||||||
|
(leftLinesHd, 0, SOME (midpoint + 1))
|
||||||
|
in
|
||||||
|
VectorSlice.vector lineSub1
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Vector.fromList []
|
||||||
|
|
||||||
val lineSub2 = VectorSlice.slice (leftLinesHd, midpoint, SOME
|
val lineSub2Length =
|
||||||
(Vector.length leftLinesHd - midpoint))
|
Vector.length leftLinesHd - Vector.length lineSub1
|
||||||
val lineSub2 = VectorSlice.vector lineSub2
|
val lineSub2 = Vector.tabulate (lineSub2Length, fn idx =>
|
||||||
|
Vector.sub (leftLinesHd, idx + Vector.length lineSub1)
|
||||||
|
- String.size strSub1)
|
||||||
in
|
in
|
||||||
{ idx = prevIdx + String.size strSub1 + String.size newString
|
verifyReturn
|
||||||
, line =
|
{ idx = prevIdx + String.size strSub1 + String.size newString
|
||||||
(curLine - String.size leftStringsHd) + midpoint
|
, line =
|
||||||
+ Vector.length newLines
|
(curLine - String.size leftStringsHd) + midpoint
|
||||||
, leftStrings = newString :: strSub1 :: leftStringsTl
|
+ Vector.length newLines
|
||||||
, leftLines = newLines :: lineSub1 :: leftLinesTl
|
, leftStrings = newString :: strSub1 :: leftStringsTl
|
||||||
, rightStrings = strSub2 :: rightStrings
|
, leftLines = newLines :: lineSub1 :: leftLinesTl
|
||||||
, rightLines = lineSub1 :: rightLines
|
, rightStrings = strSub2 :: rightStrings
|
||||||
}
|
, rightLines = lineSub2 :: rightLines
|
||||||
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
fun moveLeftAndIns
|
fun moveLeftAndIns
|
||||||
( idx
|
( idx
|
||||||
, newString
|
, newString
|
||||||
, newLines
|
, newLines: int vector
|
||||||
, curIdx
|
, curIdx
|
||||||
, curLine
|
, curLine
|
||||||
, leftStrings: string list
|
, leftStrings: string list
|
||||||
@@ -412,14 +541,17 @@ struct
|
|||||||
* *)
|
* *)
|
||||||
(case (rightStrings, rightLines) of
|
(case (rightStrings, rightLines) of
|
||||||
(rightStringsHd :: rightStringsTl, rightLinesHd :: rightLinesTl) =>
|
(rightStringsHd :: rightStringsTl, rightLinesHd :: rightLinesTl) =>
|
||||||
if
|
if false
|
||||||
isInLimit
|
(*
|
||||||
(leftStringsHd, rightStringsHd, leftLinesHd, rightLinesHd)
|
isInLimit
|
||||||
then
|
(leftStringsHd, rightStringsHd, leftLinesHd, rightLinesHd)
|
||||||
|
*) then
|
||||||
let
|
let
|
||||||
val _ = print "line 370\n"
|
val _ = print "line 370\n"
|
||||||
val prevLine = curLine - Vector.length leftLinesHd
|
val prevLine = curLine - Vector.length leftLinesHd
|
||||||
val newRightStringsHd = leftStringsHd ^ rightStringsHd
|
val newRightStringsHd = leftStringsHd ^ rightStringsHd
|
||||||
|
|
||||||
|
(*
|
||||||
val newRightLinesHd =
|
val newRightLinesHd =
|
||||||
Vector.tabulate
|
Vector.tabulate
|
||||||
( Vector.length leftLinesHd
|
( Vector.length leftLinesHd
|
||||||
@@ -432,6 +564,8 @@ struct
|
|||||||
(rightLinesHd, idx - Vector.length leftLinesHd)
|
(rightLinesHd, idx - Vector.length leftLinesHd)
|
||||||
+ String.size leftStringsHd
|
+ String.size leftStringsHd
|
||||||
)
|
)
|
||||||
|
*)
|
||||||
|
val newRightLinesHd = countLineBreaks newRightStringsHd
|
||||||
in
|
in
|
||||||
moveLeftAndIns
|
moveLeftAndIns
|
||||||
( idx
|
( idx
|
||||||
@@ -492,13 +626,14 @@ struct
|
|||||||
| (_, _) =>
|
| (_, _) =>
|
||||||
(* Left list is empty, so need to cons or join.
|
(* Left list is empty, so need to cons or join.
|
||||||
* Just set left string/list as newString/newLines. *)
|
* Just set left string/list as newString/newLines. *)
|
||||||
{ idx = String.size newString
|
verifyReturn
|
||||||
, line = Vector.length newLines
|
{ idx = String.size newString
|
||||||
, leftStrings = [newString]
|
, line = Vector.length newLines
|
||||||
, leftLines = [newLines]
|
, leftStrings = [newString]
|
||||||
, rightStrings = rightStrings
|
, leftLines = [newLines]
|
||||||
, rightLines = rightLines
|
, rightStrings = rightStrings
|
||||||
}
|
, rightLines = rightLines
|
||||||
|
}
|
||||||
|
|
||||||
fun insInRightList
|
fun insInRightList
|
||||||
( idx
|
( idx
|
||||||
@@ -523,24 +658,28 @@ struct
|
|||||||
let
|
let
|
||||||
val _ = print "line 474\n"
|
val _ = print "line 474\n"
|
||||||
val newRightStringsHd = rightStringsHd ^ newString
|
val newRightStringsHd = rightStringsHd ^ newString
|
||||||
val newRightLinesHd =
|
val newRightLinesHd = countLineBreaks newRightStringsHd
|
||||||
Vector.tabulate
|
(*
|
||||||
( Vector.length newLines + Vector.length rightLinesHd
|
val newRightLinesHd =
|
||||||
, fn idx =>
|
Vector.tabulate
|
||||||
if idx < Vector.length rightLinesHd then
|
( Vector.length newLines + Vector.length rightLinesHd
|
||||||
Vector.sub (rightLinesHd, idx)
|
, fn idx =>
|
||||||
else
|
if idx < Vector.length rightLinesHd then
|
||||||
Vector.sub (newLines, idx - Vector.length rightLinesHd)
|
Vector.sub (rightLinesHd, idx)
|
||||||
+ String.size rightStringsHd
|
else
|
||||||
)
|
Vector.sub (newLines, idx - Vector.length rightLinesHd)
|
||||||
|
+ String.size rightStringsHd
|
||||||
|
)
|
||||||
|
*)
|
||||||
in
|
in
|
||||||
{ idx = curIdx
|
verifyReturn
|
||||||
, line = curLine
|
{ idx = curIdx
|
||||||
, leftStrings = leftStrings
|
, line = curLine
|
||||||
, leftLines = leftLines
|
, leftStrings = leftStrings
|
||||||
, rightStrings = newRightStringsHd :: rightStringsTl
|
, leftLines = leftLines
|
||||||
, rightLines = newRightLinesHd :: rightLinesTl
|
, rightStrings = newRightStringsHd :: rightStringsTl
|
||||||
}
|
, rightLines = countLineBreaks newRightStringsHd :: rightLinesTl
|
||||||
|
}
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
(* Cons newString and newLines to after-the-head,
|
(* Cons newString and newLines to after-the-head,
|
||||||
@@ -548,13 +687,14 @@ struct
|
|||||||
let
|
let
|
||||||
val _ = print "line 498\n"
|
val _ = print "line 498\n"
|
||||||
in
|
in
|
||||||
{ idx = curIdx
|
verifyReturn
|
||||||
, line = curLine
|
{ idx = curIdx
|
||||||
, leftStrings = leftStrings
|
, line = curLine
|
||||||
, leftLines = leftLines
|
, leftStrings = leftStrings
|
||||||
, rightStrings = rightStringsHd :: newString :: rightStringsTl
|
, leftLines = leftLines
|
||||||
, rightLines = rightLinesHd :: newLines :: rightLinesTl
|
, rightStrings = rightStringsHd :: newString :: rightStringsTl
|
||||||
}
|
, rightLines = rightLinesHd :: newLines :: rightLinesTl
|
||||||
|
}
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
(* Have to split rightStringsHd and rightLinesHd in the middle. *)
|
(* Have to split rightStringsHd and rightLinesHd in the middle. *)
|
||||||
@@ -563,40 +703,61 @@ struct
|
|||||||
val strSub1 = String.substring (rightStringsHd, 0, strLength)
|
val strSub1 = String.substring (rightStringsHd, 0, strLength)
|
||||||
val strSub2 = String.substring
|
val strSub2 = String.substring
|
||||||
(rightStringsHd, strLength, String.size rightStringsHd - strLength)
|
(rightStringsHd, strLength, String.size rightStringsHd - strLength)
|
||||||
val midpoint = binSearch (String.size strSub1, rightLinesHd)
|
val midpoint = binSearch (String.size strSub1 - 1, rightLinesHd)
|
||||||
in
|
in
|
||||||
if
|
if
|
||||||
isThreeInLimit (strSub1, newString, strSub2, rightLinesHd, newLines)
|
isThreeInLimit (strSub1, newString, strSub2, rightLinesHd, newLines)
|
||||||
then
|
then
|
||||||
(* Join three strings together. *)
|
(* Join three strings together. *)
|
||||||
let
|
let
|
||||||
val _ = print "line 520\n"
|
val _ = print "line 573\n"
|
||||||
val newRightStringsHd = String.concat [strSub1, newString, strSub2]
|
val newRightStringsHd = String.concat [strSub1, newString, strSub2]
|
||||||
val newRightLinesHd =
|
|
||||||
Vector.tabulate
|
(*
|
||||||
( Vector.length rightLinesHd + Vector.length newLines
|
val newRightLinesHd =
|
||||||
, fn idx =>
|
Vector.tabulate
|
||||||
if idx < midpoint then
|
( Vector.length rightLinesHd + Vector.length newLines
|
||||||
Vector.sub (rightLinesHd, idx)
|
, fn idx =>
|
||||||
else if idx < midpoint + Vector.length newLines then
|
if idx < midpoint then
|
||||||
Vector.sub (newLines, idx - midpoint)
|
Vector.sub (rightLinesHd, idx)
|
||||||
+ String.size strSub1
|
else if idx < midpoint + Vector.length newLines then
|
||||||
else
|
let
|
||||||
Vector.sub (rightLinesHd, idx - Vector.length newLines)
|
val result =
|
||||||
+ String.size newString
|
Vector.sub (newLines, idx - midpoint) + String.size
|
||||||
)
|
strSub1
|
||||||
|
val _ = print "line 598\n"
|
||||||
|
val _ = print ("result: " ^ Int.toString result ^ "\n")
|
||||||
|
in
|
||||||
|
result
|
||||||
|
end
|
||||||
|
else
|
||||||
|
let
|
||||||
|
val result =
|
||||||
|
Vector.sub
|
||||||
|
(rightLinesHd, idx - Vector.length newLines)
|
||||||
|
+ String.size newString
|
||||||
|
val _ = print "line 606\n"
|
||||||
|
val _ = print ("result: " ^ Int.toString result ^ "\n")
|
||||||
|
in
|
||||||
|
result
|
||||||
|
end
|
||||||
|
) *)
|
||||||
in
|
in
|
||||||
{ idx = curIdx
|
verifyReturn
|
||||||
, line = curLine
|
{ idx = curIdx
|
||||||
, leftStrings = leftStrings
|
, line = curLine
|
||||||
, leftLines = leftLines
|
, leftStrings = leftStrings
|
||||||
, rightStrings = newRightStringsHd :: rightStringsTl
|
, leftLines = leftLines
|
||||||
, rightLines = newRightLinesHd :: rightLinesTl
|
, rightStrings = newRightStringsHd :: rightStringsTl
|
||||||
}
|
, rightLines = countLineBreaks newRightStringsHd :: rightLinesTl
|
||||||
|
}
|
||||||
end
|
end
|
||||||
else if
|
else if
|
||||||
String.size strSub1 + String.size newString <= stringLimit
|
(*
|
||||||
andalso midpoint + Vector.length newLines <= vecLimit
|
String.size strSub1 + String.size newString <= stringLimit
|
||||||
|
andalso midpoint + Vector.length newLines <= vecLimit
|
||||||
|
*)
|
||||||
|
false
|
||||||
then
|
then
|
||||||
(* If we can join newString/lines with sub1 while
|
(* If we can join newString/lines with sub1 while
|
||||||
* staying in limit. *)
|
* staying in limit. *)
|
||||||
@@ -604,75 +765,102 @@ struct
|
|||||||
(* strSub1 ^ newString is placed on the left list. *)
|
(* strSub1 ^ newString is placed on the left list. *)
|
||||||
val _ = print "line 552\n"
|
val _ = print "line 552\n"
|
||||||
val newLeftStringsHd = strSub1 ^ newString
|
val newLeftStringsHd = strSub1 ^ newString
|
||||||
|
(*
|
||||||
val newLeftLinesHd =
|
val newLeftLinesHd =
|
||||||
Vector.tabulate (Vector.length newLines + midpoint, fn idx =>
|
Vector.tabulate (Vector.length newLines + midpoint, fn idx =>
|
||||||
if idx < midpoint then Vector.sub (rightLinesHd, idx)
|
if idx < midpoint then Vector.sub (rightLinesHd, idx)
|
||||||
else Vector.sub (newLines, idx - midpoint) + String.size strSub1)
|
else Vector.sub (newLines, idx - midpoint) + String.size strSub1)
|
||||||
|
*)
|
||||||
val _ = print "line 584\n"
|
val _ = print "line 584\n"
|
||||||
val newRightLinesHd =
|
|
||||||
VectorSlice.slice (rightLinesHd, midpoint, SOME
|
(*
|
||||||
(Vector.length rightLinesHd - midpoint))
|
val newRightLinesHd =
|
||||||
val newRightLinesHd = VectorSlice.vector newRightLinesHd
|
VectorSlice.slice (rightLinesHd, midpoint, SOME
|
||||||
|
(Vector.length rightLinesHd - midpoint))
|
||||||
|
val newRightLinesHd = VectorSlice.vector newRightLinesHd *)
|
||||||
in
|
in
|
||||||
{ idx = curIdx + String.size newLeftStringsHd
|
verifyReturn
|
||||||
, line = curLine + Vector.length newLeftLinesHd
|
{ idx = curIdx + String.size newLeftStringsHd
|
||||||
, leftStrings = newLeftStringsHd :: leftStrings
|
, line =
|
||||||
, leftLines = newLeftLinesHd :: leftLines
|
curLine + Vector.length (countLineBreaks newLeftStringsHd)
|
||||||
, rightStrings = strSub2 :: rightStringsTl
|
, leftStrings = newLeftStringsHd :: leftStrings
|
||||||
, rightLines = newRightLinesHd :: rightLinesTl
|
, leftLines = countLineBreaks newLeftStringsHd :: leftLines
|
||||||
}
|
, rightStrings = strSub2 :: rightStringsTl
|
||||||
|
, rightLines = countLineBreaks strSub2 :: rightLinesTl
|
||||||
|
}
|
||||||
end
|
end
|
||||||
else if
|
else if
|
||||||
String.size newString + String.size strSub2 <= stringLimit
|
(*
|
||||||
andalso
|
String.size newString + String.size strSub2 <= stringLimit
|
||||||
(Vector.length rightLinesHd - midpoint) + Vector.length newLines
|
andalso
|
||||||
<= vecLimit
|
(Vector.length rightLinesHd - midpoint) + Vector.length newLines
|
||||||
|
<= vecLimit
|
||||||
|
*)
|
||||||
|
false
|
||||||
then
|
then
|
||||||
(* If we can join newString/line with sub2 while staying
|
(* If we can join newString/line with sub2 while staying
|
||||||
* in limit. *)
|
* in limit. *)
|
||||||
let
|
let
|
||||||
val _ = print "line 581\n"
|
val _ = print "line 581\n"
|
||||||
val newRightStringsHd = newString ^ strSub2
|
val newRightStringsHd = newString ^ strSub2
|
||||||
val newRightLinesHd =
|
(*
|
||||||
Vector.tabulate
|
val newRightLinesHd =
|
||||||
( Vector.length newLines + Vector.length rightLinesHd - midpoint
|
Vector.tabulate
|
||||||
, fn idx =>
|
( Vector.length newLines + Vector.length rightLinesHd - midpoint
|
||||||
if idx < Vector.length newLines then
|
, fn idx =>
|
||||||
Vector.sub (newLines, idx)
|
if idx < Vector.length newLines then
|
||||||
else
|
Vector.sub (newLines, idx)
|
||||||
Vector.sub (rightLinesHd, idx - Vector.length newLines)
|
else
|
||||||
+ String.size newString
|
Vector.sub (rightLinesHd, idx - Vector.length newLines)
|
||||||
)
|
+ String.size newString
|
||||||
val newLeftLinesHd =
|
)
|
||||||
VectorSlice.slice (rightLinesHd, 0, SOME midpoint)
|
|
||||||
val newLeftLinesHd = VectorSlice.vector newLeftLinesHd
|
val newLeftLinesHd =
|
||||||
|
VectorSlice.slice (rightLinesHd, 0, SOME midpoint)
|
||||||
|
val newLeftLinesHd = VectorSlice.vector newLeftLinesHd
|
||||||
|
*)
|
||||||
in
|
in
|
||||||
{ idx = curIdx + String.size strSub1
|
verifyReturn
|
||||||
, line = curLine + Vector.length newLeftLinesHd
|
{ idx = curIdx + String.size strSub1
|
||||||
, leftStrings = strSub1 :: leftStrings
|
, line = curLine + Vector.length (countLineBreaks strSub1)
|
||||||
, leftLines = newLeftLinesHd :: leftLines
|
, leftStrings = strSub1 :: leftStrings
|
||||||
, rightStrings = newRightStringsHd :: rightStringsTl
|
, leftLines = countLineBreaks strSub1 :: leftLines
|
||||||
, rightLines = newRightLinesHd :: rightLinesTl
|
, rightStrings = newRightStringsHd :: rightStringsTl
|
||||||
}
|
, rightLines = countLineBreaks newRightStringsHd :: rightLinesTl
|
||||||
|
}
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
(* Can't join on either side while staying in limit. *)
|
(* Can't join on either side while staying in limit. *)
|
||||||
let
|
let
|
||||||
|
(* VERIFIED TO WORK *)
|
||||||
val _ = print "line 608\n"
|
val _ = print "line 608\n"
|
||||||
val lineSub1 = VectorSlice.slice (rightLinesHd, 0, SOME midpoint)
|
val lineSub1 =
|
||||||
val lineSub1 = VectorSlice.vector lineSub1
|
if midpoint >= 0 andalso Vector.length rightLinesHd > 0 then
|
||||||
val lineSub2 = VectorSlice.slice (rightLinesHd, midpoint, SOME
|
let
|
||||||
(Vector.length rightLinesHd - midpoint))
|
val lineSub1 = VectorSlice.slice
|
||||||
val lineSub2 = VectorSlice.vector lineSub2
|
(rightLinesHd, 0, SOME (midpoint + 1))
|
||||||
|
in
|
||||||
|
VectorSlice.vector lineSub1
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Vector.fromList []
|
||||||
|
|
||||||
|
val lineSub2Length =
|
||||||
|
Vector.length rightLinesHd - Vector.length lineSub1
|
||||||
|
val lineSub2 = Vector.tabulate (lineSub2Length, fn idx =>
|
||||||
|
Vector.sub (rightLinesHd, idx + Vector.length lineSub1)
|
||||||
|
- String.size strSub1)
|
||||||
in
|
in
|
||||||
{ idx = curIdx + String.size strSub1 + String.size newString
|
verifyReturn
|
||||||
, line = curLine + Vector.length lineSub1 + Vector.length newLines
|
{ idx = curIdx + String.size strSub1 + String.size newString
|
||||||
, leftStrings = newString :: strSub1 :: leftStrings
|
, line =
|
||||||
, leftLines = newLines :: lineSub1 :: leftLines
|
curLine + Vector.length (countLineBreaks newString)
|
||||||
, rightStrings = strSub2 :: rightStringsTl
|
+ Vector.length lineSub1
|
||||||
, rightLines = lineSub2 :: rightLinesTl
|
, leftStrings = newString :: strSub1 :: leftStrings
|
||||||
}
|
, leftLines = newLines :: lineSub1 :: leftLines
|
||||||
|
, rightStrings = strSub2 :: rightStringsTl
|
||||||
|
, rightLines = lineSub2 :: rightLinesTl
|
||||||
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -697,13 +885,17 @@ struct
|
|||||||
(case (leftStrings, leftLines) of
|
(case (leftStrings, leftLines) of
|
||||||
(leftStringsHd :: leftStringsTl, leftLinesHd :: leftLinesTl) =>
|
(leftStringsHd :: leftStringsTl, leftLinesHd :: leftLinesTl) =>
|
||||||
if
|
if
|
||||||
isInLimit
|
(*
|
||||||
(leftStringsHd, rightStringsHd, leftLinesHd, rightLinesHd)
|
isInLimit
|
||||||
|
(leftStringsHd, rightStringsHd, leftLinesHd, rightLinesHd)
|
||||||
|
*)
|
||||||
|
false
|
||||||
then
|
then
|
||||||
let
|
let
|
||||||
val _ = print "line 650\n"
|
val _ = print "line 650\n"
|
||||||
val nextLine = curLine + Vector.length rightLinesHd
|
val nextLine = curLine + Vector.length rightLinesHd
|
||||||
val newLeftStringsHd = leftStringsHd ^ rightStringsHd
|
val newLeftStringsHd = leftStringsHd ^ rightStringsHd
|
||||||
|
(*
|
||||||
val newLeftLinesHd =
|
val newLeftLinesHd =
|
||||||
Vector.tabulate
|
Vector.tabulate
|
||||||
( Vector.length leftLinesHd
|
( Vector.length leftLinesHd
|
||||||
@@ -715,7 +907,8 @@ struct
|
|||||||
Vector.sub
|
Vector.sub
|
||||||
(rightLinesHd, idx - Vector.length leftLinesHd)
|
(rightLinesHd, idx - Vector.length leftLinesHd)
|
||||||
+ String.size leftStringsHd
|
+ String.size leftStringsHd
|
||||||
)
|
) *)
|
||||||
|
val newLeftLinesHd = countLineBreaks newLeftStringsHd
|
||||||
in
|
in
|
||||||
moveRightAndIns
|
moveRightAndIns
|
||||||
( idx
|
( idx
|
||||||
@@ -777,13 +970,14 @@ struct
|
|||||||
let
|
let
|
||||||
val _ = print "line 723\n"
|
val _ = print "line 723\n"
|
||||||
in
|
in
|
||||||
{ idx = curIdx
|
verifyReturn
|
||||||
, line = curLine
|
{ idx = curIdx
|
||||||
, leftStrings = leftStrings
|
, line = curLine
|
||||||
, leftLines = leftLines
|
, leftStrings = leftStrings
|
||||||
, rightStrings = [newString]
|
, leftLines = leftLines
|
||||||
, rightLines = [newLines]
|
, rightStrings = [newString]
|
||||||
}
|
, rightLines = [newLines]
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
fun ins
|
fun ins
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ struct
|
|||||||
if prevChar = #"\r" then
|
if prevChar = #"\r" then
|
||||||
helpCountLineBreaks (pos - 2, (pos - 1) :: acc, str)
|
helpCountLineBreaks (pos - 2, (pos - 1) :: acc, str)
|
||||||
else
|
else
|
||||||
helpCountLineBreaks (pos - 2, pos :: acc, str)
|
helpCountLineBreaks (pos - 1, pos :: acc, str)
|
||||||
end
|
end
|
||||||
else if chr = #"\r" then
|
else if chr = #"\r" then
|
||||||
helpCountLineBreaks (pos - 1, pos :: acc, str)
|
helpCountLineBreaks (pos - 1, pos :: acc, str)
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ fun compareTxns arr =
|
|||||||
fun main () =
|
fun main () =
|
||||||
let
|
let
|
||||||
val (rope, gap) = compareTxns SvelteComponent.txns
|
val (rope, gap) = compareTxns SvelteComponent.txns
|
||||||
|
val _ = print "string contents are equal\n"
|
||||||
val _ = LineGap.verifyLines gap
|
val _ = LineGap.verifyLines gap
|
||||||
(*
|
(*
|
||||||
val _ = compareTxns Rust.txns
|
val _ = compareTxns Rust.txns
|
||||||
|
|||||||
Reference in New Issue
Block a user