Document.Node.Name convenience;
authorwenzelm
Sat, 17 Sep 2011 23:04:03 +0200
changeset 44959 9476c856c4b9
parent 44958 86e4916825ee
child 44960 640c2b957f16
Document.Node.Name convenience;
src/Pure/PIDE/command.scala
src/Pure/PIDE/document.scala
--- a/src/Pure/PIDE/command.scala	Sat Sep 17 22:13:15 2011 +0200
+++ b/src/Pure/PIDE/command.scala	Sat Sep 17 23:04:03 2011 +0200
@@ -80,7 +80,7 @@
   /* dummy commands */
 
   def unparsed(source: String): Command =
-    new Command(Document.no_id, Document.Node.Name("", "", ""),
+    new Command(Document.no_id, Document.Node.Name.empty,
       List(Token(Token.Kind.UNPARSED, source)))
 
   def span(node_name: Document.Node.Name, toks: List[Token]): Command =
--- a/src/Pure/PIDE/document.scala	Sat Sep 17 22:13:15 2011 +0200
+++ b/src/Pure/PIDE/document.scala	Sat Sep 17 23:04:03 2011 +0200
@@ -42,6 +42,13 @@
     object Name
     {
       val empty = Name("", "", "")
+      def apply(path: Path): Name =
+      {
+        val node = path.implode
+        val dir = path.dir.implode
+        val theory = Thy_Header.thy_name(node) getOrElse error("Bad theory file name: " + path)
+        Name(node, dir, theory)
+      }
     }
     sealed case class Name(node: String, dir: String, theory: String)
     {