src/Pure/PIDE/xml.scala
changeset 80446 996b5eb7c89e
parent 80441 c420429fdf4c
child 80454 1b5ba70a64b9
equal deleted inserted replaced
80445:00f5e829d8b4 80446:996b5eb7c89e
    46     def elem(markup: Markup, end: Boolean = false): Unit
    46     def elem(markup: Markup, end: Boolean = false): Unit
    47     def end_elem(name: String): Unit
    47     def end_elem(name: String): Unit
    48 
    48 
    49     def traverse(trees: List[Tree]): Unit = {
    49     def traverse(trees: List[Tree]): Unit = {
    50       @tailrec def trav(list: List[Trav]): Unit =
    50       @tailrec def trav(list: List[Trav]): Unit =
    51         list match {
    51         (list : @unchecked) match {
    52           case Nil =>
    52           case Nil =>
    53           case Text(s) :: rest => text(s); trav(rest)
    53           case Text(s) :: rest => text(s); trav(rest)
    54           case Elem(markup, body) :: rest =>
    54           case Elem(markup, body) :: rest =>
    55             if (markup.is_empty) trav(body ::: rest)
    55             if (markup.is_empty) trav(body ::: rest)
    56             else if (body.isEmpty) { elem(markup, end = true); trav(rest) }
    56             else if (body.isEmpty) { elem(markup, end = true); trav(rest) }
    57             else { elem(markup); trav(body ::: End(markup.name) :: rest) }
    57             else { elem(markup); trav(body ::: End(markup.name) :: rest) }
    58           case End(name) :: rest => end_elem(name); trav(rest)
    58           case End(name) :: rest => end_elem(name); trav(rest)
    59           case _ :: _ => ???
       
    60         }
    59         }
    61       trav(trees)
    60       trav(trees)
    62     }
    61     }
    63   }
    62   }
    64 
    63