equal
deleted
inserted
replaced
243 |
243 |
244 fun begin_theory master_dir {name, imports, keywords} parents = |
244 fun begin_theory master_dir {name, imports, keywords} parents = |
245 let |
245 let |
246 val thy = |
246 val thy = |
247 Theory.begin_theory name parents |
247 Theory.begin_theory name parents |
248 |> map_files (fn _ => (Path.explode (Path.implode_symbolic master_dir), imports, [])) |
248 |> map_files (fn _ => (Path.explode (File.symbolic_path master_dir), imports, [])) |
249 |> Thy_Header.add_keywords keywords; |
249 |> Thy_Header.add_keywords keywords; |
250 val ctxt = Proof_Context.init_global thy; |
250 val ctxt = Proof_Context.init_global thy; |
251 val _ = List.app (ignore o check_load_command ctxt o #load_command o #2) keywords; |
251 val _ = List.app (ignore o check_load_command ctxt o #load_command o #2) keywords; |
252 in thy end; |
252 in thy end; |
253 |
253 |
318 SOME path => check_file Path.current path |
318 SOME path => check_file Path.current path |
319 | NONE => check_file dir (thy_path (Path.basic thy_base_name))); |
319 | NONE => check_file dir (thy_path (Path.basic thy_base_name))); |
320 val text = File.read master_file; |
320 val text = File.read master_file; |
321 |
321 |
322 val {name = (name, pos), imports, keywords} = |
322 val {name = (name, pos), imports, keywords} = |
323 Thy_Header.read (Position.file (Path.implode_symbolic master_file)) text; |
323 Thy_Header.read (Position.file (File.symbolic_path master_file)) text; |
324 val _ = |
324 val _ = |
325 thy_base_name <> name andalso |
325 thy_base_name <> name andalso |
326 error ("Bad theory name " ^ quote name ^ |
326 error ("Bad theory name " ^ quote name ^ |
327 " for file " ^ Path.print (Path.base master_file) ^ Position.here pos); |
327 " for file " ^ Path.print (Path.base master_file) ^ Position.here pos); |
328 in |
328 in |
337 let |
337 let |
338 fun read_local () = |
338 fun read_local () = |
339 let |
339 let |
340 val path = File.check_file (File.full_path master_dir src_path); |
340 val path = File.check_file (File.full_path master_dir src_path); |
341 val text = File.read path; |
341 val text = File.read path; |
342 val file_pos = Position.file (Path.implode_symbolic path); |
342 val file_pos = Position.file (File.symbolic_path path); |
343 in (text, file_pos) end; |
343 in (text, file_pos) end; |
344 |
344 |
345 fun read_remote () = |
345 fun read_remote () = |
346 let |
346 let |
347 val text = Bytes.content (Isabelle_System.download file_node); |
347 val text = Bytes.content (Isabelle_System.download file_node); |
372 val pos = Input.pos_of source; |
372 val pos = Input.pos_of source; |
373 val delimited = Input.is_delimited source; |
373 val delimited = Input.is_delimited source; |
374 val src_paths = make_paths (Path.explode name); |
374 val src_paths = make_paths (Path.explode name); |
375 val reports = |
375 val reports = |
376 src_paths |> maps (fn src_path => |
376 src_paths |> maps (fn src_path => |
377 [(pos, Markup.path (Path.implode_symbolic (master_dir + src_path))), |
377 [(pos, Markup.path (File.symbolic_path (master_dir + src_path))), |
378 (pos, Markup.language_path delimited)]); |
378 (pos, Markup.language_path delimited)]); |
379 val _ = Position.reports reports; |
379 val _ = Position.reports reports; |
380 in map (read_file master_dir o rpair pos) src_paths end |
380 in map (read_file master_dir o rpair pos) src_paths end |
381 else map Exn.release files; |
381 else map Exn.release files; |
382 |
382 |
431 (case opt_dir of |
431 (case opt_dir of |
432 SOME dir => dir |
432 SOME dir => dir |
433 | NONE => master_directory (Proof_Context.theory_of ctxt)); |
433 | NONE => master_directory (Proof_Context.theory_of ctxt)); |
434 val path = dir + Path.explode name handle ERROR msg => err msg; |
434 val path = dir + Path.explode name handle ERROR msg => err msg; |
435 val _ = Path.expand path handle ERROR msg => err msg; |
435 val _ = Path.expand path handle ERROR msg => err msg; |
436 val _ = Context_Position.report ctxt pos (Markup.path (Path.implode_symbolic path)); |
436 val _ = Context_Position.report ctxt pos (Markup.path (File.symbolic_path path)); |
437 val _ = check path handle ERROR msg => err msg; |
437 val _ = check path handle ERROR msg => err msg; |
438 in path end; |
438 in path end; |
439 |
439 |
440 val check_path = formal_check I; |
440 val check_path = formal_check I; |
441 val check_file = formal_check File.check_file; |
441 val check_file = formal_check File.check_file; |