diff options
author | Paul Phillips <paulp@improving.org> | 2010-04-26 20:42:03 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2010-04-26 20:42:03 +0000 |
commit | cf552d7f27ce5aaf27d890b5f4068914aca76444 (patch) | |
tree | 423c48e48c7bbd2117010a65db151134c8f13094 /src/compiler/scala/tools/nsc/interpreter/Parsed.scala | |
parent | bc17cc6c0363a15fa28ea8c487e66bfb324569af (diff) | |
download | scala-cf552d7f27ce5aaf27d890b5f4068914aca76444.tar.gz scala-cf552d7f27ce5aaf27d890b5f4068914aca76444.tar.bz2 scala-cf552d7f27ce5aaf27d890b5f4068914aca76444.zip |
Mostly finishing the ball that got rolling in r...
Mostly finishing the ball that got rolling in r21679.
scala> String.cop<tab>
scala> String.copyValueOf<tab>
def copyValueOf(Array[Char]): String
def copyValueOf(Array[Char], Int, Int): String
scala> Nil.mkString<tab><tab>
def mkString(sep: String): String
def mkString(start: String, sep: String, end: String): String
def mkString: String
Lines which are not simply delimited don't work yet, so don't go
expecting List(1).<tab> to do the right thing. Yet. No review.
Diffstat (limited to 'src/compiler/scala/tools/nsc/interpreter/Parsed.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/interpreter/Parsed.scala | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/interpreter/Parsed.scala b/src/compiler/scala/tools/nsc/interpreter/Parsed.scala index 810116d0cf..0b92608d88 100644 --- a/src/compiler/scala/tools/nsc/interpreter/Parsed.scala +++ b/src/compiler/scala/tools/nsc/interpreter/Parsed.scala @@ -20,13 +20,17 @@ class Parsed private ( def isQualified = args.size > 1 def isAtStart = cursor <= 0 + private var _verbosity = 0 + def verbosity = _verbosity + def withVerbosity(v: Int): this.type = returning[this.type](this)(_ => _verbosity = v) + def args = toArgs(buffer take cursor).toList def bufferHead = args.head def headLength = bufferHead.length + 1 - def bufferTail = new Parsed(buffer drop headLength, cursor - headLength, delimited) + def bufferTail = new Parsed(buffer drop headLength, cursor - headLength, delimited) withVerbosity verbosity - def prev = new Parsed(buffer, cursor - 1, delimited) - def next = new Parsed(buffer, cursor + 1, delimited) + def prev = new Parsed(buffer, cursor - 1, delimited) withVerbosity verbosity + def next = new Parsed(buffer, cursor + 1, delimited) withVerbosity verbosity def currentChar = buffer(cursor) def currentArg = args.last def position = @@ -52,7 +56,7 @@ class Parsed private ( object Parsed { def apply(s: String): Parsed = apply(onull(s), onull(s).length) - def apply(s: String, cursor: Int): Parsed = apply(onull(s), cursor, "(){},`; \t" contains _) + def apply(s: String, cursor: Int): Parsed = apply(onull(s), cursor, "{},`; \t" contains _) def apply(s: String, cursor: Int, delimited: Char => Boolean): Parsed = new Parsed(onull(s), cursor, delimited) |