src/Pure/Syntax/symbol.ML
changeset 4959 4ebdea556457
parent 4938 c8bbbf3c59fa
child 5112 9e74cf11e4a4
equal deleted inserted replaced
4958:ad2acb8d2db4 4959:4ebdea556457
    22   val is_printable: symbol -> bool
    22   val is_printable: symbol -> bool
    23   val scan: string list -> symbol * string list
    23   val scan: string list -> symbol * string list
    24   val explode: string -> symbol list
    24   val explode: string -> symbol list
    25   val input: string -> string
    25   val input: string -> string
    26   val output: string -> string
    26   val output: string -> string
       
    27   val source: bool -> (string, 'a) Source.source ->
       
    28     (symbol, (string, 'a) Source.source) Source.source
    27 end;
    29 end;
    28 
    30 
    29 structure Symbol: SYMBOL =
    31 structure Symbol: SYMBOL =
    30 struct
    32 struct
    31 
    33 
   208     !! (fn (cs, _) => "Malformed symbolic character specification: \\" ^ "<" ^ beginning cs)
   210     !! (fn (cs, _) => "Malformed symbolic character specification: \\" ^ "<" ^ beginning cs)
   209       (Scan.optional ($$ "^") "" ^^ scan_id ^^ $$ ">") ||
   211       (Scan.optional ($$ "^") "" ^^ scan_id ^^ $$ ">") ||
   210   Scan.one not_eof;
   212   Scan.one not_eof;
   211 
   213 
   212 
   214 
       
   215 (* source *)
       
   216 
       
   217 val recover = Scan.any1 ((not o is_blank) andf not_eof);
       
   218 
       
   219 fun source do_recover src =
       
   220   Source.source stopper (Scan.bulk scan) (if do_recover then Some recover else None) src;
       
   221 
       
   222 
   213 (* explode *)
   223 (* explode *)
   214 
   224 
   215 fun no_syms [] = true
   225 fun no_syms [] = true
   216   | no_syms ("\\" :: "<" :: _) = false
   226   | no_syms ("\\" :: "<" :: _) = false
   217   | no_syms (c :: cs) = ord c < enc_start andalso no_syms cs;
   227   | no_syms (c :: cs) = ord c < enc_start andalso no_syms cs;