--- a/src/Pure/General/symbol.ML Sat Oct 17 16:08:30 2015 +0200
+++ b/src/Pure/General/symbol.ML Sun Oct 18 17:20:20 2015 +0200
@@ -15,6 +15,7 @@
val is_symbolic: symbol -> bool
val is_symbolic_char: symbol -> bool
val is_printable: symbol -> bool
+ val is_control: symbol -> bool
val eof: symbol
val is_eof: symbol -> bool
val not_eof: symbol -> bool
@@ -108,6 +109,9 @@
if is_char s then ord space <= ord s andalso ord s <= ord "~"
else is_utf8 s orelse raw_symbolic s;
+fun is_control s =
+ String.isPrefix "\\<^" s andalso String.isSuffix ">" s;
+
(* input source control *)
@@ -228,7 +232,7 @@
else if is_utf8 s then UTF8 s
else if is_raw s then Raw (decode_raw s)
else if is_malformed s then Malformed s
- else if String.isPrefix "\\<^" s then Ctrl (String.substring (s, 3, size s - 4))
+ else if is_control s then Ctrl (String.substring (s, 3, size s - 4))
else Sym (String.substring (s, 2, size s - 3));
--- a/src/Pure/General/symbol.scala Sat Oct 17 16:08:30 2015 +0200
+++ b/src/Pure/General/symbol.scala Sun Oct 18 17:20:20 2015 +0200
@@ -521,7 +521,7 @@
/* control symbols */
def is_control(sym: Symbol): Boolean =
- sym.startsWith("\\<^") || symbols.control_decoded.contains(sym)
+ (sym.startsWith("\\<^") && sym.endsWith(">")) || symbols.control_decoded.contains(sym)
def is_controllable(sym: Symbol): Boolean =
!is_blank(sym) && !is_control(sym) && !is_open(sym) && !is_close(sym) && !is_malformed(sym)
--- a/src/Pure/Thy/term_style.ML Sat Oct 17 16:08:30 2015 +0200
+++ b/src/Pure/Thy/term_style.ML Sun Oct 18 17:20:20 2015 +0200
@@ -67,7 +67,7 @@
end);
fun sub_symbols (d :: s :: ss) =
- if Symbol.is_ascii_digit d andalso not (String.isPrefix ("\<^") s)
+ if Symbol.is_ascii_digit d andalso not (Symbol.is_control s)
then d :: "\<^sub>" :: sub_symbols (s :: ss)
else d :: s :: ss
| sub_symbols cs = cs;