--- a/src/Pure/Isar/outer_syntax.scala Sat Oct 07 14:56:30 2017 +0200
+++ b/src/Pure/Isar/outer_syntax.scala Sat Oct 07 14:57:54 2017 +0200
@@ -18,9 +18,7 @@
def init(): Outer_Syntax = new Outer_Syntax(completion = Completion.init())
- def merge(syns: List[Outer_Syntax]): Outer_Syntax =
- if (syns.isEmpty) Thy_Header.bootstrap_syntax
- else (syns.head /: syns.tail)(_ ++ _)
+ def merge(syns: List[Outer_Syntax]): Outer_Syntax = (empty /: syns)(_ ++ _)
/* string literals */
@@ -109,6 +107,7 @@
def ++ (other: Outer_Syntax): Outer_Syntax =
if (this eq other) this
+ else if (this eq Outer_Syntax.empty) other
else {
val keywords1 = keywords ++ other.keywords
val completion1 = completion ++ other.completion
--- a/src/Pure/Thy/thy_info.scala Sat Oct 07 14:56:30 2017 +0200
+++ b/src/Pure/Thy/thy_info.scala Sat Oct 07 14:57:54 2017 +0200
@@ -49,14 +49,14 @@
val name = entry.name.theory
val imports = entry.header.imports.map(p => p._1.theory)
- if (graph.defined(name))
- error("Duplicate loaded theory entry " + quote(name))
+ val graph1 = (graph /: (name :: imports))(_.default_node(_, Outer_Syntax.empty))
+ val graph2 = (graph1 /: imports)(_.add_edge(_, name))
- for (dep <- imports if !graph.defined(dep))
- error("Missing loaded theory entry " + quote(dep) + " for " + quote(name))
+ val syntax0 = if (name == Thy_Header.PURE) List(Thy_Header.bootstrap_syntax) else Nil
+ val syntax1 = (name :: graph2.imm_preds(name).toList).map(graph2.get_node(_))
+ val syntax = Outer_Syntax.merge(syntax0 ::: syntax1) + entry.header
- val syntax = Outer_Syntax.merge(imports.map(graph.get_node(_))) + entry.header
- (graph.new_node(name, syntax) /: imports)((g, dep) => g.add_edge(dep, name))
+ graph2.map_node(name, _ => syntax)
})
def loaded_files: List[(String, List[Path])] =