From 63c3b505e7e7820ef6975e3e6c342217eb4a08ac Mon Sep 17 00:00:00 2001 From: "Gun.io Whitespace Robot" Date: Fri, 28 Oct 2011 15:40:36 -0400 Subject: [PATCH] Remove whitespace [Gun.io WhitespaceBot] --- src/main/scala/literaljson/extraction.scala | 10 +++++----- src/main/scala/literaljson/json.scala | 6 +++--- src/main/scala/literaljson/parser.scala | 8 ++++---- src/test/scala/literaljson/examples.scala | 10 +++++----- src/test/scala/literaljson/generators.scala | 2 +- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/main/scala/literaljson/extraction.scala b/src/main/scala/literaljson/extraction.scala index 8f189fe..4607d29 100644 --- a/src/main/scala/literaljson/extraction.scala +++ b/src/main/scala/literaljson/extraction.scala @@ -1,4 +1,4 @@ -package literaljson +package literaljson import scala.reflect.Manifest import JsonAST._ @@ -14,7 +14,7 @@ object Extraction { * * Example mapping. * - * package xx + * package xx * case class Person(name: String, address: Address, children: List[Child]) * case class Address(street: String, city: String) * case class Child(name: String, age: BigInt) @@ -46,13 +46,13 @@ object Extraction { def build(root: JValue, mapping: Mapping, argStack: List[Any]): List[Any] = mapping match { case Value(path) => fieldValue(root, path).values :: argStack - case Constructor(path, classname, args) => + case Constructor(path, classname, args) => val newRoot = path match { case Some(p) => root \ p case None => root } newInstance(classname, args.flatMap(build(newRoot, _, argStack))) :: Nil - case ListConstructor(path, classname, args) => + case ListConstructor(path, classname, args) => val arr = fieldValue(root, path).asInstanceOf[JArray] arr.arr.map(elem => newInstance(classname, args.flatMap(build(elem, _, argStack)))) :: argStack } @@ -76,7 +76,7 @@ object Extraction { else if (x.getType == classOf[List[_]]) makeMapping(Some(x.getName), Util.parametrizedType(x), true) else makeMapping(Some(x.getName), x.getType, false) }.toList.reverse // FIXME Java6 returns these in reverse order, verify that and check other vms - + makeMapping(None, clazz, false) } } diff --git a/src/main/scala/literaljson/json.scala b/src/main/scala/literaljson/json.scala index da5c108..08aee35 100644 --- a/src/main/scala/literaljson/json.scala +++ b/src/main/scala/literaljson/json.scala @@ -125,7 +125,7 @@ object JsonAST { case JString(s) => text("\"" + quote(s) + "\"") case JArray(arr) => text("[") :: series(trimArr(arr).map(render(_))) :: text("]") case JField(n, v) => text("\"" + n + "\":") :: render(v) - case JObject(obj) => + case JObject(obj) => val nested = break :: fields(trimObj(obj).map(f => text("\"" + f.name + "\":") :: render(f.value))) text("{") :: nest(2, nested) :: break :: text("}") } @@ -141,7 +141,7 @@ object JsonAST { case d :: ds => (d :: p) :: punctuate(p, ds) } - private def quote(s: String) = (s.map { + private def quote(s: String) = (s.map { case '\r' => "\\r" case '\n' => "\\n" case '\t' => "\\t" @@ -197,7 +197,7 @@ trait Printer { def compact(d: Document) = { def layout(doc: Document): String = doc match { - case DocText(s) => s + case DocText(s) => s case DocCons(d1, d2) => layout(d1) + layout(d2) case DocBreak => "" case DocNest(_, d) => layout(d) diff --git a/src/main/scala/literaljson/parser.scala b/src/main/scala/literaljson/parser.scala index 5463a89..4419fbc 100644 --- a/src/main/scala/literaljson/parser.scala +++ b/src/main/scala/literaljson/parser.scala @@ -60,8 +60,8 @@ object JsonParser { case class MArray() extends MValue with MBlock[MValue] { def toJValue = JArray(elems.map(_.toJValue).reverse) } - - def parse(s: String): Either[ParseError, JValue] = + + def parse(s: String): Either[ParseError, JValue] = try { Right(parse0(s)) } catch { @@ -76,7 +76,7 @@ object JsonParser { def closeBlock(v: MValue) { vals.peekOption match { - case Some(f: MField) => + case Some(f: MField) => f.value = v val field = vals.pop[MField] vals.peek[MObject] += field @@ -107,7 +107,7 @@ object JsonParser { case DoubleVal(x) => newValue(MDouble(x)) case BoolVal(x) => newValue(MBool(x)) case NullVal => newValue(MNull) - case CloseObj => closeBlock(vals.pop[MValue]) + case CloseObj => closeBlock(vals.pop[MValue]) case OpenArr => vals.push(MArray()) case CloseArr => closeBlock(vals.pop[MArray]) case End => diff --git a/src/test/scala/literaljson/examples.scala b/src/test/scala/literaljson/examples.scala index fd7ae34..bdf3052 100644 --- a/src/test/scala/literaljson/examples.scala +++ b/src/test/scala/literaljson/examples.scala @@ -78,7 +78,7 @@ class ExampleSuite extends FunSuite { """ val person = """ -{ +{ "person": { "name": "Joe", "age": 35, @@ -92,19 +92,19 @@ class ExampleSuite extends FunSuite { } """ - val personDSL = + val personDSL = ("person" -> ("name" -> "Joe") ~ ("age" -> 35) ~ - ("spouse" -> - ("person" -> + ("spouse" -> + ("person" -> ("name" -> "Marilyn") ~ ("age" -> 33) ) ) ) - val objArray = + val objArray = """ { "name": "joe", "address": { diff --git a/src/test/scala/literaljson/generators.scala b/src/test/scala/literaljson/generators.scala index 9c1ecd7..619f4dd 100644 --- a/src/test/scala/literaljson/generators.scala +++ b/src/test/scala/literaljson/generators.scala @@ -8,7 +8,7 @@ import JsonAST._ trait JValueGen { def genJValue: Gen[JValue] = frequency((5, genSimple), (1, lzy(genArray)), (1, lzy(genObject))) def genSimple: Gen[JValue] = oneOf( - value(JNull), + value(JNull), arbitrary[Int].map(JInt(_)), arbitrary[Double].map(JDouble(_)), arbitrary[Boolean].map(JBool(_)),