clarified signature;
authorwenzelm
Mon, 19 Aug 2019 21:31:54 +0200
changeset 70580 e6101f131d0d
parent 70579 5a8e3e4b3760
child 70581 ea860617fac1
clarified signature;
src/Pure/thm_name.scala
--- a/src/Pure/thm_name.scala	Mon Aug 19 21:23:13 2019 +0200
+++ b/src/Pure/thm_name.scala	Mon Aug 19 21:31:54 2019 +0200
@@ -22,11 +22,19 @@
   }
 
   def graph[A]: Graph[Thm_Name, A] = Graph.empty(Ordering)
+
+  private val Thm_Name_Regex = """^(.)+\((\d+)\)$""".r
+
+  def parse(s: String): Thm_Name =
+    s match {
+      case Thm_Name_Regex(name, Value.Nat(index)) => Thm_Name(name, index)
+      case _ => Thm_Name(s, 0)
+    }
 }
 
 sealed case class Thm_Name(name: String, index: Int)
 {
-  override def toString: String =
+  def print: String =
     if (name == "" || index == 0) name
     else name + "(" + index + ")"