| 58861 |      1 | /*  Title:      Pure/Tools/update_semicolons.scala
 | 
|  |      2 |     Author:     Makarius
 | 
|  |      3 | 
 | 
|  |      4 | Remove obsolete semicolons from theory sources.
 | 
|  |      5 | */
 | 
|  |      6 | 
 | 
|  |      7 | package isabelle
 | 
|  |      8 | 
 | 
|  |      9 | 
 | 
|  |     10 | object Update_Semicolons
 | 
|  |     11 | {
 | 
|  |     12 |   def update_semicolons(path: Path)
 | 
|  |     13 |   {
 | 
|  |     14 |     val text0 = File.read(path)
 | 
|  |     15 |     val text1 =
 | 
| 59083 |     16 |       (for (tok <- Token.explode(Keyword.Keywords.empty, text0).iterator if tok.source != ";")
 | 
| 58861 |     17 |         yield tok.source).mkString
 | 
|  |     18 | 
 | 
|  |     19 |     if (text0 != text1) {
 | 
|  |     20 |       Output.writeln("changing " + path)
 | 
|  |     21 |       File.write_backup2(path, text1)
 | 
|  |     22 |     }
 | 
|  |     23 |   }
 | 
|  |     24 | 
 | 
|  |     25 | 
 | 
|  |     26 |   /* command line entry point */
 | 
|  |     27 | 
 | 
|  |     28 |   def main(args: Array[String])
 | 
|  |     29 |   {
 | 
|  |     30 |     Command_Line.tool0 {
 | 
|  |     31 |       args.foreach(arg => update_semicolons(Path.explode(arg)))
 | 
|  |     32 |     }
 | 
|  |     33 |   }
 | 
|  |     34 | }
 |