aboutsummaryrefslogtreecommitdiff
path: root/test/test/ScannerTest.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-04-17 09:48:22 +0200
committerMartin Odersky <odersky@gmail.com>2013-04-17 10:16:22 +0200
commitca8dc7ada663e44aafe470944dd17256dbde151c (patch)
treed15939e204042e358e0c83064250f1f18c1c4f25 /test/test/ScannerTest.scala
parente32fedb6844eab11a27e365a570b2033a0f6f78d (diff)
downloaddotty-ca8dc7ada663e44aafe470944dd17256dbde151c.tar.gz
dotty-ca8dc7ada663e44aafe470944dd17256dbde151c.tar.bz2
dotty-ca8dc7ada663e44aafe470944dd17256dbde151c.zip
Scanners added.
Moving Positions, Chars to new packages. Added Source positions. Added untyped trees module. Factored out behavior between typed and untyped trees.
Diffstat (limited to 'test/test/ScannerTest.scala')
-rw-r--r--test/test/ScannerTest.scala51
1 files changed, 51 insertions, 0 deletions
diff --git a/test/test/ScannerTest.scala b/test/test/ScannerTest.scala
new file mode 100644
index 000000000..68886694d
--- /dev/null
+++ b/test/test/ScannerTest.scala
@@ -0,0 +1,51 @@
+package test
+
+import scala.reflect.io._
+import dotty.tools.dotc.util._
+import dotty.tools.dotc.parsing._
+import Tokens._, Scanners._
+import org.junit.Test
+
+class ScannerTest extends DottyTest {
+
+ def scan(name: String): Unit = scan(new PlainFile(name))
+
+ def scan(file: PlainFile): Unit = {
+ println("***** scanning " + file)
+ val source = new SourceFile(file)
+ val scanner = new Scanner(source)
+ var i = 0
+ while (scanner.token != EOF) {
+// print("["+scanner.token.show+"]")
+ scanner.nextToken
+// i += 1
+// if (i % 10 == 0) println()
+ }
+ }
+
+ def scanDir(path: String): Unit = scanDir(Directory(path))
+
+ def scanDir(dir: Directory): Unit = {
+ for (f <- dir.files)
+ if (f.name.endsWith(".scala")) scan(new PlainFile(f))
+ for (d <- dir.dirs)
+ scanDir(d.path)
+ }
+
+ @Test
+ def scanList() = {
+ println(System.getProperty("user.dir"))
+ scan("src/dotty/tools/dotc/core/Symbols.scala")
+ scan("src/dotty/tools/dotc/core/Symbols.scala")
+ }
+
+ @Test
+ def scanDotty() = {
+ scanDir("src")
+ }
+
+ @Test
+ def scanScala() = {
+ scanDir("/Users/odersky/workspace/scala/src")
+ }
+} \ No newline at end of file