diff options
author | Paul Phillips <paulp@improving.org> | 2013-03-05 10:09:34 -0800 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2013-03-09 11:03:11 -0800 |
commit | 9094822181c398b945b7f30ac1e2b05da9796f53 (patch) | |
tree | a3e5f0c7d2b821ce5d841dccd4007e4dca51a09b /src/compiler/scala/tools/nsc/javac | |
parent | 960f9848897f2511a08d2a5908078a348dfb1716 (diff) | |
download | scala-9094822181c398b945b7f30ac1e2b05da9796f53.tar.gz scala-9094822181c398b945b7f30ac1e2b05da9796f53.tar.bz2 scala-9094822181c398b945b7f30ac1e2b05da9796f53.zip |
Enabling commit for interactive/scaladoc modules.
This is a non-behaviorally-changing setup commit which
re-routes bits of code through avenues which can more easily
be influenced by subclasses of Global.
Diffstat (limited to 'src/compiler/scala/tools/nsc/javac')
-rw-r--r-- | src/compiler/scala/tools/nsc/javac/JavaScanners.scala | 43 |
1 files changed, 15 insertions, 28 deletions
diff --git a/src/compiler/scala/tools/nsc/javac/JavaScanners.scala b/src/compiler/scala/tools/nsc/javac/JavaScanners.scala index 1d1469f87d..3813736535 100644 --- a/src/compiler/scala/tools/nsc/javac/JavaScanners.scala +++ b/src/compiler/scala/tools/nsc/javac/JavaScanners.scala @@ -10,7 +10,7 @@ import scala.tools.nsc.util.JavaCharArrayReader import scala.reflect.internal.util._ import scala.reflect.internal.Chars._ import JavaTokens._ -import scala.annotation.switch +import scala.annotation.{ switch, tailrec } import scala.language.implicitConversions // Todo merge these better with Scanners @@ -587,33 +587,20 @@ trait JavaScanners extends ast.parser.ScannersCommon { } } - private def skipComment(): Boolean = { - if (in.ch == '/') { - do { - in.next() - } while ((in.ch != CR) && (in.ch != LF) && (in.ch != SU)) - true - } else if (in.ch == '*') { - docBuffer = null - in.next() - val scalaDoc = ("/**", "*/") - if (in.ch == '*' && forScaladoc) - docBuffer = new StringBuilder(scalaDoc._1) - do { - do { - if (in.ch != '*' && in.ch != SU) { - in.next(); putDocChar(in.ch) - } - } while (in.ch != '*' && in.ch != SU) - while (in.ch == '*') { - in.next(); putDocChar(in.ch) - } - } while (in.ch != '/' && in.ch != SU) - if (in.ch == '/') in.next() - else incompleteInputError("unclosed comment") - true - } else { - false + protected def skipComment(): Boolean = { + @tailrec def skipLineComment(): Unit = in.ch match { + case CR | LF | SU => + case _ => in.next; skipLineComment() + } + @tailrec def skipJavaComment(): Unit = in.ch match { + case SU => incompleteInputError("unclosed comment") + case '*' => in.next; if (in.ch == '/') in.next else skipJavaComment() + case _ => in.next; skipJavaComment() + } + in.ch match { + case '/' => in.next ; skipLineComment() ; true + case '*' => in.next ; skipJavaComment() ; true + case _ => false } } |