From 9c50dd52743b7ff4de19548669dfa7e7a0304034 Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Wed, 17 Jul 2013 09:27:29 -0700 Subject: Prepare removal of scala-xml, scala-parser-combinators Every test deleted here has found its way to the respective repositories of scala-xml and scala-parser-combinators, where they will continue to be tested with partest. The modified tests became independent of these modules, as they should've been from the start. --- test/files/run/packrat3.scala | 51 ------------------------------------------- 1 file changed, 51 deletions(-) delete mode 100644 test/files/run/packrat3.scala (limited to 'test/files/run/packrat3.scala') diff --git a/test/files/run/packrat3.scala b/test/files/run/packrat3.scala deleted file mode 100644 index 216ef8f0af..0000000000 --- a/test/files/run/packrat3.scala +++ /dev/null @@ -1,51 +0,0 @@ -import scala.util.parsing.combinator._ - -import scala.util.parsing.combinator.syntactical.StandardTokenParsers -import scala.util.parsing.input._ -import scala.util.parsing.combinator.token._ - -import scala.collection.mutable.HashMap - -object Test { - def main(args: Array[String]): Unit = { - import grammars3._ - - val head = phrase(AnBnCn) - - println(extractResult(head(new lexical.Scanner("a b c")))) - println(extractResult(head(new lexical.Scanner("a a b b c c")))) - println(extractResult(head(new lexical.Scanner("a a a b b b c c c")))) - println(extractResult(head(new lexical.Scanner("a a a a b b b b c c c c")))) - - println(extractResult(AnBnCn(new PackratReader(new lexical.Scanner("a a a b b b b c c c c"))))) - println(extractResult(AnBnCn(new PackratReader(new lexical.Scanner("a a a a b b b c c c c"))))) - println(extractResult(AnBnCn(new PackratReader(new lexical.Scanner("a a a a b b b b c c c"))))) - } -} - -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] = - 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]] = - ( 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]] = - p~opt(repMany(p,q))~q ^^ {case x~Some(xs)~y => x::xs:::(y::Nil)} - -} -- cgit v1.2.3