equal
deleted
inserted
replaced
47 fun split_lines input = |
47 fun split_lines input = |
48 let |
48 let |
49 fun add a (line, lines) = (a :: line, lines); |
49 fun add a (line, lines) = (a :: line, lines); |
50 fun flush (line, lines) = ([], rev line :: lines); |
50 fun flush (line, lines) = ([], rev line :: lines); |
51 fun split (a as Text ss) = |
51 fun split (a as Text ss) = |
52 (case take_prefix (fn ("\n", _) => false | _ => true) ss of |
52 (case chop_prefix (fn ("\n", _) => false | _ => true) ss of |
53 ([], []) => I |
53 ([], []) => I |
54 | (_, []) => add a |
54 | (_, []) => add a |
55 | ([], _ :: rest) => flush #> split (Text rest) |
55 | ([], _ :: rest) => flush #> split (Text rest) |
56 | (prefix, _ :: rest) => add (Text prefix) #> flush #> split (Text rest)) |
56 | (prefix, _ :: rest) => add (Text prefix) #> flush #> split (Text rest)) |
57 | split a = add a; |
57 | split a = add a; |