more robust: Pure entities may lack id;
authorwenzelm
Tue, 28 Aug 2018 15:25:28 +0200
changeset 68835 2e59da922630
parent 68832 9b9fc9ea9dd1
child 68836 cf52379c0776
more robust: Pure entities may lack id;
src/Pure/Thy/export_theory.scala
--- a/src/Pure/Thy/export_theory.scala	Tue Aug 28 12:42:57 2018 +0200
+++ b/src/Pure/Thy/export_theory.scala	Tue Aug 28 15:25:28 2018 +0200
@@ -156,7 +156,8 @@
     val CLASS = Value("class")
   }
 
-  sealed case class Entity(kind: Kind.Value, name: String, pos: Position.T, id: Long, serial: Long)
+  sealed case class Entity(
+    kind: Kind.Value, name: String, pos: Position.T, id: Option[Long], serial: Long)
   {
     override def toString: String = kind.toString + " " + quote(name)
 
@@ -172,7 +173,7 @@
       case XML.Elem(Markup(Markup.ENTITY, props), body) =>
         val name = Markup.Name.unapply(props) getOrElse err()
         val pos = props.filter({ case (a, _) => Markup.POSITION_PROPERTIES(a) && a != Markup.ID })
-        val id = Position.Id.unapply(props) getOrElse err()
+        val id = Position.Id.unapply(props)
         val serial = Markup.Serial.unapply(props) getOrElse err()
         (Entity(kind, name, pos, id, serial), body)
       case _ => err()