src/Pure/General/pretty.scala
changeset 38724 d1feec02cf02
parent 38573 d163f0f28e8c
child 43714 3749d1e6dde9
equal deleted inserted replaced
38723:6a55b8978a56 38724:d1feec02cf02
    17   def block(body: XML.Body): XML.Tree = Block(2, body)
    17   def block(body: XML.Body): XML.Tree = Block(2, body)
    18 
    18 
    19   object Block
    19   object Block
    20   {
    20   {
    21     def apply(i: Int, body: XML.Body): XML.Tree =
    21     def apply(i: Int, body: XML.Body): XML.Tree =
    22       XML.Elem(Markup(Markup.BLOCK, List((Markup.INDENT, Markup.Int(i)))), body)
    22       XML.Elem(Markup(Markup.BLOCK, Markup.Indent(i)), body)
    23 
    23 
    24     def unapply(tree: XML.Tree): Option[(Int, XML.Body)] =
    24     def unapply(tree: XML.Tree): Option[(Int, XML.Body)] =
    25       tree match {
    25       tree match {
    26         case XML.Elem(
    26         case XML.Elem(Markup(Markup.BLOCK, Markup.Indent(i)), body) => Some((i, body))
    27           Markup(Markup.BLOCK, List((Markup.INDENT, Markup.Int(i)))), body) => Some((i, body))
       
    28         case _ => None
    27         case _ => None
    29       }
    28       }
    30   }
    29   }
    31 
    30 
    32   object Break
    31   object Break
    33   {
    32   {
    34     def apply(w: Int): XML.Tree =
    33     def apply(w: Int): XML.Tree =
    35       XML.Elem(
    34       XML.Elem(Markup(Markup.BREAK, Markup.Width(w)), List(XML.Text(Symbol.spaces(w))))
    36         Markup(Markup.BREAK, List((Markup.WIDTH, Markup.Int(w)))), List(XML.Text(Symbol.spaces(w))))
       
    37 
    35 
    38     def unapply(tree: XML.Tree): Option[Int] =
    36     def unapply(tree: XML.Tree): Option[Int] =
    39       tree match {
    37       tree match {
    40         case XML.Elem(Markup(Markup.BREAK, List((Markup.WIDTH, Markup.Int(w)))), _) => Some(w)
    38         case XML.Elem(Markup(Markup.BREAK, Markup.Width(w)), _) => Some(w)
    41         case _ => None
    39         case _ => None
    42       }
    40       }
    43   }
    41   }
    44 
    42 
    45   val FBreak = XML.Text("\n")
    43   val FBreak = XML.Text("\n")