summaryrefslogtreecommitdiff
path: root/src/scaladoc
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2014-06-20 10:56:12 +0200
committerJason Zaugg <jzaugg@gmail.com>2014-06-20 10:56:12 +0200
commit2238a85d732dbfd63cfd9910511aa140838933f7 (patch)
tree6b4c161d8fdc70d301cb3d823b9e12f2a50aed2c /src/scaladoc
parentb664a488acca9d89c600f5b87ba9a9ca77aace59 (diff)
downloadscala-2238a85d732dbfd63cfd9910511aa140838933f7.tar.gz
scala-2238a85d732dbfd63cfd9910511aa140838933f7.tar.bz2
scala-2238a85d732dbfd63cfd9910511aa140838933f7.zip
SI-8672 Better end-of-sentence detection for Scaladoc
The first sentence of a Scaladoc comment is parsed as the summary. However, this was breaking of the sentence at the first `.`, even if that was immediately followed by another character. This commit only considers a period followed by whitespace, EOL or EOF as the end of a sentence.
Diffstat (limited to 'src/scaladoc')
-rwxr-xr-xsrc/scaladoc/scala/tools/nsc/doc/base/CommentFactoryBase.scala12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/scaladoc/scala/tools/nsc/doc/base/CommentFactoryBase.scala b/src/scaladoc/scala/tools/nsc/doc/base/CommentFactoryBase.scala
index a933c35c99..19cc27b40b 100755
--- a/src/scaladoc/scala/tools/nsc/doc/base/CommentFactoryBase.scala
+++ b/src/scaladoc/scala/tools/nsc/doc/base/CommentFactoryBase.scala
@@ -666,7 +666,7 @@ trait CommentFactoryBase { this: MemberLookupBase =>
}
def summary(): Inline = {
- val i = inline(check("."))
+ val i = inline(checkSentenceEnded())
Summary(
if (jump("."))
Chain(List(i, Text(".")))
@@ -785,6 +785,16 @@ trait CommentFactoryBase { this: MemberLookupBase =>
})
}
+ def checkSentenceEnded(): Boolean = {
+ (char == '.') && {
+ val poff = offset
+ nextChar() // read '.'
+ val ok = char == endOfText || char == endOfLine || isWhitespace(char)
+ offset = poff
+ ok
+ }
+ }
+
def reportError(pos: Position, message: String) {
reporter.warning(pos, message)
}