diff options
author | Hubert Plociniczak <hubert.plociniczak@epfl.ch> | 2011-11-02 14:34:35 +0000 |
---|---|---|
committer | Hubert Plociniczak <hubert.plociniczak@epfl.ch> | 2011-11-02 14:34:35 +0000 |
commit | b6778be91900b8161e705dc2598ef7af86842b0b (patch) | |
tree | d15e8ec18a37eec212f50f1ace27714d7e7d4d34 /test/files/run/packrat3.scala | |
parent | ac6c76f26d884a94d0c9ff54f055d3f9ab750bac (diff) | |
download | scala-b6778be91900b8161e705dc2598ef7af86842b0b.tar.gz scala-b6778be91900b8161e705dc2598ef7af86842b0b.tar.bz2 scala-b6778be91900b8161e705dc2598ef7af86842b0b.zip |
Begone t1737...
Diffstat (limited to 'test/files/run/packrat3.scala')
-rw-r--r-- | test/files/run/packrat3.scala | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/test/files/run/packrat3.scala b/test/files/run/packrat3.scala index 8eab8ec6d0..216ef8f0af 100644 --- a/test/files/run/packrat3.scala +++ b/test/files/run/packrat3.scala @@ -24,28 +24,28 @@ object Test { } object grammars3 extends StandardTokenParsers with PackratParsers { - + def extractResult(r: ParseResult[_]) = r match { case Success(a,_) => a case NoSuccess(a,_) => a } - + lexical.reserved ++= List("a","b", "c") val a: PackratParser[Any] = memo("a") val b: PackratParser[Any] = memo("b") val c: PackratParser[Any] = memo("c") - val AnBnCn: PackratParser[Any] = + val AnBnCn: PackratParser[Any] = guard(repMany1(a,b) ~ not(b)) ~ rep1(a) ~ repMany1(b,c)// ^^{case x~y => x:::y} - private def repMany[T](p: => Parser[T], q: => Parser[T]): Parser[List[T]] = + private def repMany[T](p: => Parser[T], q: => Parser[T]): Parser[List[T]] = ( p~repMany(p,q)~q ^^ {case x~xs~y => x::xs:::(y::Nil)} | success(Nil) ) - def repMany1[T](p: => Parser[T], q: => Parser[T]): Parser[List[T]] = + def repMany1[T](p: => Parser[T], q: => Parser[T]): Parser[List[T]] = p~opt(repMany(p,q))~q ^^ {case x~Some(xs)~y => x::xs:::(y::Nil)} -} +} |