What the line cutter returns #
LineCut cuts a stream of chunks into lines as the chunks arrive. linesSpec says what the
lines of a text are, on the whole text as a list of bytes: cut at every line feed, number the
lines from 1, take the byte order mark off the first one, drop the blank ones.
cutLines_eq proves that cutLines returns exactly that for the chunks put together. So where
the chunks end does not matter (cutLines_chunks), and no line is lost, joined or split.
lineRanges_eq proves the same cut for the ranges used on a text held as a whole.
Split a list of bytes at every line feed.
Equations
Instances For
A numbered line as the cutter returns it: as a byte array, without a byte order mark if it is line 1.
Equations
Instances For
What LineCut.feedLoop does from byte p of a chunk on, when the current line (the kept
bytes, then bytes start to p of the chunk) has no line feed: it returns some lines X, and
for any text R that follows, the lines of everything are X, then the lines of the new kept
bytes and R, numbered from the new line number.
What LineCut.feed does with a chunk (see feedLoop_spec).
What feeding a list of chunks does (see feedLoop_spec).
cutLines returns the lines of the text. For any way of cutting a text into chunks,
cutLines on the chunks gives the numbered non-blank lines of the whole text (linesSpec).
Where the chunks end does not matter: two ways of cutting the same text into chunks give the same lines.
lineRanges cuts at every line feed: the byte ranges it returns are the lines of the
bytes from start on.