diff options
author | michelou <michelou@epfl.ch> | 2006-07-11 15:48:55 +0000 |
---|---|---|
committer | michelou <michelou@epfl.ch> | 2006-07-11 15:48:55 +0000 |
commit | f3c1d397f95f64a65802dc55131270ea5a9b4c02 (patch) | |
tree | a51c5d7a973daa90333d55b098b7ff37a2c1a6cc | |
parent | 8d6cbbead8ebb2946da25227adf747596aec5042 (diff) | |
download | scala-f3c1d397f95f64a65802dc55131270ea5a9b4c02.tar.gz scala-f3c1d397f95f64a65802dc55131270ea5a9b4c02.tar.bz2 scala-f3c1d397f95f64a65802dc55131270ea5a9b4c02.zip |
fixed method SpecialNode.toString in DocGenerat...
fixed method SpecialNode.toString in DocGenerator.scala
-rw-r--r-- | src/compiler/scala/tools/nsc/doc/DocGenerator.scala | 34 | ||||
-rw-r--r-- | src/library/scala/xml/SpecialNode.scala | 20 |
2 files changed, 32 insertions, 22 deletions
diff --git a/src/compiler/scala/tools/nsc/doc/DocGenerator.scala b/src/compiler/scala/tools/nsc/doc/DocGenerator.scala index e05c5c7c56..38e8b2f202 100644 --- a/src/compiler/scala/tools/nsc/doc/DocGenerator.scala +++ b/src/compiler/scala/tools/nsc/doc/DocGenerator.scala @@ -135,9 +135,9 @@ abstract class DocGenerator extends Models { } abstract class ListModuleContentFrame extends Frame { - val path = "root-content"; - val title = "All Packages"; - def modules : TreeMap[String,ModuleClassSymbol]; + val path = "root-content" + val title = "All Packages" + def modules: TreeMap[String, ModuleClassSymbol] def body : NodeSeq = { <span><div class="page-title"> Scala 2 @@ -245,9 +245,9 @@ abstract class DocGenerator extends Models { } else NodeSeq.Empty; def listMembersFull(mmbr : HasTree) : NodeSeq = if (mmbr.isInstanceOf[Composite]) { - val map = organize(mmbr.asInstanceOf[Composite], emptyMap); - val mmbrx = mmbr; - val pathx = path; + val map = organize(mmbr.asInstanceOf[Composite], emptyMap) + val mmbrx = mmbr + val pathx = path for (val kind0 <- OBJECT :: CLASS :: Nil; map.contains(kind0)) for (val mmbr <- map(kind0)) { new ContentFrame { def clazz = mmbr.asInstanceOf[ImplMod]; @@ -285,12 +285,16 @@ abstract class DocGenerator extends Models { def fullComment(mmbr: HasTree): NodeSeq = { if (comments.contains(mmbr.tree.symbol)) comment(comments(mmbr.tree.symbol), false) else NodeSeq.Empty; - }; + } + def shortComment(mmbr: HasTree): NodeSeq = { if (comments.contains(mmbr.tree.symbol)) comment(comments(mmbr.tree.symbol), true) else NodeSeq.Empty; - }; - def ifT (cond: Boolean, nodes: NodeSeq) = if (cond) nodes else NodeSeq.Empty; + } + + def ifT (cond: Boolean, nodes: NodeSeq) = + if (cond) nodes else NodeSeq.Empty + def ifT (tree : Tree, nodes : NodeSeq, before : Boolean) = { if (tree != EmptyTree && tree.tpe.symbol != definitions.AnyClass && @@ -319,6 +323,7 @@ abstract class DocGenerator extends Models { case EmptyTree => NodeSeq.Empty; case _ => Text("XX=" + tree.getClass() + " " + tree.toString()); } + def forTrees(trees: List[Tree]) : NodeSeq = { if (trees.isEmpty) NodeSeq.Empty; else { @@ -341,6 +346,7 @@ abstract class DocGenerator extends Models { if (tparams.isEmpty) Text(""); else surround("[", "]", forTrees(tparams)); } + def argsFor(ht: HasTree): NodeSeq = ht.tree match { case ddef : DefDef => if (!ddef.vparamss.isEmpty && @@ -351,6 +357,7 @@ abstract class DocGenerator extends Models { } else NodeSeq.Empty; case _ => NodeSeq.Empty; } + def resultFor(ht: HasTree): NodeSeq = ht.tree match { case vdef : ValOrDefDef => if (!vdef.symbol.nameString.equals("this")) @@ -480,8 +487,8 @@ abstract class DocGenerator extends Models { }; val module0 = module; new ListClassContentFrame { - def classes = top._2; - def module = module0; + def classes = top._2 + def module = module0 }; // do root frame for each class and object @@ -542,10 +549,11 @@ abstract class DocGenerator extends Models { } def parse(str : String) : NodeSeq = { + import scala.runtime.compat.StringBuilder new SpecialNode { def label = "#PCDATA" - def toString(sb: StringBuffer): StringBuffer = { - sb.append(str.trim()); + def toString(sb: StringBuilder): StringBuilder = { + sb.append(str.trim()) sb } diff --git a/src/library/scala/xml/SpecialNode.scala b/src/library/scala/xml/SpecialNode.scala index 5d0fbcab4c..b0cd95a2f4 100644 --- a/src/library/scala/xml/SpecialNode.scala +++ b/src/library/scala/xml/SpecialNode.scala @@ -9,27 +9,29 @@ // $Id$ -package scala.xml; +package scala.xml import scala.runtime.compat.StringBuilder -/** a special XML node is either text (PCDATA), a comment, a PI, or - * an entity ref -**/ +/** <code>SpecialNode</code> is a special XML node which + * represents either text (PCDATA), a comment, a PI, or an entity ref. + * + * @author Burak Emir + */ abstract class SpecialNode extends Node { /** always empty */ - final override def attributes = Null; + final override def attributes = Null /** always Node.EmptyNamespace */ - final override def namespace = null; + final override def namespace = null /** always empty */ - final def child = Nil; + final def child = Nil final override def toString(): String = - toString(new StringBuilder()).toString(); + toString(new StringBuilder()).toString() - def toString(sb:StringBuilder): StringBuilder ; + def toString(sb: StringBuilder): StringBuilder } |