more general Thy_Load.import_name, e.g. relevant for Isabelle/eclipse -- NB: Thy_Load serves as main hub for funny overriding to adapt to provers and editors;
authorwenzelm
Mon, 08 Apr 2013 14:18:39 +0200
changeset 51634 553953ad8165
parent 51630 603436283686
child 51635 e8e027aa694f
more general Thy_Load.import_name, e.g. relevant for Isabelle/eclipse -- NB: Thy_Load serves as main hub for funny overriding to adapt to provers and editors;
src/Pure/Thy/thy_load.scala
--- a/src/Pure/Thy/thy_load.scala	Sun Apr 07 15:08:34 2013 +0200
+++ b/src/Pure/Thy/thy_load.scala	Mon Apr 08 14:18:39 2013 +0200
@@ -56,18 +56,6 @@
 
   /* theory files */
 
-  private def import_name(dir: String, s: String): Document.Node.Name =
-  {
-    val theory = Thy_Header.base_name(s)
-    if (loaded_theories(theory)) Document.Node.Name(theory, "", theory)
-    else {
-      val path = Path.explode(s)
-      val node = append(dir, Thy_Load.thy_path(path))
-      val dir1 = append(dir, path.dir)
-      Document.Node.Name(node, dir1, theory)
-    }
-  }
-
   private def find_file(tokens: List[Token]): Option[String] =
   {
     def clean(toks: List[Token]): List[Token] =
@@ -103,6 +91,18 @@
     }).flatten.toList
   }
 
+  def import_name(master: Document.Node.Name, s: String): Document.Node.Name =
+  {
+    val theory = Thy_Header.base_name(s)
+    if (loaded_theories(theory)) Document.Node.Name(theory, "", theory)
+    else {
+      val path = Path.explode(s)
+      val node = append(master.dir, Thy_Load.thy_path(path))
+      val dir = append(master.dir, path.dir)
+      Document.Node.Name(node, dir, theory)
+    }
+  }
+
   def check_thy_text(name: Document.Node.Name, text: CharSequence): Document.Node.Header =
   {
     try {
@@ -113,7 +113,7 @@
         error("Bad file name " + Thy_Load.thy_path(Path.basic(name.theory)) +
           " for theory " + quote(name1))
 
-      val imports = header.imports.map(import_name(name.dir, _))
+      val imports = header.imports.map(import_name(name, _))
       Document.Node.Header(imports, header.keywords, Nil)
     }
     catch { case exn: Throwable => Document.Node.bad_header(Exn.message(exn)) }