read_idents;
authorwenzelm
Thu, 07 Oct 1999 14:32:32 +0200
changeset 7784 228283fa5de4
parent 7783 9ace4017ead8
child 7785 c06825c396e8
read_idents;
src/Pure/Syntax/lexicon.ML
--- a/src/Pure/Syntax/lexicon.ML	Thu Oct 07 14:32:18 1999 +0200
+++ b/src/Pure/Syntax/lexicon.ML	Thu Oct 07 14:32:32 1999 +0200
@@ -27,6 +27,7 @@
   val skolem: string -> string
   val dest_skolem: string -> string
   val read_nat: string -> int option
+  val read_idents: string -> string list
 end;
 
 signature LEXICON =
@@ -336,4 +337,19 @@
   apsome (#1 o Term.read_int) (Scan.read Symbol.stopper scan_digits1 (Symbol.explode str));
 
 
+(* read_ident(s) *)
+
+fun read_idents str =
+  let
+    val blanks = Scan.any Symbol.is_blank;
+    val junk = Scan.any Symbol.not_eof;
+    val idents = Scan.repeat1 (blanks |-- scan_id --| blanks) -- junk;
+  in
+    (case Scan.read Symbol.stopper idents (Symbol.explode str) of
+      Some (ids, []) => ids
+    | Some (_, bad) => error ("Bad identifier: " ^ quote (implode bad))
+    | None => error ("No identifier found in: " ^ quote str))
+  end;
+
+
 end;