From ca8dc7ada663e44aafe470944dd17256dbde151c Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Wed, 17 Apr 2013 09:48:22 +0200 Subject: Scanners added. Moving Positions, Chars to new packages. Added Source positions. Added untyped trees module. Factored out behavior between typed and untyped trees. --- test/test/ScannerTest.scala | 51 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 test/test/ScannerTest.scala (limited to 'test/test/ScannerTest.scala') 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 -- cgit v1.2.3