src/Pure/Isar/outer_lex.ML
changeset 15531 08c8dad8e399
parent 15224 1bd35fd87963
child 16029 070ed43b86f8
equal deleted inserted replaced
15530:6f43714517ee 15531:08c8dad8e399
   184   Scan.any1 is_sym_char >> implode ||
   184   Scan.any1 is_sym_char >> implode ||
   185   Scan.one Symbol.is_symbolic;
   185   Scan.one Symbol.is_symbolic;
   186 
   186 
   187 fun is_symid str =
   187 fun is_symid str =
   188   (case try Symbol.explode str of
   188   (case try Symbol.explode str of
   189     Some [s] => Symbol.is_symbolic s orelse is_sym_char s
   189     SOME [s] => Symbol.is_symbolic s orelse is_sym_char s
   190   | Some ss => forall is_sym_char ss
   190   | SOME ss => forall is_sym_char ss
   191   | _ => false);
   191   | _ => false);
   192 
   192 
   193 val is_sid = is_symid orf Syntax.is_identifier;
   193 val is_sid = is_symid orf Syntax.is_identifier;
   194 
   194 
   195 
   195 
   280 val is_junk = (not o Symbol.is_blank) andf Symbol.not_sync andf Symbol.not_eof;
   280 val is_junk = (not o Symbol.is_blank) andf Symbol.not_sync andf Symbol.not_eof;
   281 fun recover xs = (keep_line (Scan.any is_junk) >> (fn ts => [malformed_of ts])) xs;
   281 fun recover xs = (keep_line (Scan.any is_junk) >> (fn ts => [malformed_of ts])) xs;
   282 
   282 
   283 fun source do_recover get_lex pos src =
   283 fun source do_recover get_lex pos src =
   284   Source.source' pos Symbol.stopper (Scan.bulk (fn xs => scan (get_lex ()) xs))
   284   Source.source' pos Symbol.stopper (Scan.bulk (fn xs => scan (get_lex ()) xs))
   285     (if do_recover then Some recover else None) src;
   285     (if do_recover then SOME recover else NONE) src;
   286 
   286 
   287 fun source_proper src = src |> Source.filter is_proper;
   287 fun source_proper src = src |> Source.filter is_proper;
   288 
   288 
   289 
   289 
   290 (* lexicons *)
   290 (* lexicons *)