text_of: make double sure that result is well-formed, to avoid recurrent failures;
authorwenzelm
Sat, 08 Dec 2007 21:20:05 +0100
changeset 25582 655453e635c4
parent 25581 f2b137c3e725
child 25583 72e71bcf4239
text_of: make double sure that result is well-formed, to avoid recurrent failures;
src/Pure/Isar/outer_lex.ML
--- a/src/Pure/Isar/outer_lex.ML	Sat Dec 08 21:14:51 2007 +0100
+++ b/src/Pure/Isar/outer_lex.ML	Sat Dec 08 21:20:05 2007 +0100
@@ -162,7 +162,10 @@
   else
     let
       val k = str_of_kind (kind_of tok);
-      val s = unparse tok;
+      val txt = unparse tok;
+      val s =
+        if can Symbol.explode txt
+        then txt else Output.escape_malformed txt;
     in
       if s = "" then (k, "")
       else if size s < 40 andalso not (exists_string (fn c => c = "\n") s) then (k ^ " " ^ s, "")