src/Pure/Tools/check_keywords.scala
changeset 75393 87ebf5a50283
parent 73340 0ffcad1f6130
child 75394 42267c650205
equal deleted inserted replaced
75388:b3ca4a6ed74b 75393:87ebf5a50283
     5 */
     5 */
     6 
     6 
     7 package isabelle
     7 package isabelle
     8 
     8 
     9 
     9 
    10 object Check_Keywords
    10 object Check_Keywords {
    11 {
       
    12   def conflicts(
    11   def conflicts(
    13     keywords: Keyword.Keywords,
    12     keywords: Keyword.Keywords,
    14     check: Set[String],
    13     check: Set[String],
    15     input: CharSequence,
    14     input: CharSequence,
    16     start: Token.Pos): List[(Token, Position.T)] =
    15     start: Token.Pos
    17   {
    16   ): List[(Token, Position.T)] = {
    18     object Parser extends Parse.Parser
    17     object Parser extends Parse.Parser {
    19     {
       
    20       private val conflict =
    18       private val conflict =
    21         position(token("token", tok => !(tok.is_command || tok.is_keyword) && check(tok.source)))
    19         position(token("token", tok => !(tok.is_command || tok.is_keyword) && check(tok.source)))
    22       private val other = token("token", _ => true)
    20       private val other = token("token", _ => true)
    23       private val item = conflict ^^ (x => Some(x)) | other ^^ (_ => None)
    21       private val item = conflict ^^ (x => Some(x)) | other ^^ (_ => None)
    24 
    22 
    33 
    31 
    34   def check_keywords(
    32   def check_keywords(
    35     progress: Progress,
    33     progress: Progress,
    36     keywords: Keyword.Keywords,
    34     keywords: Keyword.Keywords,
    37     check: Set[String],
    35     check: Set[String],
    38     paths: List[Path]): Unit =
    36     paths: List[Path]
    39   {
    37   ): Unit = {
    40     val parallel_args = paths.map(path => (File.read(path), Token.Pos.file(path.expand.implode)))
    38     val parallel_args = paths.map(path => (File.read(path), Token.Pos.file(path.expand.implode)))
    41 
    39 
    42     val bad =
    40     val bad =
    43       Par_List.map((arg: (String, Token.Pos)) => {
    41       Par_List.map((arg: (String, Token.Pos)) => {
    44         progress.expose_interrupt()
    42         progress.expose_interrupt()