diff options
Diffstat (limited to 'src/library')
4 files changed, 1 insertions, 211 deletions
diff --git a/src/library/scala/collection/mutable/ArrayBuffer.scala b/src/library/scala/collection/mutable/ArrayBuffer.scala index 8586ae3fee..ae17cc33b4 100644 --- a/src/library/scala/collection/mutable/ArrayBuffer.scala +++ b/src/library/scala/collection/mutable/ArrayBuffer.scala @@ -127,7 +127,7 @@ class ArrayBuffer[A](override protected val initialSize: Int) * @throws Predef.IndexOutOfBoundsException if <code>n</code> is out of bounds. */ override def remove(n: Int, count: Int) { - if ((n < 0) || (n >= size0)) + if ((n < 0) || (n >= size0) && count > 0) throw new IndexOutOfBoundsException(n.toString) copy(n + count, n, size0 - (n + count)) size0 -= count diff --git a/src/library/scala/util/parsing/CharInputStreamIterator.scala b/src/library/scala/util/parsing/CharInputStreamIterator.scala deleted file mode 100644 index 2df83ec4d9..0000000000 --- a/src/library/scala/util/parsing/CharInputStreamIterator.scala +++ /dev/null @@ -1,52 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2009, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - -// $Id$ - - -package scala.util.parsing - - -import java.io.InputStream -import java.io.{IOException, EOFException} - -/** This class ... - * - * @author Burak Emir - * @version 1.0 - * - * @deprecated use classes from <a target="contentFrame" href="input.html"> - * <code>scala.util.parsing.input</code></a> instead. - */ -@deprecated -class CharInputStreamIterator(in: InputStream) extends Iterator[Char] { - - private var ch: Int = _ - private var chSet = false - private var error: IOException = null - - private def lookahead() { - try { - ch = in.read(); chSet = ch >= 0 - } catch { - case ex: EOFException => ch = -1 - case ex: IOException => ch = 1; error = ex - } - } - - def hasNext: Boolean = { - if (!chSet) lookahead() - chSet - } - - def next(): Char = { - if (!chSet) lookahead() - chSet = false - ch.asInstanceOf[Char] - } -} diff --git a/src/library/scala/util/parsing/Parsers.scala b/src/library/scala/util/parsing/Parsers.scala deleted file mode 100644 index 0373081606..0000000000 --- a/src/library/scala/util/parsing/Parsers.scala +++ /dev/null @@ -1,90 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2009, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - -// $Id$ - - -package scala.util.parsing - -/** Documentation for this class is currently missing. - * However, the Scala By Examples document contains a - * chapter on combinator parsing that comes close. - * - * @author Burak Emir - * @version 1.0 - * - * @deprecated use <a target="contentFrame" href="combinator/Parsers.html"> - * <code>scala.util.parsing.combinator.Parsers</code></a> - * instead. - */ -@deprecated -abstract class Parsers { - - type inputType - - abstract class Parser[A] { - - type Result = Option[(A, inputType)] - - def apply(in: inputType): Result - - def filter(pred: A => Boolean) = new Parser[A] { - def apply(in: inputType): Result = Parser.this.apply(in) match { - case None => None - case Some((x, in1)) => if (pred(x)) Some((x, in1)) else None - } - } - - def map[B](f: A => B) = new Parser[B] { - def apply(in: inputType): Result = Parser.this.apply(in) match { - case None => None - case Some((x, in1)) => Some((f(x), in1)) - } - } - - def flatMap[B](f: A => Parser[B]) = new Parser[B] { - def apply(in: inputType): Result = Parser.this.apply(in) match { - case None => None - case Some((x, in1)) => f(x).apply(in1) - } - } - - def ||| (p: => Parser[A]) = new Parser[A] { - def apply(in: inputType): Result = Parser.this.apply(in) match { - case None => p(in) - case s => s - } - } - - def &&& [B](p: => Parser[B]): Parser[B] = - for (_ <- this; val x <- p) yield x - } - - def not[A](p: Parser[A]) = new Parser[Unit] { - def apply(in: inputType): Result = p.apply(in) match { - case None => Some(((), in)) - case Some(_) => None - } - } - - def succeed[A](x: A) = new Parser[A] { - def apply(in: inputType): Result = Some((x, in)) - } - - def rep[A](p: Parser[A]): Parser[List[A]] = - rep1(p) ||| succeed(List()) - - def rep1[A](p: Parser[A]): Parser[List[A]] = - for (x <- p; val xs <- rep(p)) yield x :: xs - - def repWith[A, B](p: Parser[A], sep: Parser[B]): Parser[List[A]] = - for (x <- p; val xs <- rep(sep &&& p)) yield x :: xs - - def opt[A](p: Parser[A]): Parser[List[A]] = - (for (x <- p) yield List(x)) ||| succeed(List()) -} diff --git a/src/library/scala/util/parsing/SimpleTokenizer.scala b/src/library/scala/util/parsing/SimpleTokenizer.scala deleted file mode 100644 index 0b85d237fe..0000000000 --- a/src/library/scala/util/parsing/SimpleTokenizer.scala +++ /dev/null @@ -1,68 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2009, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - -// $Id$ - - -package scala.util.parsing - -/** This class ... - * - * @author Burak Emir - * @version 1.0 - * - * @deprecated use <a target="contentFrame" href="combinator/lexical/StdLexical.html"> - * <code>scala.util.parsing.combinator.lexical.StdLexical</code></a> - * instead. - */ -@deprecated -class SimpleTokenizer(in: Iterator[Char], delimiters: String) extends Iterator[String] { - - private def max(x: Int, y: Char): Int = if (x > y) x else y - - val tracing = false - - private def delimArray: Array[Boolean] = { - val ds = List.fromString(delimiters) - val da = new Array[Boolean]((0 /: ds)(max) + 1) - for (ch <- ds) da(ch) = true - da - } - - private val isdelim = delimArray - private def isDelimiter(ch: Int) = ch >= 0 && ch < isdelim.length && isdelim(ch) - - private val EOI = -1 - - private def nextChar(): Int = if (in.hasNext) in.next else EOI - - private var ch: Int = nextChar - - private val buf = new StringBuilder() - - def hasNext: Boolean = ch != EOI - - def next(): String = { - while (ch <= ' ' && ch != EOI) ch = nextChar() - if (ch == EOI) "" - else { - buf setLength 0 - if (isDelimiter(ch)) { - buf append ch.asInstanceOf[Char]; ch = nextChar() - } else { - while (ch > ' ' && ch != EOI && !isDelimiter(ch)) { - buf append ch.asInstanceOf[Char] - ch = nextChar() - } - } - if (tracing) Console.println("<" + buf.toString() + ">") - buf.toString() - } - } -} - |