aboutsummaryrefslogtreecommitdiff
path: root/yamlesque/src/main/scala/yamlValues.scala
blob: afe8e0b1a40001644612fa14ad30af23fba3f15b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package yamlesque

sealed trait YamlValue {
  def print: String = YamlValue.DefaultPrinter(this)
}
object YamlValue {
  val DefaultPrinter = new YamlPrinter(compact = true)
}

case class YamlMapping(fields: Map[String, YamlValue]) extends YamlValue
object YamlMapping {
  def apply(items: (String, YamlValue)*) = new YamlMapping(Map(items: _*))
}

case class YamlSequence(items: Vector[YamlValue]) extends YamlValue
object YamlSequence {
  def apply(items: YamlValue*) = new YamlSequence(items.toVector)
}

case class YamlScalar(value: String) extends YamlValue
object YamlScalar {
  final val Empty = YamlScalar("")
}