File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
src/dotty/tools/dotc/printing Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ package printing
4
4
5
5
import parsing .Tokens ._
6
6
import scala .annotation .switch
7
+ import scala .collection .mutable
7
8
import scala .collection .mutable .StringBuilder
8
9
9
10
/** This object provides functions for syntax highlighting in the REPL */
@@ -38,7 +39,7 @@ object SyntaxHighlighting {
38
39
def apply (chars : Iterable [Char ]): Vector [Char ] = {
39
40
var prev : Char = 0
40
41
var remaining = chars.toStream
41
- val newBuf = new StringBuilder
42
+ val newBuf = new mutable. StringBuilder
42
43
43
44
@ inline def keywordStart =
44
45
prev == 0 || prev == ' ' || prev == '{' || prev == '(' || prev == '\n '
@@ -77,10 +78,15 @@ object SyntaxHighlighting {
77
78
(n : @ switch) match {
78
79
case '/' =>
79
80
if (remaining.nonEmpty) {
80
- takeChar() match {
81
- case '/' => eolComment()
82
- case '*' => blockComment()
83
- case x => newBuf += '/' ; remaining = x #:: remaining
81
+ remaining.head match {
82
+ case '/' =>
83
+ takeChar()
84
+ eolComment()
85
+ case '*' =>
86
+ takeChar()
87
+ blockComment()
88
+ case x =>
89
+ newBuf += '/'
84
90
}
85
91
} else newBuf += '/'
86
92
case '=' =>
@@ -262,4 +268,5 @@ object SyntaxHighlighting {
262
268
263
269
newBuf.toVector
264
270
}
271
+
265
272
}
You can’t perform that action at this time.
0 commit comments