tuned Symbol.spaces;
authorwenzelm
Tue, 16 Aug 2005 13:42:34 +0200
changeset 17063 502105583951
parent 17062 7272b45099c7
child 17064 2fae6579fb2e
tuned Symbol.spaces;
src/Pure/General/symbol.ML
--- a/src/Pure/General/symbol.ML	Tue Aug 16 13:42:33 2005 +0200
+++ b/src/Pure/General/symbol.ML	Tue Aug 16 13:42:34 2005 +0200
@@ -82,7 +82,15 @@
 type symbol = string;
 
 val space = " ";
-fun spaces k = Library.replicate_string k space;
+
+local
+  val small_spaces = Vector.tabulate (65, fn i => Library.replicate_string i space);
+in
+  fun spaces k =
+    if k < 64 then Vector.sub (small_spaces, k)
+    else Library.replicate_string (k div 64) (Vector.sub (small_spaces, 64)) ^
+      Vector.sub (small_spaces, k mod 64);
+end;
 
 fun is_char s = size s = 1;
 
@@ -170,7 +178,7 @@
 (* decode_raw *)
 
 fun is_raw s =
-  String.isPrefix "\\<^raw" s andalso String.substring (s, size s - 1, 1) = ">";
+  String.isPrefix "\\<^raw" s andalso String.isSuffix ">" s;
 
 fun decode_raw s =
   if not (is_raw s) then error (malformed_symbol s)