equal
deleted
inserted
replaced
46 } |
46 } |
47 |
47 |
48 |
48 |
49 /* markup trees with physical blocks and breaks */ |
49 /* markup trees with physical blocks and breaks */ |
50 |
50 |
|
51 private def force_nat(i: Int): Int = i max 0 |
|
52 |
51 private sealed abstract class Tree { def length: Double } |
53 private sealed abstract class Tree { def length: Double } |
52 private case class Block( |
54 private case class Block( |
53 markup: Option[(Markup, Option[XML.Body])], |
55 markup: Option[(Markup, Option[XML.Body])], |
54 consistent: Boolean, indent: Int, body: List[Tree], length: Double) extends Tree |
56 consistent: Boolean, indent: Int, body: List[Tree], length: Double) extends Tree |
55 private case class Break(force: Boolean, width: Int, indent: Int) extends Tree |
57 private case class Break(force: Boolean, width: Int, indent: Int) extends Tree |
80 Block(markup, consistent, indent1, body, body_length(body, 0.0)) |
82 Block(markup, consistent, indent1, body, body_length(body, 0.0)) |
81 } |
83 } |
82 |
84 |
83 |
85 |
84 /* formatted output */ |
86 /* formatted output */ |
85 |
|
86 private def force_nat(i: Int): Int = i max 0 |
|
87 |
87 |
88 private sealed case class Text(tx: XML.Body = Nil, pos: Double = 0.0, nl: Int = 0) |
88 private sealed case class Text(tx: XML.Body = Nil, pos: Double = 0.0, nl: Int = 0) |
89 { |
89 { |
90 def newline: Text = copy(tx = fbrk :: tx, pos = 0.0, nl = nl + 1) |
90 def newline: Text = copy(tx = fbrk :: tx, pos = 0.0, nl = nl + 1) |
91 def string(s: String, len: Double): Text = |
91 def string(s: String, len: Double): Text = |