equal
deleted
inserted
replaced
191 (theory_files ::: loaded_files.flatMap(_._2) ::: |
191 (theory_files ::: loaded_files.flatMap(_._2) ::: |
192 info.document_files.map(file => info.dir + file._1 + file._2)).map(_.expand) |
192 info.document_files.map(file => info.dir + file._1 + file._2)).map(_.expand) |
193 |
193 |
194 val imported_files = if (inlined_files) dependencies.imported_files else Nil |
194 val imported_files = if (inlined_files) dependencies.imported_files else Nil |
195 |
195 |
196 if (list_files) |
196 if (list_files) { |
197 progress.echo(cat_lines(session_files.map(_.implode).sorted.map(" " + _))) |
197 progress.echo(cat_lines(session_files.map(_.implode).sorted.map(" " + _))) |
|
198 } |
198 |
199 |
199 if (check_keywords.nonEmpty) { |
200 if (check_keywords.nonEmpty) { |
200 Check_Keywords.check_keywords( |
201 Check_Keywords.check_keywords( |
201 progress, overall_syntax.keywords, check_keywords, theory_files) |
202 progress, overall_syntax.keywords, check_keywords, theory_files) |
202 } |
203 } |
205 def session_node(name: String): Graph_Display.Node = |
206 def session_node(name: String): Graph_Display.Node = |
206 Graph_Display.Node("[" + name + "]", "session." + name) |
207 Graph_Display.Node("[" + name + "]", "session." + name) |
207 |
208 |
208 def node(name: Document.Node.Name): Graph_Display.Node = { |
209 def node(name: Document.Node.Name): Graph_Display.Node = { |
209 val qualifier = sessions_structure.theory_qualifier(name) |
210 val qualifier = sessions_structure.theory_qualifier(name) |
210 if (qualifier == info.name) |
211 if (qualifier == info.name) { |
211 Graph_Display.Node(name.theory_base_name, "theory." + name.theory) |
212 Graph_Display.Node(name.theory_base_name, "theory." + name.theory) |
|
213 } |
212 else session_node(qualifier) |
214 else session_node(qualifier) |
213 } |
215 } |
214 |
216 |
215 val required_sessions = |
217 val required_sessions = |
216 dependencies.loaded_theories.all_preds(dependencies.theories.map(_.theory)) |
218 dependencies.loaded_theories.all_preds(dependencies.theories.map(_.theory)) |
588 |
590 |
589 val global_theories = |
591 val global_theories = |
590 for { (_, thys) <- entry.theories; ((thy, pos), global) <- thys if global } |
592 for { (_, thys) <- entry.theories; ((thy, pos), global) <- thys if global } |
591 yield { |
593 yield { |
592 val thy_name = Path.explode(thy).file_name |
594 val thy_name = Path.explode(thy).file_name |
593 if (Long_Name.is_qualified(thy_name)) |
595 if (Long_Name.is_qualified(thy_name)) { |
594 error("Bad qualified name for global theory " + |
596 error("Bad qualified name for global theory " + |
595 quote(thy_name) + Position.here(pos)) |
597 quote(thy_name) + Position.here(pos)) |
|
598 } |
596 else thy_name |
599 else thy_name |
597 } |
600 } |
598 |
601 |
599 val conditions = |
602 val conditions = |
600 theories.flatMap(thys => space_explode(',', thys._1.string("condition"))).distinct.sorted. |
603 theories.flatMap(thys => space_explode(',', thys._1.string("condition"))).distinct.sorted. |
662 graph: Graph[String, Info], |
665 graph: Graph[String, Info], |
663 kind: String, |
666 kind: String, |
664 edges: Info => Iterable[String] |
667 edges: Info => Iterable[String] |
665 ) : Graph[String, Info] = { |
668 ) : Graph[String, Info] = { |
666 def add_edge(pos: Position.T, name: String, g: Graph[String, Info], parent: String) = { |
669 def add_edge(pos: Position.T, name: String, g: Graph[String, Info], parent: String) = { |
667 if (!g.defined(parent)) |
670 if (!g.defined(parent)) { |
668 error("Bad " + kind + " session " + quote(parent) + " for " + |
671 error("Bad " + kind + " session " + quote(parent) + " for " + |
669 quote(name) + Position.here(pos)) |
672 quote(name) + Position.here(pos)) |
|
673 } |
670 |
674 |
671 try { g.add_edge_acyclic(parent, name) } |
675 try { g.add_edge_acyclic(parent, name) } |
672 catch { |
676 catch { |
673 case exn: Graph.Cycles[_] => |
677 case exn: Graph.Cycles[_] => |
674 error(cat_lines(exn.cycles.map(cycle => |
678 error(cat_lines(exn.cycles.map(cycle => |
683 } |
687 } |
684 |
688 |
685 val info_graph = |
689 val info_graph = |
686 infos.foldLeft(Graph.string[Info]) { |
690 infos.foldLeft(Graph.string[Info]) { |
687 case (graph, info) => |
691 case (graph, info) => |
688 if (graph.defined(info.name)) |
692 if (graph.defined(info.name)) { |
689 error("Duplicate session " + quote(info.name) + Position.here(info.pos) + |
693 error("Duplicate session " + quote(info.name) + Position.here(info.pos) + |
690 Position.here(graph.get_node(info.name).pos)) |
694 Position.here(graph.get_node(info.name).pos)) |
|
695 } |
691 else graph.new_node(info.name, info) |
696 else graph.new_node(info.name, info) |
692 } |
697 } |
693 val build_graph = add_edges(info_graph, "parent", _.parent) |
698 val build_graph = add_edges(info_graph, "parent", _.parent) |
694 val imports_graph = add_edges(build_graph, "imports", _.imports) |
699 val imports_graph = add_edges(build_graph, "imports", _.imports) |
695 |
700 |
782 global_theories.getOrElse(name, Long_Name.qualifier(name)) |
787 global_theories.getOrElse(name, Long_Name.qualifier(name)) |
783 def theory_qualifier(name: Document.Node.Name): String = theory_qualifier(name.theory) |
788 def theory_qualifier(name: Document.Node.Name): String = theory_qualifier(name.theory) |
784 |
789 |
785 def check_sessions(names: List[String]): Unit = { |
790 def check_sessions(names: List[String]): Unit = { |
786 val bad_sessions = SortedSet(names.filterNot(defined): _*).toList |
791 val bad_sessions = SortedSet(names.filterNot(defined): _*).toList |
787 if (bad_sessions.nonEmpty) |
792 if (bad_sessions.nonEmpty) { |
788 error("Undefined session(s): " + commas_quote(bad_sessions)) |
793 error("Undefined session(s): " + commas_quote(bad_sessions)) |
|
794 } |
789 } |
795 } |
790 |
796 |
791 def check_sessions(sel: Selection): Unit = |
797 def check_sessions(sel: Selection): Unit = |
792 check_sessions(sel.base_sessions ::: sel.exclude_sessions ::: sel.sessions) |
798 check_sessions(sel.base_sessions ::: sel.exclude_sessions ::: sel.sessions) |
793 |
799 |