diff options
author | Martin Odersky <odersky@gmail.com> | 2008-05-22 15:13:53 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2008-05-22 15:13:53 +0000 |
commit | e2fd411f0a2f78547167149cada72dc347394749 (patch) | |
tree | 569aed0e77679caea16ee72d5fb545d6dd2fa955 /test/files/run | |
parent | ef6460b6e40f145c9538e714fbf22f9144e603ca (diff) | |
download | scala-e2fd411f0a2f78547167149cada72dc347394749.tar.gz scala-e2fd411f0a2f78547167149cada72dc347394749.tar.bz2 scala-e2fd411f0a2f78547167149cada72dc347394749.zip |
fixed #911.
Diffstat (limited to 'test/files/run')
-rw-r--r-- | test/files/run/t0700.check | 2 | ||||
-rwxr-xr-x | test/files/run/t0700.scala | 24 | ||||
-rw-r--r-- | test/files/run/t0911.scala | 2 |
3 files changed, 27 insertions, 1 deletions
diff --git a/test/files/run/t0700.check b/test/files/run/t0700.check new file mode 100644 index 0000000000..b4eabbab1a --- /dev/null +++ b/test/files/run/t0700.check @@ -0,0 +1,2 @@ +[3.2] parsed: List(2, 2, 2) +[3.2] parsed: List(2, 2, 2) diff --git a/test/files/run/t0700.scala b/test/files/run/t0700.scala new file mode 100755 index 0000000000..5a7180528c --- /dev/null +++ b/test/files/run/t0700.scala @@ -0,0 +1,24 @@ +import java.io.{File,StringReader} + +import scala.util.parsing.combinator.Parsers +import scala.util.parsing.input.{CharArrayReader, StreamReader} + +class TestParsers extends Parsers { + type Elem = Char + + def p: Parser[List[Int]] = rep(p1 | p2) + def p1: Parser[Int] = 'a' ~ nl ~ 'b' ~ nl ^^^ 1 + def p2: Parser[Int] = 'a' ~ nl ^^^ 2 + def nl: Parser[Int] = rep(accept('\n') | accept('\r')) ^^^ 0 +} + +object Test { + def main(args: Array[String]): Unit = { + val tstParsers = new TestParsers + val s = "a\na\na" + val r1 = new CharArrayReader(s.toCharArray()) + val r2 = StreamReader(new StringReader(s)) + println(tstParsers.p(r1)) + println(tstParsers.p(r2)) + } +} diff --git a/test/files/run/t0911.scala b/test/files/run/t0911.scala index f4d93eb571..6f9ad91781 100644 --- a/test/files/run/t0911.scala +++ b/test/files/run/t0911.scala @@ -4,6 +4,6 @@ class IP extends { val baz = "bar"; } with Foo(() => baz); -object Main extends Application{ +object Test extends Application{ (new IP).bar(); } |