src/Pure/Thy/bibtex.scala
changeset 69294 085f31ae902d
parent 69259 438e1a11445f
child 69366 b6dacf6eabe3
equal deleted inserted replaced
69293:72a9860f8602 69294:085f31ae902d
   123 
   123 
   124       val log_file = tmp_dir + Path.explode("root.blg")
   124       val log_file = tmp_dir + Path.explode("root.blg")
   125       val lines = if (log_file.is_file) Line.logical_lines(File.read(log_file)) else Nil
   125       val lines = if (log_file.is_file) Line.logical_lines(File.read(log_file)) else Nil
   126 
   126 
   127       val (errors, warnings) =
   127       val (errors, warnings) =
   128         lines.zip(lines.tail ::: List("")).flatMap(
   128         if (lines.isEmpty) (Nil, Nil)
   129           {
   129         else {
   130             case (Error(msg, Value.Int(l)), _) =>
   130           lines.zip(lines.tail ::: List("")).flatMap(
   131               Some((true, (msg, get_line_pos(l))))
   131             {
   132             case (Warning_in_Chunk(msg, name), _) if chunk_pos.isDefinedAt(name) =>
   132               case (Error(msg, Value.Int(l)), _) =>
   133               Some((false, (Word.capitalize(msg + " in entry " + quote(name)), chunk_pos(name))))
   133                 Some((true, (msg, get_line_pos(l))))
   134             case (Warning(msg), Warning_Line(Value.Int(l))) =>
   134               case (Warning_in_Chunk(msg, name), _) if chunk_pos.isDefinedAt(name) =>
   135               Some((false, (Word.capitalize(msg), get_line_pos(l))))
   135                 Some((false, (Word.capitalize(msg + " in entry " + quote(name)), chunk_pos(name))))
   136             case (Warning(msg), _) =>
   136               case (Warning(msg), Warning_Line(Value.Int(l))) =>
   137               Some((false, (Word.capitalize(msg), Position.none)))
   137                 Some((false, (Word.capitalize(msg), get_line_pos(l))))
   138             case _ => None
   138               case (Warning(msg), _) =>
   139           }
   139                 Some((false, (Word.capitalize(msg), Position.none)))
   140         ).partition(_._1)
   140               case _ => None
       
   141             }
       
   142           ).partition(_._1)
       
   143         }
   141       (errors.map(_._2), warnings.map(_._2))
   144       (errors.map(_._2), warnings.map(_._2))
   142     })
   145     })
   143   }
   146   }
   144 
   147 
   145   def check_database_yxml(database: String): String =
   148   def check_database_yxml(database: String): String =