--- a/src/Pure/General/symbol.ML Sat Jun 05 13:07:04 2004 +0200
+++ b/src/Pure/General/symbol.ML Sat Jun 05 13:07:19 2004 +0200
@@ -30,6 +30,9 @@
val is_raw: symbol -> bool
val decode_raw: symbol -> string
val encode_raw: string -> symbol list
+ datatype sym = Char of string | Sym of string | Ctrl of string | Raw of string
+ exception DECODE of string
+ val decode: symbol -> sym
datatype kind = Letter | Digit | Quasi | Blank | Other
val kind: symbol -> kind
val is_letter: symbol -> bool
@@ -166,6 +169,20 @@
end;
+(* symbol variants *)
+
+datatype sym = Char of string | Sym of string | Ctrl of string | Raw of string;
+
+exception DECODE of string;
+
+fun decode s =
+ if is_char s then Char s
+ else if is_raw s then Raw (decode_raw s)
+ else if String.isPrefix "\\<^" s then Ctrl (String.substring (s, 3, size s - 4))
+ else if String.isPrefix "\\<" s then Sym (String.substring (s, 2, size s - 3))
+ else raise DECODE s; (*NB: no error message in order to avoid looping in output!*)
+
+
(* standard symbol kinds *)
datatype kind = Letter | Digit | Quasi | Blank | Other;