@@ -227,11 +227,11 @@ object Scanners {
227227 */
228228 private var docstringMap : SortedMap [Int , Comment ] = SortedMap .empty
229229
230- /* A Buffer for comment positions */
231- private val commentPosBuf = new mutable.ListBuffer [Span ]
230+ /* A Buffer for comments */
231+ private val commentBuf = new mutable.ListBuffer [Comment ]
232232
233- /** Return a list of all the comment positions */
234- def commentSpans : List [Span ] = commentPosBuf .toList
233+ /** Return a list of all the comments */
234+ def comments : List [Comment ] = commentBuf .toList
235235
236236 private def addComment (comment : Comment ): Unit = {
237237 val lookahead = lookaheadReader()
@@ -246,7 +246,7 @@ object Scanners {
246246 def getDocComment (pos : Int ): Option [Comment ] = docstringMap.get(pos)
247247
248248 /** A buffer for comments */
249- private val commentBuf = CharBuffer (initialCharBufferSize)
249+ private val currentCommentBuf = CharBuffer (initialCharBufferSize)
250250
251251 def toToken (identifier : SimpleName ): Token =
252252 def handleMigration (keyword : Token ): Token =
@@ -523,7 +523,7 @@ object Scanners {
523523 *
524524 * The following tokens can start an indentation region:
525525 *
526- * : = => <- if then else while do try catch
526+ * : = => <- if then else while do try catch
527527 * finally for yield match throw return with
528528 *
529529 * Inserting an INDENT starts a new indentation region with the indentation of the current
@@ -1019,7 +1019,7 @@ object Scanners {
10191019
10201020 private def skipComment (): Boolean = {
10211021 def appendToComment (ch : Char ) =
1022- if (keepComments) commentBuf .append(ch)
1022+ if (keepComments) currentCommentBuf .append(ch)
10231023 def nextChar () = {
10241024 appendToComment(ch)
10251025 Scanner .this .nextChar()
@@ -1047,9 +1047,9 @@ object Scanners {
10471047 def finishComment (): Boolean = {
10481048 if (keepComments) {
10491049 val pos = Span (start, charOffset - 1 , start)
1050- val comment = Comment (pos, commentBuf .toString)
1051- commentBuf .clear()
1052- commentPosBuf += pos
1050+ val comment = Comment (pos, currentCommentBuf .toString)
1051+ currentCommentBuf .clear()
1052+ commentBuf += comment
10531053
10541054 if (comment.isDocComment)
10551055 addComment(comment)
@@ -1065,7 +1065,7 @@ object Scanners {
10651065 else if (ch == '*' ) { nextChar(); skipComment(); finishComment() }
10661066 else {
10671067 // This was not a comment, remove the `/` from the buffer
1068- commentBuf .clear()
1068+ currentCommentBuf .clear()
10691069 false
10701070 }
10711071 }
0 commit comments