fun is_ascii_letter c = #"A" <= c andalso c <= #"Z" orelse #"a" <= c andalso c <= #"z"; fun is_ascii_letdig c =
is_ascii_letter c orelse #"0" <= c andalso c <= #"9" orelse c = #"_" orelse c = #"'";
fun is_utf8 c = c >= #"\128"; fun is_utf8_trailer c = #"\128" <= c andalso c < #"\192"; fun is_utf8_control c = #"\128" <= c andalso c < #"\160";
fun explode string = let val char = String.nth string; funsubstring i j = String.substring (string, i, j - i);
val n = sizestring; funtest pred i = i < n andalso pred (char i); fun many pred i = iftest pred i then many pred (i + 1) else i; fun maybe_char c i = iftest (fn c' => c = c') i then i + 1 else i; fun maybe_ascii_id i = iftest is_ascii_letter i then many is_ascii_letdig (i + 1) else i;
fun scan i = if i < n then letval ch = char i in (*encoded newline*) if ch = #"\^M"then"\n" :: scan (maybe_char #"\n" (i + 1)) (*pseudo utf8: encoded ascii control*) elseif ch = #"\192" andalso test is_utf8_control (i + 1) andalso not (test is_utf8 (i + 2)) thenchr (Char.ord (char (i + 1)) - 128) :: scan (i + 2) (*utf8*) elseif is_utf8 ch then letval j = many is_utf8_trailer (i + 1) insubstring i j :: scan j end (*named symbol*) elseif ch = #"\\" andalso test (fn c => c = #"<") (i + 1) then letval j = (i + 2) |> maybe_char #"^" |> maybe_ascii_id |> maybe_char #">" insubstring i j :: scan j end (*single character*) elseString.str ch :: scan (i + 1) end else []; in scan 0 end;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.