--- a/src/Pure/General/path.ML Wed May 14 11:05:07 2008 +0200
+++ b/src/Pure/General/path.ML Wed May 14 11:05:08 2008 +0200
@@ -26,6 +26,7 @@
val ext: string -> T -> T
val split_ext: T -> T * string
val expand: T -> T
+ val position: T -> Position.T
end;
structure Path: PATH =
@@ -153,6 +154,11 @@
val expand = rep #> maps eval #> norm #> Path;
+(* source position *)
+
+val position = Position.file o implode_path o expand;
+
+
(*final declarations of this structure!*)
val implode = implode_path;
val explode = explode_path;
--- a/src/Pure/Isar/outer_syntax.ML Wed May 14 11:05:07 2008 +0200
+++ b/src/Pure/Isar/outer_syntax.ML Wed May 14 11:05:08 2008 +0200
@@ -234,7 +234,7 @@
fun process_file path thy =
let
val result = ref thy;
- val trs = parse (Position.path path) (File.read path);
+ val trs = parse (Path.position path) (File.read path);
val init = Toplevel.init_theory (K thy) (fn thy' => result := thy') (K ());
val _ = Toplevel.excursion (init Toplevel.empty :: trs @ [Toplevel.exit Toplevel.empty]);
in ! result end;
--- a/src/Pure/ML/ml_context.ML Wed May 14 11:05:07 2008 +0200
+++ b/src/Pure/ML/ml_context.ML Wed May 14 11:05:08 2008 +0200
@@ -187,7 +187,7 @@
(* ML evaluation *)
val eval = eval_wrapper Output.ml_output;
-fun eval_file path = eval true (Position.path path) (File.read path);
+fun eval_file path = eval true (Path.position path) (File.read path);
fun eval_in context verbose pos txt =
Context.setmp_thread_data context (fn () => eval verbose pos txt) ();
--- a/src/Pure/Thy/thy_edit.ML Wed May 14 11:05:07 2008 +0200
+++ b/src/Pure/Thy/thy_edit.ML Wed May 14 11:05:08 2008 +0200
@@ -116,7 +116,7 @@
(* HTML presentation -- example *)
fun present_html inpath outpath =
- Source.exhaust (item_source (Position.path inpath) (Source.of_string (File.read inpath)))
+ Source.exhaust (item_source (Path.position inpath) (Source.of_string (File.read inpath)))
|> HTML.html_mode (implode o map present_item)
|> enclose
(HTML.begin_document (Path.implode (Path.base inpath)) ^ "<div class=\"source\"><pre>")
--- a/src/Pure/Thy/thy_info.ML Wed May 14 11:05:07 2008 +0200
+++ b/src/Pure/Thy/thy_info.ML Wed May 14 11:05:08 2008 +0200
@@ -307,7 +307,7 @@
val (pos, text, files) =
(case get_deps name of
SOME {master = SOME (master_path, _), text as _ :: _, files, ...} =>
- (Position.path master_path, text, files)
+ (Path.position master_path, text, files)
| _ => error (loader_msg "corrupted dependency information" [name]));
val _ = touch_thy name;
val _ = CRITICAL (fn () =>
--- a/src/Pure/Thy/thy_load.ML Wed May 14 11:05:07 2008 +0200
+++ b/src/Pure/Thy/thy_load.ML Wed May 14 11:05:08 2008 +0200
@@ -98,7 +98,7 @@
val master as (path, _) = check_thy dir name;
val text = explode (File.read path);
val (name', imports, uses) =
- ThyHeader.read (Position.path path) (Source.of_list_limited 8000 text);
+ ThyHeader.read (Path.position path) (Source.of_list_limited 8000 text);
val _ = name = name' orelse
error ("Filename " ^ quote (Path.implode (Path.base path)) ^
" does not agree with theory name " ^ quote name');