Permalink
Browse files

now span, spanM doesn't parse the spaner

  • Loading branch information...
1 parent da6217f commit 713c1f4e6fb706082f0243d9dd5be2f7b385a288 @sadache sadache committed Apr 6, 2011
@@ -88,7 +88,7 @@ class SqlTests extends UnitTestCase with ShouldMatchersForJUnit {
// "magical" groupBy
import Magic._
- val parsePeople = (Person spanM Comment) ^^
+ val parsePeople = Person ~< (Person spanM Comment) ^^
{case p ~ cs => p.copy(comments=cs) } *;
( parsePeople (StreamReader(in)) get ) should be (
@@ -233,7 +233,7 @@ class WorldTests extends UnitFlatSpec with ShouldMatchers {
join City v on v.id = c.capital
where c.code = {code}
"""
- ).on("code" -> "FRA").as( (City ~< Country).span(CountryLanguage*) ? )
+ ).on("code" -> "FRA").as( City ~< Country ~< Country.span(CountryLanguage*) ? )
capital should be (City(Id(2974), "Paris"))
country should be (Country(Id("FRA"), "France", 59225700, Some("Nicolas S.")))
@@ -462,9 +462,9 @@ package anorm {
def ~<[B](other: Parser[B]):Parser[T ~ B] = (this:Parser[T]).~<(other)
- def span[B](p:Parser[B]) : Parser[T ~ B] = {
+ def span[B](p:Parser[B]) : Parser[B] = {
val d = guard(uniqueId)
- guard(this) ~ ( d >> (first => Parser[B] {in =>
+ ( d >> (first => Parser[B] {in =>
//instead of cast it'd be much better to override type Reader
{
val (groupy,rest) = in.asInstanceOf[StreamReader[Row]].s.span(uniqueId(_).right.toOption.exists(r=>r==first));
@@ -478,7 +478,7 @@ package anorm {
}))
}
- def spanM[B](b:Parser[B]) : Parser[T ~ Seq[B]] = span(b *)
+ def spanM[B](b:Parser[B]) : Parser[Seq[B]] = span(b *)
}

0 comments on commit 713c1f4

Please sign in to comment.