src/Pure/PIDE/command.scala
changeset 59924 801b979ec0c2
parent 59735 24bee1b11fce
child 60215 5fb4990dfc73
     1.1 --- a/src/Pure/PIDE/command.scala	Sat Apr 04 14:04:11 2015 +0200
     1.2 +++ b/src/Pure/PIDE/command.scala	Sat Apr 04 21:21:40 2015 +0200
     1.3 @@ -325,13 +325,11 @@
     1.4    }
     1.5  
     1.6    private def find_file(tokens: List[(Token, Int)]): Option[(String, Int)] =
     1.7 -    tokens match {
     1.8 -      case (tok, _) :: toks =>
     1.9 -        if (tok.is_command)
    1.10 -          toks.collectFirst({ case (t, i) if t.is_name => (t.content, i) })
    1.11 -        else None
    1.12 -      case Nil => None
    1.13 +    if (tokens.exists({ case (t, _) => t.is_command })) {
    1.14 +      tokens.dropWhile({ case (t, _) => !t.is_command }).
    1.15 +        collectFirst({ case (t, i) if t.is_name => (t.content, i) })
    1.16      }
    1.17 +    else None
    1.18  
    1.19    def span_files(syntax: Prover.Syntax, span: Command_Span.Span): (List[String], Int) =
    1.20      syntax.load_command(span.name) match {