src/Pure/Isar/line_structure.scala
changeset 66177 7fd83f20e3e9
parent 63603 9d9ea2c6bc38
child 68730 0bc491938780
equal deleted inserted replaced
66176:b51a40281016 66177:7fd83f20e3e9
    12   val init = Line_Structure()
    12   val init = Line_Structure()
    13 }
    13 }
    14 
    14 
    15 sealed case class Line_Structure(
    15 sealed case class Line_Structure(
    16   improper: Boolean = true,
    16   improper: Boolean = true,
       
    17   blank: Boolean = true,
    17   command: Boolean = false,
    18   command: Boolean = false,
    18   depth: Int = 0,
    19   depth: Int = 0,
    19   span_depth: Int = 0,
    20   span_depth: Int = 0,
    20   after_span_depth: Int = 0,
    21   after_span_depth: Int = 0,
    21   element_depth: Int = 0)
    22   element_depth: Int = 0)
    22 {
    23 {
    23   def update(keywords: Keyword.Keywords, tokens: List[Token]): Line_Structure =
    24   def update(keywords: Keyword.Keywords, tokens: List[Token]): Line_Structure =
    24   {
    25   {
    25     val improper1 = tokens.forall(_.is_improper)
    26     val improper1 = tokens.forall(_.is_improper)
       
    27     val blank1 = tokens.forall(_.is_space)
    26     val command1 = tokens.exists(_.is_begin_or_command)
    28     val command1 = tokens.exists(_.is_begin_or_command)
    27 
    29 
    28     val command_depth =
    30     val command_depth =
    29       tokens.iterator.filter(_.is_proper).toStream.headOption match {
    31       tokens.iterator.filter(_.is_proper).toStream.headOption match {
    30         case Some(tok) =>
    32         case Some(tok) =>
    60             else depths
    62             else depths
    61           }
    63           }
    62           else depths
    64           else depths
    63       }
    65       }
    64 
    66 
    65     Line_Structure(improper1, command1, depth1, span_depth1, after_span_depth1, element_depth1)
    67     Line_Structure(
       
    68       improper1, blank1, command1, depth1, span_depth1, after_span_depth1, element_depth1)
    66   }
    69   }
    67 }
    70 }