equal
deleted
inserted
replaced
28 val UNSORTED = "Unsorted" |
28 val UNSORTED = "Unsorted" |
29 val DRAFT = "Draft" |
29 val DRAFT = "Draft" |
30 |
30 |
31 def is_pure(name: String): Boolean = name == Thy_Header.PURE |
31 def is_pure(name: String): Boolean = name == Thy_Header.PURE |
32 |
32 |
33 def exclude_session(name: String): Boolean = name == "" || name == DRAFT |
33 def illegal_session(name: String): Boolean = name == "" || name == DRAFT |
34 def exclude_theory(name: String): Boolean = name == root_name || name == "bib" |
34 def illegal_theory(name: String): Boolean = name == root_name || name == "bib" |
35 |
35 |
36 |
36 |
37 /* ROOTS file format */ |
37 /* ROOTS file format */ |
38 |
38 |
39 class File_Format extends isabelle.File_Format { |
39 class File_Format extends isabelle.File_Format { |
555 entry: Session_Entry |
555 entry: Session_Entry |
556 ): Info = { |
556 ): Info = { |
557 try { |
557 try { |
558 val name = entry.name |
558 val name = entry.name |
559 |
559 |
560 if (exclude_session(name)) error("Bad session name") |
560 if (illegal_session(name)) error("Illegal session name " + quote(name)) |
561 if (is_pure(name) && entry.parent.isDefined) error("Illegal parent session") |
561 if (is_pure(name) && entry.parent.isDefined) error("Illegal parent session") |
562 if (!is_pure(name) && !entry.parent.isDefined) error("Missing parent session") |
562 if (!is_pure(name) && !entry.parent.isDefined) error("Missing parent session") |
563 |
563 |
564 val session_path = dir + Path.explode(entry.path) |
564 val session_path = dir + Path.explode(entry.path) |
565 val directories = entry.directories.map(dir => session_path + Path.explode(dir)) |
565 val directories = entry.directories.map(dir => session_path + Path.explode(dir)) |
568 |
568 |
569 val theories = |
569 val theories = |
570 entry.theories.map({ case (opts, thys) => |
570 entry.theories.map({ case (opts, thys) => |
571 (session_options ++ opts, |
571 (session_options ++ opts, |
572 thys.map({ case ((thy, pos), _) => |
572 thys.map({ case ((thy, pos), _) => |
573 if (exclude_theory(thy)) |
573 if (illegal_theory(thy)) { |
574 error("Bad theory name " + quote(thy) + Position.here(pos)) |
574 error("Illegal theory name " + quote(thy) + Position.here(pos)) |
|
575 } |
575 else (thy, pos) })) }) |
576 else (thy, pos) })) }) |
576 |
577 |
577 val global_theories = |
578 val global_theories = |
578 for { (_, thys) <- entry.theories; ((thy, pos), global) <- thys if global } |
579 for { (_, thys) <- entry.theories; ((thy, pos), global) <- thys if global } |
579 yield { |
580 yield { |