summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala48
-rw-r--r--src/compiler/scala/tools/nsc/doc/DocGenerator.scala76
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Definitions.scala6
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Symbols.scala28
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala6
-rw-r--r--src/dbc/scala/dbc/Database.scala64
-rw-r--r--src/dbc/scala/dbc/result/Relation.scala42
-rw-r--r--src/library/scala/collection/BitSet.scala6
-rw-r--r--src/library/scala/collection/mutable/FlatHashTable.scala10
-rw-r--r--src/library/scala/util/automata/DetWordAutom.scala8
-rw-r--r--src/library/scala/util/automata/Inclusion.scala12
-rw-r--r--src/library/scala/util/automata/NondetWordAutom.scala18
-rw-r--r--src/library/scala/util/automata/WordBerrySethi.scala28
-rw-r--r--src/library/scala/util/parsing/Parsers.scala12
-rw-r--r--src/library/scala/util/parsing/SimpleTokenizer.scala8
-rw-r--r--src/library/scala/xml/PrefixedAttribute.scala17
-rw-r--r--src/library/scala/xml/UnprefixedAttribute.scala10
-rw-r--r--src/library/scala/xml/parsing/FactoryAdapter.scala16
-rw-r--r--src/library/scala/xml/parsing/MarkupParser.scala33
-rw-r--r--test/files/run/caseclasses.scala4
-rw-r--r--test/files/run/misc.scala10
21 files changed, 226 insertions, 236 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala b/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala
index b587fa06b8..7eb29b3722 100644
--- a/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala
+++ b/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala
@@ -1,35 +1,35 @@
/* NSC -- new scala compiler
- * Copyright 2005 LAMP/EPFL
+ * Copyright 2005-2007 LAMP/EPFL
* @author Iulian Dragos
*/
// $Id$
-package scala.tools.nsc.backend.opt;
+package scala.tools.nsc.backend.opt
import scala.collection._
-import scala.collection.immutable.{Map, HashMap, Set, HashSet};
-import scala.tools.nsc.backend.icode.analysis.LubError;
-import scala.tools.nsc.symtab._;
+import scala.collection.immutable.{Map, HashMap, Set, HashSet}
+import scala.tools.nsc.backend.icode.analysis.LubError
+import scala.tools.nsc.symtab._
/**
*/
abstract class DeadCodeElimination extends SubComponent {
- import global._;
- import icodes._;
- import icodes.opcodes._;
+ import global._
+ import icodes._
+ import icodes.opcodes._
- val phaseName = "dce";
+ val phaseName = "dce"
/** Create a new phase */
- override def newPhase(p: Phase) = new DeadCodeEliminationPhase(p);
+ override def newPhase(p: Phase) = new DeadCodeEliminationPhase(p)
/** Dead code elimination phase.
*/
class DeadCodeEliminationPhase(prev: Phase) extends ICodePhase(prev) {
def name = phaseName
- val dce = new DeadCode();
+ val dce = new DeadCode()
override def apply(c: IClass): Unit =
if (settings.Xdce.value)
@@ -86,10 +86,10 @@ abstract class DeadCodeElimination extends SubComponent {
rdef.init(m);
rdef.run;
- for (val bb <- m.code.blocks.toList) {
+ for (bb <- m.code.blocks.toList) {
useful(bb) = new mutable.BitSet(bb.size)
var rd = rdef.in(bb);
- for (val Pair(i, idx) <- bb.toList.zipWithIndex) {
+ for (Pair(i, idx) <- bb.toList.zipWithIndex) {
i match {
case LOAD_LOCAL(l) =>
defs = defs + ((bb, idx)) -> rd._1
@@ -123,7 +123,7 @@ abstract class DeadCodeElimination extends SubComponent {
useful(bb) += idx
instr match {
case LOAD_LOCAL(l1) =>
- for (val (l2, bb1, idx1) <- defs((bb, idx)); l1 == l2; !useful(bb1)(idx1))
+ for ((l2, bb1, idx1) <- defs((bb, idx)) if l1 == l2; if !useful(bb1)(idx1))
worklist += ((bb1, idx1))
case nw @ NEW(_) =>
@@ -134,7 +134,7 @@ abstract class DeadCodeElimination extends SubComponent {
()
case _ =>
- for (val (bb1, idx1) <- findDefs(bb, idx, instr.consumed); !useful(bb1)(idx1))
+ for ((bb1, idx1) <- findDefs(bb, idx, instr.consumed) if !useful(bb1)(idx1))
worklist += ((bb1, idx1))
}
}
@@ -144,12 +144,12 @@ abstract class DeadCodeElimination extends SubComponent {
def sweep(m: IMethod) {
val compensations = computeCompensations(m)
- for (val bb <- m.code.blocks.toList) {
+ for (bb <- m.code.blocks.toList) {
// Console.println("** Sweeping block " + bb + " **")
val oldInstr = bb.toList
bb.open
bb.clear
- for (val Pair(i, idx) <- oldInstr.zipWithIndex) {
+ for (Pair(i, idx) <- oldInstr.zipWithIndex) {
if (useful(bb)(idx)) {
// log(" " + i + " is useful")
bb.emit(i, i.pos)
@@ -188,12 +188,12 @@ abstract class DeadCodeElimination extends SubComponent {
private def computeCompensations(m: IMethod): mutable.Map[(BasicBlock, Int), List[Instruction]] = {
val compensations: mutable.Map[(BasicBlock, Int), List[Instruction]] = new mutable.HashMap
- for (val bb <- m.code.blocks.toList) {
+ for (bb <- m.code.blocks.toList) {
assert(bb.isClosed, "Open block in computeCompensations")
- for (val (i, idx) <- bb.toList.zipWithIndex) {
+ for ((i, idx) <- bb.toList.zipWithIndex) {
if (!useful(bb)(idx)) {
val defs = findDefs(bb, idx, i.consumed)
- for (val d <- defs) {
+ for (d <- defs) {
if (!compensations.isDefinedAt(d))
compensations(d) = i.consumedTypes map DROP
}
@@ -219,7 +219,7 @@ abstract class DeadCodeElimination extends SubComponent {
}
}
- for (val b <- linearizer.linearizeAt(method, bb))
+ for (b <- linearizer.linearizeAt(method, bb))
find(b) match {
case Some(p) => return p
case None => ()
@@ -236,7 +236,7 @@ abstract class DeadCodeElimination extends SubComponent {
var d = 0
// "I look for who produced the 'n' elements below the 'd' topmost slots of the stack"
while (n > 0 && i > 0) {
- i = i - 1
+ i -= 1
val prod = instrs(i).produced
if (prod > d) {
res = (bb, i) :: res
@@ -244,8 +244,8 @@ abstract class DeadCodeElimination extends SubComponent {
if (bb(i) != LOAD_EXCEPTION)
d = instrs(i).consumed
} else {
- d = d - prod
- d = d + instrs(i).consumed;
+ d -= prod
+ d += instrs(i).consumed
}
}
diff --git a/src/compiler/scala/tools/nsc/doc/DocGenerator.scala b/src/compiler/scala/tools/nsc/doc/DocGenerator.scala
index 6933151770..82f08f549e 100644
--- a/src/compiler/scala/tools/nsc/doc/DocGenerator.scala
+++ b/src/compiler/scala/tools/nsc/doc/DocGenerator.scala
@@ -111,7 +111,7 @@ abstract class DocGenerator extends Models {
else
urlFor(ts.head, target) ++ {
val sep = Text(", ")
- for (val t <- ts.tail)
+ for (t <- ts.tail)
yield Group(sep ++ urlFor(t, target))
}
)
@@ -121,7 +121,7 @@ abstract class DocGenerator extends Models {
.++ (Text("[") ++ urlFor(tpe.typeArgs.head, target)
.++ {
val sep = Text(", ")
- for (val t <- tpe.typeArgs.tail)
+ for (t <- tpe.typeArgs.tail)
yield Group(sep ++ urlFor(t, target))
}
.++ (Text("]")))
@@ -135,7 +135,7 @@ abstract class DocGenerator extends Models {
aref(urlFor(parents1.head.symbol), target, parents1.head.toString())
.++ {
val sep = Text(" with ")
- for (val t <- parents1.tail)
+ for (t <- parents1.tail)
yield Group(sep ++ urlFor(t, target))
}
case _ =>
@@ -227,7 +227,7 @@ abstract class DocGenerator extends Models {
</div>
<ul class="list">
{ {
- for (val top <- modules.elements.toList) yield
+ for (top <- modules.elements.toList) yield
<li><a href={urlFor(top._2)} target={classesFrame} onclick="resetKind();">{top._2.fullNameString('.')}</a></li>
} }
</ul>;
@@ -250,7 +250,7 @@ abstract class DocGenerator extends Models {
Package Summary
</td></tr>
{ {
- for (val top <- modules.elements.toList) yield
+ for (top <- modules.elements.toList) yield
<tr><td class="signature">
<code>{Text("package")}
{(aref(top._2.fullNameString('/') + "$content.html", "_self", top._2.fullNameString('.')))}</code>
@@ -286,13 +286,13 @@ abstract class DocGenerator extends Models {
if (ids contains id) null
else { ids += id; id }
}
- val body = <div>{ { for (val kind <- KINDS; classes contains kind) yield {
+ val body = <div>{ { for (kind <- KINDS if classes contains kind) yield {
<div id={pluralFor(kind)} class="kinds">
{Text(pluralFor(kind))}
</div>
<ul class="list">
{ {
- for (val mmbr <- classes(kind).toList) yield
+ for (mmbr <- classes(kind).toList) yield
<li id={idFor(kind, mmbr.tree)}>{urlFor(mmbr.tree, contentFrame)}</li>
} }
</ul>
@@ -312,7 +312,7 @@ abstract class DocGenerator extends Models {
<code>{Text(" extends ")}</code>{forType(parents.head.tpe)}
</dd> ++ (
{ {
- for (val parent <- parents.tail) yield
+ for (parent <- parents.tail) yield
<dd>
<code>{Text(" with ")}</code>{forType(parent.tpe)}
</dd>
@@ -344,7 +344,7 @@ abstract class DocGenerator extends Models {
Group(name ++ Text(buf.toString))
}
val sep = Text("@")
- for (val attr <- tree.symbol.attributes)
+ for (attr <- tree.symbol.attributes)
yield Group(br(sep ++ attrFor(attr)))
}
@@ -362,7 +362,7 @@ abstract class DocGenerator extends Models {
<dt>
{ attrsFor(mmbr.tree) }
<code>
- { { for (val str <- stringsFor(mmbr.mods)) yield Text(str + " ") } }
+ { { for (str <- stringsFor(mmbr.mods)) yield Text(str + " ") } }
{ Text(codeFor(mmbr.kind)) }
</code>
<em>{ Text(nameFor(mmbr.tree)) }</em>
@@ -388,7 +388,7 @@ abstract class DocGenerator extends Models {
</dt>
<dd>{ {
val links =
- for (val subc <- subcs)
+ for (subc <- subcs)
yield aref(urlFor(subc), contentFrame, subc.nameString)
links.reduceRight { (link: Seq[Node], seq: Seq[Node]) => link ++ Text(", ") ++ seq }
} }</dd>
@@ -412,7 +412,7 @@ abstract class DocGenerator extends Models {
def listMembersShort(mmbr: HasTree): NodeSeq =
if (mmbr.isInstanceOf[Composite]) {
val map = organize(mmbr.asInstanceOf[Composite], emptyMap)
- for (val kind <- KINDS) yield Group(
+ for (kind <- KINDS) yield Group(
(if (map contains kind)
<table cellpadding="3" class="member" summary="">
<tr>
@@ -442,9 +442,9 @@ abstract class DocGenerator extends Models {
(kind == VAR && sym.isVariable) ||
(kind == VAL && sym.isValue && !sym.isVariable && sym.hasGetter)
val parents = sym.info.parents
- for (val p <- parents; !ignored.contains(p.symbol);
+ for (p <- parents if !ignored.contains(p.symbol);
val decls = p.decls.toList filter(member => isVisible(member));
- !decls.isEmpty) yield Group(
+ if !decls.isEmpty) yield Group(
<table cellpadding="3" class="inherited" summary="">
<tr>
<td colspan="2" class="title">
@@ -466,7 +466,7 @@ abstract class DocGenerator extends Models {
(x, y) => (x.nameString compareTo y.nameString) < 0)
<td colspan="2" class="signature">
{aref1(members.head)}
- {for (val m <- members.tail) yield Text(", ") ++ aref1(m)}
+ {for (m <- members.tail) yield Text(", ") ++ aref1(m)}
</td>
} </tr>
</table>)
@@ -481,8 +481,8 @@ abstract class DocGenerator extends Models {
val map = organize(mmbr.asInstanceOf[Composite], emptyMap)
val mmbrx = mmbr
val pathx = path
- for (val kind0 <- List(OBJECT, CLASS); map contains kind0)
- for (val mmbr <- map(kind0))
+ for (kind0 <- List(OBJECT, CLASS) if map contains kind0)
+ for (mmbr <- map(kind0))
new ContentFrame {
def clazz = mmbr.asInstanceOf[ImplMod]
def kind = kind0
@@ -490,14 +490,14 @@ abstract class DocGenerator extends Models {
labelFor(kind0) + " " + mmbr.tree.symbol.nameString + " in " +
codeFor(mmbrx.kind) + " " + mmbr.tree.symbol.owner.fullNameString('.')
}
- for (val kind <- List(TRAIT, CONSTRUCTOR, VAL, VAR, DEF); map contains kind) yield Group(
+ for (kind <- List(TRAIT, CONSTRUCTOR, VAL, VAR, DEF) if map contains kind) yield Group(
<table cellpadding="3" class="member-detail" summary="">
<tr>
<td class="title">{Text(labelFor(kind))} Detail</td>
</tr>
</table>
<div>
- {for (val mmbr <- map(kind).toList) yield fullHeader(mmbr)}
+ {for (mmbr <- map(kind).toList) yield fullHeader(mmbr)}
</div>)
} else
NodeSeq.Empty
@@ -509,7 +509,7 @@ abstract class DocGenerator extends Models {
def shortHeader(mmbr: HasTree): NodeSeq =
<tr>
<td valign="top" class="modifiers">
- { for (val str <- stringsFor(mmbr.mods)) yield <code>{(Text(str + " "))}</code> }
+ { for (str <- stringsFor(mmbr.mods)) yield <code>{(Text(str + " "))}</code> }
</td>
<td class="signature">
<code>{Text(codeFor(mmbr.kind))}</code>
@@ -614,7 +614,7 @@ abstract class DocGenerator extends Models {
case ddef: DefDef =>
if (!ddef.vparamss.isEmpty &&
(!ddef.vparamss.tail.isEmpty || !ddef.vparamss.head.isEmpty)) {
- val nodes = for (val vparams <- ddef.vparamss)
+ val nodes = for (vparams <- ddef.vparamss)
yield surround("(", ")", forTrees(vparams));
nodes.flatMap(x => x.toList)
} else NodeSeq.Empty
@@ -649,7 +649,7 @@ abstract class DocGenerator extends Models {
</div>
<p>
This document is the API specification for Scala 2.
- </p> ++ (for (val kind <- KINDS; classes contains kind) yield Group(hr(
+ </p> ++ (for (kind <- KINDS if classes contains kind) yield Group(hr(
<table cellpadding="3" class="member" summary="">
<tr>
<td colspan="2" class="title">
@@ -657,7 +657,7 @@ abstract class DocGenerator extends Models {
</td>
</tr>
{ {
- for (val mmbr <- classes(kind).toList) yield shortHeader(mmbr)
+ for (mmbr <- classes(kind).toList) yield shortHeader(mmbr)
} }
</table>)))
}
@@ -768,15 +768,15 @@ abstract class DocGenerator extends Models {
<hr/> ++ ({
val decls = sym.tpe.decls.toList
//compute table members once for each relevant kind
- val tables = for (val k <- kinds.keys.toList)
+ val tables = for (k <- kinds.keys.toList)
yield (k, decls filter kinds(k))
- for (val (k, members) <- tables; !members.isEmpty) yield
+ for ((k, members) <- tables if !members.isEmpty) yield
<table cellpadding="3" class="member" summary="">
<tr>
<td colspan="2" class="title">{k} Summary</td>
</tr>
{ {
- for (val m <- members) yield
+ for (m <- members) yield
<tr>
<td valign="top" class="modifiers">
</td>
@@ -821,9 +821,9 @@ abstract class DocGenerator extends Models {
var members = emptyMap
var topLevel = ListMap.empty[ModuleClassSymbol, ListMap[Kind,TreeSet[HasTree]]]
- for (val unit <- units) {
+ for (unit <- units) {
val sourceMod = new SourceMod(unit)
- for (val mmbr <- sourceMod.members) mmbr.tree match {
+ for (mmbr <- sourceMod.members) mmbr.tree match {
case cdef: ImplDef =>
assert(cdef.symbol.owner != NoSymbol)
val sym = cdef.symbol.owner.asInstanceOf[ModuleClassSymbol]
@@ -832,13 +832,13 @@ abstract class DocGenerator extends Models {
topLevel = topLevel.update(sym, emptyMap)
topLevel = topLevel.update(sym, organize0(mmbr, topLevel(sym)))
}
- for (val p <- cdef.symbol.info.parents) {
+ for (p <- cdef.symbol.info.parents) {
subclasses(p.symbol) = cdef.symbol :: subclasses(p.symbol)
}
import Flags._
val mmbrs = cdef.symbol.info.findMember(nme.ANYNAME, MUTABLE | METHOD | BRIDGE | ACCESSOR, 0, false).alternatives
- for (val c <- mmbrs; c.isClass)
- for (val p <- c.info.parents) {
+ for (c <- mmbrs if c.isClass)
+ for (p <- c.info.parents) {
subclasses(p.symbol) = c :: subclasses(p.symbol)
}
@@ -849,7 +849,7 @@ abstract class DocGenerator extends Models {
val modules0 = {
var modules0 = new TreeMap[String, ModuleClassSymbol]
- for (val top <- topLevel.elements)
+ for (top <- topLevel.elements)
modules0 = modules0.insert(top._1.fullNameString, top._1)
modules0
}
@@ -896,7 +896,7 @@ abstract class DocGenerator extends Models {
new ListClassFrame {
def classes = {
var allClasses = emptyMap
- for (val top <- topLevel.elements)
+ for (top <- topLevel.elements)
allClasses = merge(allClasses, top._2)
allClasses
}
@@ -906,7 +906,7 @@ abstract class DocGenerator extends Models {
}
// class from for each module.
- for (val top <- topLevel.elements) {
+ for (top <- topLevel.elements) {
val module = top._1
val members = top._2
@@ -924,7 +924,7 @@ abstract class DocGenerator extends Models {
}
// do root frame for each class and object
- for (val kind <- members.elements) for (val mmbr <- kind._2.toList) {
+ for (kind <- members.elements) for (mmbr <- kind._2.toList) {
val kind0 = kind._1
new ContentFrame {
def title =
@@ -1179,7 +1179,7 @@ abstract class DocGenerator extends Models {
}
// The name of a resource is a '/'-separated path name that identifies the resource.
val rsrcdir = "scala/tools/nsc/doc/"
- for (val base <- List("style.css", "script.js")) {
+ for (base <- List("style.css", "script.js")) {
try {
val in = loader.getResourceAsStream(rsrcdir + base)
val out = new FileOutputStream(new File(outdir + File.separator + base))
@@ -1201,7 +1201,7 @@ abstract class DocGenerator extends Models {
def organize(c: Composite, map0: ListMap[Kind, TreeSet[HasTree]]) = {
var map = map0
//System.err.println("MemBERS: " + c.members.toList)
- for (val mmbr <- c.members.toList) map = organize0(mmbr, map)
+ for (mmbr <- c.members.toList) map = organize0(mmbr, map)
map
}
@@ -1312,7 +1312,7 @@ abstract class DocGenerator extends Models {
else {
val attrs = <dl>
{ {
- for (val attr <- attributes.toList) yield
+ for (attr <- attributes.toList) yield
<dt style="margin:10px 0 0 20px;">
{tag(attr._1)}
</dt>
diff --git a/src/compiler/scala/tools/nsc/symtab/Definitions.scala b/src/compiler/scala/tools/nsc/symtab/Definitions.scala
index f8c55edf10..9261b90544 100644
--- a/src/compiler/scala/tools/nsc/symtab/Definitions.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Definitions.scala
@@ -798,14 +798,14 @@ trait Definitions {
OptionClass = getClass("scala.Option")
ProductRootClass = getClass("scala.Product")
- for (val i <- 1 to MaxTupleArity) {
+ for (i <- 1 to MaxTupleArity) {
TupleClass(i) = getClass( "scala.Tuple" + i)
}
- for (val i <- 1 to MaxProductArity) {
+ for (i <- 1 to MaxProductArity) {
ProductClass(i) = getClass("scala.Product" + i)
}
/* </unapply> */
- for (val i <- 0 to MaxFunctionArity) {
+ for (i <- 0 to MaxFunctionArity) {
FunctionClass(i) = getClass("scala.Function" + i)
}
initValueClasses
diff --git a/src/compiler/scala/tools/nsc/symtab/Symbols.scala b/src/compiler/scala/tools/nsc/symtab/Symbols.scala
index e3429ceeba..b613104ece 100644
--- a/src/compiler/scala/tools/nsc/symtab/Symbols.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Symbols.scala
@@ -1,5 +1,5 @@
/* NSC -- new Scala compiler
- * Copyright 2005-2006 LAMP/EPFL
+ * Copyright 2005-2007 LAMP/EPFL
* @author Martin Odersky
*/
// $Id$
@@ -42,7 +42,7 @@ trait Symbols {
var rawname = initName
var rawflags: long = 0
private var rawpos = initPos
- val id = { ids = ids + 1; ids }
+ val id = { ids += 1; ids }
var validTo: Period = NoPeriod
@@ -56,11 +56,11 @@ trait Symbols {
else if (isTypeParameter) pos - name.length
else if (isVariable || isMethod || isClass || isModule) {
var ret = pos
- if (buf(pos) == ',') ret = ret + 1
- else if (isClass) ret = ret + ("class").length()
- else if (isModule) ret = ret + ("object").length()
- else ret = ret + ("var").length()
- while (buf(ret).isWhitespace) ret = ret + 1
+ if (buf(pos) == ',') ret += 1
+ else if (isClass) ret += "class".length()
+ else if (isModule) ret += "object".length()
+ else ret += "var".length()
+ while (buf(ret).isWhitespace) ret += 1
ret
}
else if (isValue) {
@@ -71,7 +71,7 @@ trait Symbols {
(buf(pos + 3) == ' ')) {
var pos0 = pos + 4
while (pos0 < buf.length && buf(pos0).isWhitespace)
- pos0 = pos0 + 1
+ pos0 += 1
pos0
} else pos
@@ -412,7 +412,7 @@ trait Symbols {
} finally {
phase = current
}
- cnt = cnt + 1
+ cnt += 1
// allow for two completions:
// one: sourceCompleter to LazyType, two: LazyType to completed type
if (cnt == 3) throw new Error("no progress in completing " + this + ":" + tp)
@@ -802,9 +802,9 @@ trait Symbols {
final def allOverriddenSymbols: List[Symbol] =
if (owner.isClass && !owner.info.baseClasses.isEmpty)
- for { val bc <- owner.info.baseClasses.tail
+ for { bc <- owner.info.baseClasses.tail
val s = overriddenSymbol(bc)
- s != NoSymbol } yield s
+ if s != NoSymbol } yield s
else List()
/** The symbol accessed by a super in the definition of this symbol when
@@ -1169,7 +1169,7 @@ trait Symbols {
case TypeRef(_, sym, _) =>
assert(sym != this, this)
case ClassInfoType(parents, _, _) =>
- for(val p <- parents) assert(p.symbol != this, owner)
+ for(p <- parents) assert(p.symbol != this, owner)
case _ =>
}
super.setInfo(tp)
@@ -1339,13 +1339,13 @@ trait Symbols {
def cloneSymbols(syms: List[Symbol]): List[Symbol] = {
val syms1 = syms map (.cloneSymbol)
- for (val sym1 <- syms1) sym1.setInfo(sym1.info.substSym(syms, syms1))
+ for (sym1 <- syms1) sym1.setInfo(sym1.info.substSym(syms, syms1))
syms1
}
def cloneSymbols(syms: List[Symbol], owner: Symbol): List[Symbol] = {
val syms1 = syms map (.cloneSymbol(owner))
- for (val sym1 <- syms1) sym1.setInfo(sym1.info.substSym(syms, syms1))
+ for (sym1 <- syms1) sym1.setInfo(sym1.info.substSym(syms, syms1))
syms1
}
diff --git a/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala b/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala
index 3446443628..10c7818e6e 100644
--- a/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala
@@ -81,7 +81,7 @@ trait SyntheticMethods requires Analyzer {
//val retTpe = lub(accs map (.tpe.resultType))
val method = syntheticMethod(nme.productElement, FINAL, MethodType(List(IntClass.tpe), AnyClass.tpe/*retTpe*/))
typed(DefDef(method, vparamss => Match(Ident(vparamss.head.head), {
- (for(val (sym,i) <- accs.zipWithIndex) yield {
+ (for((sym,i) <- accs.zipWithIndex) yield {
CaseDef(Literal(Constant(i)),EmptyTree, Ident(sym))
}):::List(CaseDef(Ident(nme.WILDCARD), EmptyTree,
Throw(New(TypeTree(IndexOutOfBoundsExceptionClass.tpe), List(List(
@@ -212,7 +212,7 @@ trait SyntheticMethods requires Analyzer {
// case classes are implicitly declared serializable
clazz.attributes = AnnotationInfo(SerializableAttr.tpe, List(), List()) :: clazz.attributes
- for (val stat <- templ.body) {
+ for (stat <- templ.body) {
if (stat.isDef && stat.symbol.isMethod && stat.symbol.hasFlag(CASEACCESSOR) && !isPublic(stat.symbol)) {
ts += newAccessorMethod(stat)
stat.symbol.resetFlag(CASEACCESSOR)
@@ -244,7 +244,7 @@ trait SyntheticMethods requires Analyzer {
if (!hasImplementation(nme.readResolve)) ts += readResolveMethod
}
if (!forCLDC && !forMSIL)
- for (val sym <- clazz.info.decls.toList)
+ for (sym <- clazz.info.decls.toList)
if (!sym.getAttributes(BeanPropertyAttr).isEmpty)
if (sym.isGetter)
addBeanGetterMethod(sym)
diff --git a/src/dbc/scala/dbc/Database.scala b/src/dbc/scala/dbc/Database.scala
index 3167c30c71..f10d73f8a0 100644
--- a/src/dbc/scala/dbc/Database.scala
+++ b/src/dbc/scala/dbc/Database.scala
@@ -1,7 +1,7 @@
/* __ *\
** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2003-2006, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | **
+** / __/ __// _ | / / / _ | (c) 2003-2007, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
@@ -9,30 +9,32 @@
// $Id:Database.scala 6853 2006-03-20 16:58:47 +0100 (Mon, 20 Mar 2006) dubochet $
-package scala.dbc;
+package scala.dbc
-import java.sql._;
+import java.sql._
/** A link to a database. The <code>Database</code> abstract class must
- * be specialised for every different DBMS.
- * @author Gilles Dubochet **/
+ * be specialised for every different DBMS.
+ *
+ * @author Gilles Dubochet
+ */
case class Database(dbms: Vendor) {
class Closed extends Exception {}
/** A lock used for operations that need to be atomic for this database
* instance. */
- private val lock: scala.concurrent.Lock = new scala.concurrent.Lock();
+ private val lock: scala.concurrent.Lock = new scala.concurrent.Lock()
/** The vendor of the DBMS that contains this database. */
- private val vendor: Vendor = dbms;
+ private val vendor: Vendor = dbms
/** The Database connections available to use. */
- private var availableConnections: List[Connection] = Nil;
+ private var availableConnections: List[Connection] = Nil
/** The connections that are currently in use. */
- private var usedConnections: List[Connection] = Nil;
+ private var usedConnections: List[Connection] = Nil
/** Whether the database no longer accepts new connections. */
private var closing: Boolean = false;
@@ -40,7 +42,7 @@ case class Database(dbms: Vendor) {
/** Retrieves a connection from the available connection pool or creates
* a new one.
*
- * @returns A connection that can be used to access the database.
+ * @return A connection that can be used to access the database.
*/
private def getConnection: Connection = {
if (closing) {
@@ -72,23 +74,23 @@ case class Database(dbms: Vendor) {
*/
private def closeConnection(connection: Connection): Unit = {
if (closing) {
- connection.close();
+ connection.close()
} else {
- lock.acquire;
+ lock.acquire
usedConnections = usedConnections.remove(e => (e.equals(connection)));
if (availableConnections.length < vendor.retainedConnections)
availableConnections = connection :: availableConnections
else
- connection.close();
- lock.release;
+ connection.close()
+ lock.release
}
}
/** ..
*/
- def close: Unit = {
- closing = true;
- for (val conn <- availableConnections) conn.close();
+ def close {
+ closing = true
+ for (conn <- availableConnections) conn.close()
}
/** Executes a statement that returns a relation on this database.
@@ -108,12 +110,12 @@ case class Database(dbms: Vendor) {
def executeStatement(relationStatement: statement.Relation,
debug: Boolean): result.Relation =
new scala.dbc.result.Relation {
- val statement = relationStatement;
- if (debug) Console.println("## " + statement.sqlString);
- private val connection = getConnection;
- val sqlResult = connection.createStatement().executeQuery(statement.sqlString);
- closeConnection(connection);
- statement.typeCheck(this);
+ val statement = relationStatement
+ if (debug) Console.println("## " + statement.sqlString)
+ private val connection = getConnection
+ val sqlResult = connection.createStatement().executeQuery(statement.sqlString)
+ closeConnection(connection)
+ statement.typeCheck(this)
}
/** Executes a statement that updates the state of the database.
@@ -159,10 +161,10 @@ case class Database(dbms: Vendor) {
*/
def executeStatement[ResultType](transactionStatement: statement.Transaction[ResultType], debug: Boolean): result.Status[ResultType] = {
new scala.dbc.result.Status[ResultType] {
- val touchedCount = None;
- val statement = transactionStatement;
- private val connection = getConnection;
- connection.setAutoCommit(false);
+ val touchedCount = None
+ val statement = transactionStatement
+ private val connection = getConnection
+ connection.setAutoCommit(false)
val jdbcStatement: java.sql.Statement = connection.createStatement();
if (debug) Console.println("## " + transactionStatement.sqlStartString);
jdbcStatement.execute(transactionStatement.sqlStartString);
@@ -175,11 +177,11 @@ case class Database(dbms: Vendor) {
case e: Throwable => {
if (debug) Console.println("## " + transactionStatement.sqlAbortString);
jdbcStatement.execute(transactionStatement.sqlAbortString);
- throw e;
+ throw e
}
}
- connection.setAutoCommit(true);
- closeConnection(connection);
+ connection.setAutoCommit(true)
+ closeConnection(connection)
}
}
diff --git a/src/dbc/scala/dbc/result/Relation.scala b/src/dbc/scala/dbc/result/Relation.scala
index 5ffc387a87..6388c5594c 100644
--- a/src/dbc/scala/dbc/result/Relation.scala
+++ b/src/dbc/scala/dbc/result/Relation.scala
@@ -1,7 +1,7 @@
/* __ *\
** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2003-2006, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | **
+** / __/ __// _ | / / / _ | (c) 2003-2007, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
@@ -9,7 +9,7 @@
// $Id:Relation.scala 6853 2006-03-20 16:58:47 +0100 (Mon, 20 Mar 2006) dubochet $
-package scala.dbc.result;
+package scala.dbc.result
/** An ISO-9075:2003 (SQL) table. This is equivalent to a relation in the
@@ -17,24 +17,24 @@ package scala.dbc.result;
abstract class Relation extends AnyRef with Iterable[Tuple] {
/** The statement that generated this relation. */
- def statement: scala.dbc.statement.Relation;
+ def statement: scala.dbc.statement.Relation
/** A JDBC result containing this relation. */
- protected def sqlResult: java.sql.ResultSet;
+ protected def sqlResult: java.sql.ResultSet
/** A JDBC metadata object attached to the relation. */
- protected def sqlMetadata: java.sql.ResultSetMetaData = sqlResult.getMetaData();
+ protected def sqlMetadata: java.sql.ResultSetMetaData = sqlResult.getMetaData()
/** Metadata about all fields in a tuple of the relation. */
def metadata: List[FieldMetadata] =
- for (val count <- List.range(1, sqlMetadata.getColumnCount()+1)) yield
+ for (count <- List.range(1, sqlMetadata.getColumnCount()+1)) yield
new FieldMetadata {
- val name: String = sqlMetadata.getColumnName(count);
- val index: Int = count;
- val datatype: DataType = dbc.datatype.Factory.create(sqlMetadata,count);
- val catalog: String = sqlMetadata.getCatalogName(count);
- val schema: String = sqlMetadata.getSchemaName(count);
- val table: String = sqlMetadata.getTableName(count);
+ val name: String = sqlMetadata.getColumnName(count)
+ val index: Int = count
+ val datatype: DataType = dbc.datatype.Factory.create(sqlMetadata,count)
+ val catalog: String = sqlMetadata.getCatalogName(count)
+ val schema: String = sqlMetadata.getSchemaName(count)
+ val table: String = sqlMetadata.getTableName(count)
}
/** Metadata about the field at the given index. If there is no such
@@ -52,18 +52,18 @@ abstract class Relation extends AnyRef with Iterable[Tuple] {
* in DBMS. This means that if this method is called multiple times, all returned
* iterators will share the same state. */
def elements: Iterator[Tuple] = new Iterator[Tuple] {
- protected val result: java.sql.ResultSet = Relation.this.sqlResult;
- def hasNext: Boolean = !(result.isLast());
+ protected val result: java.sql.ResultSet = Relation.this.sqlResult
+ def hasNext: Boolean = !(result.isLast())
def next: Tuple = {
if (result.next()) {
new Tuple {
- val me = this;
- val originatingRelation = Relation.this;
- val fields: List[Field] = for (val fieldMetadata <- metadata) yield
+ val me = this
+ val originatingRelation = Relation.this
+ val fields: List[Field] = for (fieldMetadata <- metadata) yield
new Field {
- val metadata = fieldMetadata;
- val content = dbc.value.Factory.create(result,metadata.index,metadata.datatype);
- val originatingTuple = me;
+ val metadata = fieldMetadata
+ val content = dbc.value.Factory.create(result,metadata.index,metadata.datatype)
+ val originatingTuple = me
}
}
} else error("next on empty iterator")
diff --git a/src/library/scala/collection/BitSet.scala b/src/library/scala/collection/BitSet.scala
index 5cc6b66874..41863fe29b 100644
--- a/src/library/scala/collection/BitSet.scala
+++ b/src/library/scala/collection/BitSet.scala
@@ -151,7 +151,7 @@ abstract class BitSet extends Set[Int] {
val newarr = new Array[Int](length)
if (arr.length > 0)
arraycopy(this.arr, 0, newarr, 0, length)
- newarr;
+ newarr
}
/**
* @return a copy of the array underlying this bitset
@@ -163,9 +163,9 @@ abstract class BitSet extends Set[Int] {
@deprecated override def toArray[B >: Int]: Array[B] = {
val ret0 = underlying
val ret1 = new Array[B](ret0.length)
- for (val i <- 0.until(ret0.length))
+ for (i <- 0.until(ret0.length))
ret1(i) = (ret0(i) : Any).asInstanceOf[B]
ret1
}
- protected override def stringPrefix = "Set";
+ protected override def stringPrefix = "Set"
}
diff --git a/src/library/scala/collection/mutable/FlatHashTable.scala b/src/library/scala/collection/mutable/FlatHashTable.scala
index aeab7cd2ea..d968e97c8b 100644
--- a/src/library/scala/collection/mutable/FlatHashTable.scala
+++ b/src/library/scala/collection/mutable/FlatHashTable.scala
@@ -1,5 +1,5 @@
/* NSC -- new Scala compiler
- * Copyright 2005-2006 LAMP/EPFL
+ * Copyright 2005-2007 LAMP/EPFL
* @author Martin Odersky
*/
// $Id: HashSet.scala 9235 2006-11-13 14:59:18 +0000 (Mon, 13 Nov 2006) mihaylov $
@@ -94,7 +94,7 @@ trait FlatHashTable[A] {
h1 = (h1 + 1) % table.length
}
table(h0) = null
- tableSize = tableSize - 1
+ tableSize -= 1
if (tableDebug) checkConsistent()
return
}
@@ -123,13 +123,13 @@ trait FlatHashTable[A] {
while (i < oldtable.length) {
val entry = oldtable(i)
if (null != entry) addEntry(entry.asInstanceOf[A])
- i = i + 1
+ i += 1
}
if (tableDebug) checkConsistent()
}
private def checkConsistent() {
- for (val i <- 0 until table.length)
+ for (i <- 0 until table.length)
if (table(i) != null && !containsEntry(table(i).asInstanceOf[A]))
assert(false, i+" "+table(i)+" "+table.toString)
}
@@ -153,7 +153,7 @@ trait FlatHashTable[A] {
protected def clear() {
var i = table.length - 1
- while (i >= 0) { table(i) = null; i = i - 1 }
+ while (i >= 0) { table(i) = null; i -= 1 }
tableSize = 0
}
}
diff --git a/src/library/scala/util/automata/DetWordAutom.scala b/src/library/scala/util/automata/DetWordAutom.scala
index e0075e5bc8..fd267a6648 100644
--- a/src/library/scala/util/automata/DetWordAutom.scala
+++ b/src/library/scala/util/automata/DetWordAutom.scala
@@ -1,7 +1,7 @@
/* __ *\
** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2003-2006, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | **
+** / __/ __// _ | / / / _ | (c) 2003-2007, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
@@ -64,11 +64,11 @@ abstract class DetWordAutom[T <: AnyRef] {
var j = 0; while( j < nstates ) {
if (j < finals.length)
map = map.update(j, finals(j))
- j = j + 1
+ j += 1
}
sb.append(map.toString())
sb.append(" delta=\n")
- for (val i <- 0 until nstates) {
+ for (i <- 0 until nstates) {
sb.append( i )
sb.append("->")
sb.append(delta(i).toString())
diff --git a/src/library/scala/util/automata/Inclusion.scala b/src/library/scala/util/automata/Inclusion.scala
index eb8beb47b3..ee5fe6100f 100644
--- a/src/library/scala/util/automata/Inclusion.scala
+++ b/src/library/scala/util/automata/Inclusion.scala
@@ -1,7 +1,7 @@
/* __ *\
** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2003-2006, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | **
+** / __/ __// _ | / / / _ | (c) 2003-2007, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
@@ -29,9 +29,9 @@ trait Inclusion[A <: AnyRef] {
*/
def inclusion(dfa1: DetWordAutom[A], dfa2: DetWordAutom[A]) = {
- def encode(q1:Int, q2:Int) = 1 + q1 + q2 * dfa1.nstates
- def decode2(c:Int) = (c-1) / (dfa1.nstates) //integer division
- def decode1(c:Int) = (c-1) % (dfa1.nstates)
+ def encode(q1: Int, q2: Int) = 1 + q1 + q2 * dfa1.nstates
+ def decode2(c: Int) = (c-1) / (dfa1.nstates) //integer division
+ def decode1(c: Int) = (c-1) % (dfa1.nstates)
var q1 = 0 //dfa1.initstate; // == 0
var q2 = 0 //dfa2.initstate; // == 0
@@ -45,7 +45,7 @@ trait Inclusion[A <: AnyRef] {
mark(last) = max // mark (q1,q2)
while (current != 0 && result) {
//Console.println("current = [["+q1+" "+q2+"]] = "+current);
- for (val letter <- labels) {
+ for (letter <- labels) {
val r1 = dfa1.next(q1,letter)
val r2 = dfa2.next(q2,letter)
if (dfa1.isFinal(r1) && !dfa2.isFinal(r2))
diff --git a/src/library/scala/util/automata/NondetWordAutom.scala b/src/library/scala/util/automata/NondetWordAutom.scala
index 4580706031..3aa9febf6e 100644
--- a/src/library/scala/util/automata/NondetWordAutom.scala
+++ b/src/library/scala/util/automata/NondetWordAutom.scala
@@ -1,7 +1,7 @@
/* __ *\
** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2003-2006, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | **
+** / __/ __// _ | / / / _ | (c) 2003-2007, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
@@ -66,8 +66,8 @@ abstract class NondetWordAutom[T <: AnyRef] {
/** returns a bitset with the next states for given state and label */
def next(Q: immutable.BitSet, a: T): immutable.BitSet = {
val x = new mutable.BitSet(nstates)
- for (val q <- Q) {
- for (val i <- next(q,a)) {
+ for (q <- Q) {
+ for (i <- next(q,a)) {
x += i
}
}
@@ -77,12 +77,12 @@ abstract class NondetWordAutom[T <: AnyRef] {
def nextDefault(Q: immutable.BitSet): immutable.BitSet = {
val x = new mutable.BitSet(nstates)
- for (val q <- Q) {
- for (val i <- default(q)) { //@todo: OR
+ for (q <- Q) {
+ for (i <- default(q)) { //@todo: OR
x += i
}
}
- x.toImmutable;
+ x.toImmutable
}
override def toString = {
@@ -94,11 +94,11 @@ abstract class NondetWordAutom[T <: AnyRef] {
var j = 0; while (j < nstates) {
if (isFinal(j))
map = map.update(j, finals(j));
- j = j + 1
+ j += 1
}
sb.append(map.toString)
sb.append(" delta=\n")
- for (val i <- 0 until nstates) {
+ for (i <- 0 until nstates) {
sb.append(" ")
sb.append( i )
sb.append("->")
diff --git a/src/library/scala/util/automata/WordBerrySethi.scala b/src/library/scala/util/automata/WordBerrySethi.scala
index 20b4edfc64..ee031d67c6 100644
--- a/src/library/scala/util/automata/WordBerrySethi.scala
+++ b/src/library/scala/util/automata/WordBerrySethi.scala
@@ -1,7 +1,7 @@
/* __ *\
** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2003-2006, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | **
+** / __/ __// _ | / / / _ | (c) 2003-2007, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
@@ -123,11 +123,11 @@ abstract class WordBerrySethi extends BaseBerrySethi {
//@ifdef compiler if( label == Wildcard )
//@ifdef compiler defaultq.update(src, dest::defaultq( src ))
//@ifdef compiler else
- val q = deltaq( src );
+ val q = deltaq(src)
q.update(label, dest::(q.get(label) match {
case Some(x) => x
case _ => Nil
- }));
+ }))
}
protected def initialize(subexpr: Seq[RegExp]): Unit = {
@@ -157,7 +157,7 @@ abstract class WordBerrySethi extends BaseBerrySethi {
while (j < pos) {
deltaq(j) = new mutable.HashMap[_labelT,List[Int]]()
defaultq(j) = Nil
- j = j + 1
+ j += 1
}
}
@@ -175,7 +175,7 @@ abstract class WordBerrySethi extends BaseBerrySethi {
else
makeTransition( j, k, labelAt(k))
}
- j = j + 1
+ j += 1
}
}
@@ -203,7 +203,7 @@ abstract class WordBerrySethi extends BaseBerrySethi {
var i = 0
while (i < deltaq.length) {
delta1 = delta1.update(i, deltaq(i))
- i = i + 1
+ i += 1
}
val finalsArr = new Array[Int](pos)
@@ -213,7 +213,7 @@ abstract class WordBerrySethi extends BaseBerrySethi {
case Some(z) => z
case None => 0 // 0 == not final
};
- k = k + 1
+ k += 1
}
}
@@ -223,7 +223,7 @@ abstract class WordBerrySethi extends BaseBerrySethi {
{
var k = 0; while (k < initials.size) {
initialsArr(k) = it.next
- k = k + 1
+ k += 1
}
}
@@ -234,15 +234,15 @@ abstract class WordBerrySethi extends BaseBerrySethi {
val labels = delta1(k).keys
val hmap =
new mutable.HashMap[_labelT, immutable.BitSet]
- for (val lab <- labels) {
+ for (lab <- labels) {
val trans = delta1(k)
val x = new mutable.BitSet(pos)
- for (val q <- trans(lab))
+ for (q <- trans(lab))
x += q
hmap.update(lab, x.toImmutable)
}
deltaArr(k) = hmap
- k = k + 1
+ k += 1
}
}
val defaultArr = new Array[immutable.BitSet](pos)
@@ -250,10 +250,10 @@ abstract class WordBerrySethi extends BaseBerrySethi {
{
var k = 0; while(k < pos) {
val x = new mutable.BitSet(pos)
- for (val q <- defaultq(k))
+ for (q <- defaultq(k))
x += q
defaultArr(k) = x.toImmutable
- k = k + 1
+ k += 1
}
}
diff --git a/src/library/scala/util/parsing/Parsers.scala b/src/library/scala/util/parsing/Parsers.scala
index 37ff73ac7b..f046318c85 100644
--- a/src/library/scala/util/parsing/Parsers.scala
+++ b/src/library/scala/util/parsing/Parsers.scala
@@ -1,7 +1,7 @@
/* __ *\
** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2003-2006, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | **
+** / __/ __// _ | / / / _ | (c) 2003-2007, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
@@ -57,7 +57,7 @@ abstract class Parsers {
}
def &&& [b](p: => Parser[b]): Parser[b] =
- for (val _ <- this; val x <- p) yield x
+ for (_ <- this; val x <- p) yield x
}
def not[a](p: Parser[a]) = new Parser[unit] {
@@ -75,11 +75,11 @@ abstract class Parsers {
rep1(p) ||| succeed(List())
def rep1[a](p: Parser[a]): Parser[List[a]] =
- for (val x <- p; val xs <- rep(p)) yield x :: xs
+ for (x <- p; val xs <- rep(p)) yield x :: xs
def repWith[a, b](p: Parser[a], sep: Parser[b]): Parser[List[a]] =
- for (val x <- p; val xs <- rep(sep &&& p)) yield x :: xs
+ for (x <- p; val xs <- rep(sep &&& p)) yield x :: xs
def opt[a](p: Parser[a]): Parser[List[a]] =
- (for (val x <- p) yield List(x)) ||| succeed(List())
+ (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
index 760fdc6f92..483edd459e 100644
--- a/src/library/scala/util/parsing/SimpleTokenizer.scala
+++ b/src/library/scala/util/parsing/SimpleTokenizer.scala
@@ -1,7 +1,7 @@
/* __ *\
** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2003-2006, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | **
+** / __/ __// _ | / / / _ | (c) 2003-2007, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
@@ -11,8 +11,6 @@
package scala.util.parsing
-import compat.StringBuilder
-
/** This class ...
*
* @author Burak Emir
@@ -27,7 +25,7 @@ class SimpleTokenizer(in: Iterator[char], delimiters: String) extends Iterator[S
private def delimArray: Array[boolean] = {
val ds = List.fromString(delimiters)
val da = new Array[boolean]((0 /: ds)(max) + 1)
- for (val ch <- ds) { da(ch) = true }
+ for (ch <- ds) { da(ch) = true }
da
}
diff --git a/src/library/scala/xml/PrefixedAttribute.scala b/src/library/scala/xml/PrefixedAttribute.scala
index 397a68507c..0ee62b9cd7 100644
--- a/src/library/scala/xml/PrefixedAttribute.scala
+++ b/src/library/scala/xml/PrefixedAttribute.scala
@@ -1,7 +1,7 @@
/* __ *\
** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2003-2006, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | **
+** / __/ __// _ | / / / _ | (c) 2003-2007, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
@@ -11,10 +11,12 @@
package scala.xml
-import compat.StringBuilder
-
/** prefixed attributes always have a non-null namespace.
+ *
+ * @param pre ...
+ * @param key ...
* @param value the attribute value, which may not be null
+ * @param next ...
*/
class PrefixedAttribute(val pre: String,
val key: String,
@@ -77,16 +79,13 @@ class PrefixedAttribute(val pre: String,
sb.append(key)
sb.append('=')
val sb2 = new StringBuilder()
- for (val c <- value) {
- Utility.toXML(c, TopScope, sb2, true)
- }
+ for (c <- value) Utility.toXML(c, TopScope, sb2, true)
Utility.appendQuoted(sb2.toString(), sb)
}
- def wellformed(scope: NamespaceBinding): Boolean = {
+ def wellformed(scope: NamespaceBinding): Boolean =
(null == next(scope.getURI(pre), scope, key) &&
next.wellformed(scope))
- }
def remove(key: String) =
copy(next.remove(key))
diff --git a/src/library/scala/xml/UnprefixedAttribute.scala b/src/library/scala/xml/UnprefixedAttribute.scala
index 81d02c955f..4e4694fadb 100644
--- a/src/library/scala/xml/UnprefixedAttribute.scala
+++ b/src/library/scala/xml/UnprefixedAttribute.scala
@@ -1,7 +1,7 @@
/* __ *\
** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2002-2006, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | **
+** / __/ __// _ | / / / _ | (c) 2002-2007, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
@@ -68,9 +68,7 @@ class UnprefixedAttribute(val key: String, val value: Seq[Node], next1: MetaData
sb.append(key)
sb.append('=')
val sb2 = new StringBuilder()
- for (val c <- value) {
- Utility.toXML(c, TopScope, sb2, true)
- }
+ for (c <- value) Utility.toXML(c, TopScope, sb2, true)
Utility.appendQuoted(sb2.toString(), sb)
}
@@ -78,7 +76,7 @@ class UnprefixedAttribute(val key: String, val value: Seq[Node], next1: MetaData
(null == next(null, scope, key)) && next.wellformed(scope)
def remove(key: String) =
- if(this.key == key) next else copy(next.remove(key))
+ if (this.key == key) next else copy(next.remove(key))
def remove(namespace: String, scope: NamespaceBinding, key: String): MetaData =
next.remove(namespace, scope, key)
diff --git a/src/library/scala/xml/parsing/FactoryAdapter.scala b/src/library/scala/xml/parsing/FactoryAdapter.scala
index 42b17a4ec7..733a2e0aa8 100644
--- a/src/library/scala/xml/parsing/FactoryAdapter.scala
+++ b/src/library/scala/xml/parsing/FactoryAdapter.scala
@@ -1,7 +1,7 @@
/* __ *\
** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2003-2006, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | **
+** / __/ __// _ | / / / _ | (c) 2003-2007, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
@@ -13,14 +13,8 @@ package scala.xml.parsing
import java.io.{InputStream, Reader, File, FileDescriptor, FileInputStream}
import scala.collection.mutable.{HashMap,Stack}
-import compat.StringBuilder
-import org.xml.sax.Attributes
-import org.xml.sax.ContentHandler
-
-import org.xml.sax.ErrorHandler
-import org.xml.sax.Locator
-import org.xml.sax.InputSource
+import org.xml.sax.{Attributes, InputSource}
import org.xml.sax.SAXException
import org.xml.sax.SAXNotRecognizedException
@@ -97,7 +91,7 @@ abstract class FactoryAdapter extends DefaultHandler() {
buffer.append(ch(i))
ws = false
}
- i = i + 1
+ i += 1
}
} else { // compliant:report every character
buffer.append(ch, offset, length)
@@ -133,7 +127,7 @@ abstract class FactoryAdapter extends DefaultHandler() {
var m: MetaData = Null
var scpe = scopeStack.top
- for (val i <- List.range(0, attributes.getLength())) {
+ for (i <- List.range(0, attributes.getLength())) {
//val attrType = attributes.getType(i); // unused for now
val qname = attributes.getQName(i)
val value = attributes.getValue(i)
diff --git a/src/library/scala/xml/parsing/MarkupParser.scala b/src/library/scala/xml/parsing/MarkupParser.scala
index 771ec50790..a1c34f7287 100644
--- a/src/library/scala/xml/parsing/MarkupParser.scala
+++ b/src/library/scala/xml/parsing/MarkupParser.scala
@@ -1,7 +1,7 @@
/* __ *\
** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2003-2006, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | **
+** / __/ __// _ | / / / _ | (c) 2003-2007, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
@@ -11,7 +11,6 @@
package scala.xml.parsing
-import compat.StringBuilder
import scala.io.Source
import scala.xml.dtd._
@@ -211,13 +210,13 @@ trait MarkupParser requires (MarkupParser with MarkupHandler) extends AnyRef wit
//Console.println("[MarkupParser::document] children now: "+children.toList);
var elemCount = 0;
var theNode: Node = null;
- for (val c <- children) c match {
+ for (c <- children) c match {
case _:ProcInstr => ;
case _:Comment => ;
case _:EntityRef => // todo: fix entities, shouldn't be "special"
reportSyntaxError("no entity references alllowed here");
case s:SpecialNode =>
- if(s.toString().trim().length() > 0) //non-empty text nodes not allowed
+ if (s.toString().trim().length() > 0) //non-empty text nodes not allowed
elemCount = elemCount + 2;
case m:Node =>
elemCount = elemCount + 1;
@@ -439,27 +438,27 @@ trait MarkupParser requires (MarkupParser with MarkupHandler) extends AnyRef wit
* see [15]
*/
def xComment: NodeSeq = {
- val sb: StringBuilder = new StringBuilder();
- xToken('-');
- xToken('-');
+ val sb: StringBuilder = new StringBuilder()
+ xToken('-')
+ xToken('-')
while (true) {
if (ch == '-' && { sb.append(ch); nextch; ch == '-' }) {
- sb.setLength(sb.length() - 1);
- nextch;
- xToken('>');
- return handle.comment(pos, sb.toString());
- } else sb.append(ch);
- nextch;
+ sb.setLength(sb.length() - 1)
+ nextch
+ xToken('>')
+ return handle.comment(pos, sb.toString())
+ } else sb.append(ch)
+ nextch
}
- throw FatalError("this cannot happen");
- };
+ throw FatalError("this cannot happen")
+ }
/* todo: move this into the NodeBuilder class */
def appendText(pos: Int, ts: NodeBuffer, txt: String): Unit = {
if (preserveWS)
ts &+ handle.text(pos, txt);
else
- for (val t <- TextBuffer.fromString(txt).toText) {
+ for (t <- TextBuffer.fromString(txt).toText) {
ts &+ handle.text(pos, t.text);
}
}
diff --git a/test/files/run/caseclasses.scala b/test/files/run/caseclasses.scala
index e064ba859f..72a7232d8a 100644
--- a/test/files/run/caseclasses.scala
+++ b/test/files/run/caseclasses.scala
@@ -12,14 +12,14 @@ object Test extends Application {
}
try {
- Bar() element 3
+ Bar() productElement 3
throw new NullPointerException("duh")
} catch {
case x:IndexOutOfBoundsException =>
}
try {
- f(2) element 3
+ f(2) productElement 3
throw new NullPointerException("duh")
} catch {
case x:IndexOutOfBoundsException =>
diff --git a/test/files/run/misc.scala b/test/files/run/misc.scala
index 4ae0f37007..6229cd4510 100644
--- a/test/files/run/misc.scala
+++ b/test/files/run/misc.scala
@@ -222,12 +222,12 @@ Console.println;
Console.println(
true // Foo(3,'a',Bar()).caseElement( -1 ) == null // throws Exception now
- && Foo(3,'a',Bar()).element( 0 ) == 3
- && Foo(3,'a',Bar()).element( 1 ) == 'a'
- && Foo(3,'a',Bar()).element( 2 ) == Bar()
+ && Foo(3,'a',Bar()).productElement( 0 ) == 3
+ && Foo(3,'a',Bar()).productElement( 1 ) == 'a'
+ && Foo(3,'a',Bar()).productElement( 2 ) == Bar()
&& true // Foo(3,'a',Bar()).caseElement( 3 ) == null // throws Exception now
- && Bar().arity == 0
- && Foo(3,'a',Bar()).arity == 3);
+ && Bar().productArity == 0
+ && Foo(3,'a',Bar()).productArity == 3);
//############################################################################