diff options
author | Gilles Dubochet <gilles.dubochet@epfl.ch> | 2010-01-28 10:48:38 +0000 |
---|---|---|
committer | Gilles Dubochet <gilles.dubochet@epfl.ch> | 2010-01-28 10:48:38 +0000 |
commit | 88a93f2bd3dcc81f83fb60911e87091cbde25514 (patch) | |
tree | b67e623cd24c100a65e4eacd2a79120afd688bb3 /src/compiler/scala/tools/nsc/ast/DocComments.scala | |
parent | b08a2a652fa1c436c71356f7ca75017e3fd9fdb8 (diff) | |
download | scala-88a93f2bd3dcc81f83fb60911e87091cbde25514.tar.gz scala-88a93f2bd3dcc81f83fb60911e87091cbde25514.tar.bz2 scala-88a93f2bd3dcc81f83fb60911e87091cbde25514.zip |
[scaladoc] Comment parsing is improved:
* tags in code blocks no longer confuse the parser;
* `@note` and `@example` are recognised tags;
* Empty comments no longer generate "must start with a sentence" warnings;
* `@usecase` parsing works better in some situations with blank comment lines above or below.
No review.
Diffstat (limited to 'src/compiler/scala/tools/nsc/ast/DocComments.scala')
-rwxr-xr-x | src/compiler/scala/tools/nsc/ast/DocComments.scala | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/DocComments.scala b/src/compiler/scala/tools/nsc/ast/DocComments.scala index a6792b3ba7..34b1c97f0c 100755 --- a/src/compiler/scala/tools/nsc/ast/DocComments.scala +++ b/src/compiler/scala/tools/nsc/ast/DocComments.scala @@ -154,9 +154,9 @@ trait DocComments { self: SymbolTable => var tocopy = startTag(dst, dstSections dropWhile (!isMovable(dst, _))) if (copyFirstPara) { - val eop = // end of first para, which is delimited by blank line, or tag, or end of comment - findNext(src, 0) (src.charAt(_) == '\n') min startTag(src, srcSections) - out append src.substring(0, eop) + val eop = // end of comment body (first para), which is delimited by blank line, or tag, or end of comment + (findNext(src, 0)(src.charAt(_) == '\n')) min startTag(src, srcSections) + out append src.substring(0, eop).trim copied = 3 tocopy = 3 } @@ -167,16 +167,13 @@ trait DocComments { self: SymbolTable => case None => srcSec match { case Some((start1, end1)) => - out append dst.substring(copied, tocopy) + out append dst.substring(copied, tocopy).trim copied = tocopy - out append src.substring(start1, end1) + out append src.substring(start1, end1).trim case None => } } - def mergeParam(name: String, srcMap: Map[String, (Int, Int)], dstMap: Map[String, (Int, Int)]) = - mergeSection(srcMap get name, dstMap get name) - for (params <- sym.paramss; param <- params) mergeSection(srcParams get param.name.toString, dstParams get param.name.toString) for (tparam <- sym.typeParams) @@ -280,7 +277,7 @@ trait DocComments { self: SymbolTable => startsWithTag(raw, idx, "@define") || startsWithTag(raw, idx, "@usecase")) val (defines, usecases) = sections partition (startsWithTag(raw, _, "@define")) val end = startTag(raw, sections) -/* + /* println("processing doc comment:") println(raw) println("===========>") |