From 9e6db195407d5c225b778180abbc4693c0811f55 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Tue, 26 May 2009 19:00:36 +0000 Subject: removed deprecated files; more changes to repl. --- .../scala/collection/mutable/ArrayBuffer.scala | 2 +- .../util/parsing/CharInputStreamIterator.scala | 52 ------------- src/library/scala/util/parsing/Parsers.scala | 90 ---------------------- .../scala/util/parsing/SimpleTokenizer.scala | 68 ---------------- 4 files changed, 1 insertion(+), 211 deletions(-) delete mode 100644 src/library/scala/util/parsing/CharInputStreamIterator.scala delete mode 100644 src/library/scala/util/parsing/Parsers.scala delete mode 100644 src/library/scala/util/parsing/SimpleTokenizer.scala (limited to 'src/library') 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 n 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 - * scala.util.parsing.input 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 - * scala.util.parsing.combinator.Parsers - * 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 - * scala.util.parsing.combinator.lexical.StdLexical - * 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() - } - } -} - -- cgit v1.2.3