diff options
author | michelou <michelou@epfl.ch> | 2004-10-08 11:20:53 +0000 |
---|---|---|
committer | michelou <michelou@epfl.ch> | 2004-10-08 11:20:53 +0000 |
commit | 5b80c0ad5d9006856780eaca6aee40c738fbe196 (patch) | |
tree | 883b10ddcae52b224bc0d807f1c6f3168fee23b2 /doc | |
parent | edd9c3b808ca1cbe4e4abb35c57b34acf22fb8c8 (diff) | |
download | scala-5b80c0ad5d9006856780eaca6aee40c738fbe196.tar.gz scala-5b80c0ad5d9006856780eaca6aee40c738fbe196.tar.bz2 scala-5b80c0ad5d9006856780eaca6aee40c738fbe196.zip |
- removed 'do' in for loop syntax.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/reference/ReferencePart.tex | 33 | ||||
-rw-r--r-- | doc/reference/ReferencePartAppendix.tex | 2 |
2 files changed, 17 insertions, 18 deletions
diff --git a/doc/reference/ReferencePart.tex b/doc/reference/ReferencePart.tex index 3e660216ad..1d4ddfe9f0 100644 --- a/doc/reference/ReferencePart.tex +++ b/doc/reference/ReferencePart.tex @@ -2483,7 +2483,7 @@ module FileSystem { | try `{' block `}' [catch Expr] [finally Expr] | while '(' Expr ')' Expr | do Expr [`;'] while `(' Expr ')' - | for `(' Enumerators `)' (do | yield) Expr + | for `(' Enumerators `)' [yield] Expr | return [Expr] | throw Expr | [SimpleExpr `.'] id `=' Expr @@ -4829,7 +4829,7 @@ object Predef { \section{Class Node}\label{cls:Node} \begin{lstlisting} -package scala.xml ; +package scala.xml; trait Node { @@ -4837,40 +4837,39 @@ trait Node { def label: String; /** attribute axis */ - def attribute: Map[ String, String ]; + def attribute: Map[String, String]; /** child axis (all children of this node) */ def child: Seq[Node]; /** descendant axis (all descendants of this node) */ - def descendant:Seq[Node] = child.toList.flatMap { + def descendant: Seq[Node] = child.toList.flatMap { x => x::x.descendant.asInstanceOf[List[Node]] - } ; + }; /** descendant axis (all descendants of this node) */ - def descendant_or_self:Seq[Node] = this::child.toList.flatMap { + def descendant_or_self: Seq[Node] = this::child.toList.flatMap { x => x::x.descendant.asInstanceOf[List[Node]] - } ; + }; - override def equals( x:Any ):boolean = x match { + override def equals(x: Any): boolean = x match { case that:Node => that.label == this.label && - that.attribute.sameElements( this.attribute ) && - that.child.sameElements( this.child ) + that.attribute.sameElements(this.attribute) && + that.child.sameElements(this.child) case _ => false - } + }; /** XPath style projection function. Returns all children of this node * that are labelled with 'that. The document order is preserved. */ - def \(that:Symbol): NodeSeq = { + def \(that: Symbol): NodeSeq = { new NodeSeq({ that.name match { - case "_" => child.toList; case _ => var res:List[Node] = Nil; - for( val x <- child.elements; x.label == that.name ) { + for (val x <- child.elements; x.label == that.name) { res = x::res; } res.reverse @@ -4881,18 +4880,18 @@ trait Node { /** XPath style projection function. Returns all nodes labelled with the * name 'that from the descendant_or_self axis. Document order is preserved. */ - def \\(that:Symbol): NodeSeq = { + def \\(that: Symbol): NodeSeq = { new NodeSeq( that.name match { case "_" => this.descendant_or_self; case _ => this.descendant_or_self.asInstanceOf[List[Node]]. - filter( x => x.label == that.name ); + filter(x => x.label == that.name); }) } /** hashcode for this XML node */ override def hashCode() = - Utility.hashCode( label, attribute.toList.hashCode(), child); + Utility.hashCode(label, attribute.toList.hashCode(), child); /** string representation of this node */ override def toString() = Utility.toXML(this); diff --git a/doc/reference/ReferencePartAppendix.tex b/doc/reference/ReferencePartAppendix.tex index 47087aea5c..c7cc10dcf0 100644 --- a/doc/reference/ReferencePartAppendix.tex +++ b/doc/reference/ReferencePartAppendix.tex @@ -70,7 +70,7 @@ grammar. Expr1 ::= if `(' Expr1 `)' Expr [[`;'] else Expr] | try `{' Block `}' [catch Expr] [finally Expr] | do Expr [`;'] while `(' Expr ')' - | for `(' Enumerators `)' (do | yield) Expr + | for `(' Enumerators `)' [yield] Expr | return [Expr] | throw Expr | [SimpleExpr `.'] id `=' Expr |