src/Pure/General/antiquote.ML
changeset 67522 9e712280cc37
parent 67467 482b62d694ca
child 67571 f858fe5531ac
equal deleted inserted replaced
67521:6a27e86cc2e7 67522:9e712280cc37
    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;