src/Pure/Thy/bibtex.scala
changeset 67300 0bfbf5b9d6ba
parent 67293 2fe338d91d47
child 67301 e255c76db052
equal deleted inserted replaced
67299:ba52a058942f 67300:0bfbf5b9d6ba
    20 
    20 
    21   def bibtex_errors(dir: Path, root_name: String): List[String] =
    21   def bibtex_errors(dir: Path, root_name: String): List[String] =
    22   {
    22   {
    23     val log_path = dir + Path.explode(root_name).ext("blg")
    23     val log_path = dir + Path.explode(root_name).ext("blg")
    24     if (log_path.is_file) {
    24     if (log_path.is_file) {
    25       val Error = """^(.*)---line (\d+) of file (.+)""".r
    25       val Error1 = """^(I couldn't open database file .+)$""".r
       
    26       val Error2 = """^(.+)---line (\d+) of file (.+)""".r
    26       Line.logical_lines(File.read(log_path)).flatMap(line =>
    27       Line.logical_lines(File.read(log_path)).flatMap(line =>
    27         line match {
    28         line match {
    28           case Error(msg, Value.Int(l), file) =>
    29           case Error1(msg) => Some("Bibtex error: " + msg)
       
    30           case Error2(msg, Value.Int(l), file) =>
    29             val path = File.standard_path(file)
    31             val path = File.standard_path(file)
    30             if (Path.is_wellformed(path)) {
    32             if (Path.is_wellformed(path)) {
    31               val pos = Position.Line_File(l, (dir + Path.explode(path)).canonical.implode)
    33               val pos = Position.Line_File(l, (dir + Path.explode(path)).canonical.implode)
    32               Some("Bibtex error" + Position.here(pos) + ":\n  " + msg)
    34               Some("Bibtex error" + Position.here(pos) + ":\n  " + msg)
    33             }
    35             }