src/Pure/Isar/outer_syntax.ML
changeset 15973 5fd94d84470f
parent 15830 74d8412b1a27
child 15989 80dd2f5780df
equal deleted inserted replaced
15972:8ac3803c8f73 15973:5fd94d84470f
   278 
   278 
   279 fun read toks =
   279 fun read toks =
   280   Source.of_list toks
   280   Source.of_list toks
   281   |> toplevel_source false true true get_parser
   281   |> toplevel_source false true true get_parser
   282   |> Source.exhaust
   282   |> Source.exhaust
   283   |> map (fn tr => (Toplevel.name_of tr, valOf (Toplevel.source_of tr), tr));
   283   |> map (fn tr => (Toplevel.name_of tr, the (Toplevel.source_of tr), tr));
   284 
   284 
   285 
   285 
   286 (** read theory **)
   286 (** read theory **)
   287 
   287 
   288 (* check_text *)
   288 (* check_text *)
   297   let
   297   let
   298     val src = Source.of_string (File.read path);
   298     val src = Source.of_string (File.read path);
   299     val pos = Path.position path;
   299     val pos = Path.position path;
   300     val (name', parents, files) = ThyHeader.scan (src, pos);
   300     val (name', parents, files) = ThyHeader.scan (src, pos);
   301     val ml_path = ThyLoad.ml_path name;
   301     val ml_path = ThyLoad.ml_path name;
   302     val ml_file = if ml andalso isSome (ThyLoad.check_file NONE ml_path) then [ml_path] else [];
   302     val ml_file = if ml andalso is_some (ThyLoad.check_file NONE ml_path) then [ml_path] else [];
   303   in
   303   in
   304     if name <> name' then
   304     if name <> name' then
   305       error ("Filename " ^ quote (Path.pack path) ^
   305       error ("Filename " ^ quote (Path.pack path) ^
   306         " does not agree with theory name " ^ quote name')
   306         " does not agree with theory name " ^ quote name')
   307     else (parents, map (Path.unpack o #1) files @ ml_file)
   307     else (parents, map (Path.unpack o #1) files @ ml_file)