src/Pure/PIDE/command_span.scala
changeset 67895 cd00999d2d30
parent 65717 556c34fd0554
child 68840 51ab4c78235b
equal deleted inserted replaced
67894:fee080c4045f 67895:cd00999d2d30
    29     def name: String =
    29     def name: String =
    30       kind match { case Command_Span(name, _) => name case _ => "" }
    30       kind match { case Command_Span(name, _) => name case _ => "" }
    31 
    31 
    32     def position: Position.T =
    32     def position: Position.T =
    33       kind match { case Command_Span(_, pos) => pos case _ => Position.none }
    33       kind match { case Command_Span(_, pos) => pos case _ => Position.none }
       
    34 
       
    35     def keyword_pos(start: Token.Pos): Token.Pos =
       
    36       kind match {
       
    37         case _: Command_Span =>
       
    38           (start /: content.iterator.takeWhile(tok => !tok.is_command))(_.advance(_))
       
    39         case _ => start
       
    40       }
    34 
    41 
    35     def is_begin: Boolean = content.exists(_.is_begin)
    42     def is_begin: Boolean = content.exists(_.is_begin)
    36     def is_end: Boolean = content.exists(_.is_end)
    43     def is_end: Boolean = content.exists(_.is_end)
    37 
    44 
    38     def length: Int = (0 /: content)(_ + _.source.length)
    45     def length: Int = (0 /: content)(_ + _.source.length)