aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/printing/SyntaxHighlighting.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/dotty/tools/dotc/printing/SyntaxHighlighting.scala')
-rw-r--r--src/dotty/tools/dotc/printing/SyntaxHighlighting.scala19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/dotty/tools/dotc/printing/SyntaxHighlighting.scala b/src/dotty/tools/dotc/printing/SyntaxHighlighting.scala
index 14b3a5050..8a79e1ddc 100644
--- a/src/dotty/tools/dotc/printing/SyntaxHighlighting.scala
+++ b/src/dotty/tools/dotc/printing/SyntaxHighlighting.scala
@@ -89,8 +89,9 @@ object SyntaxHighlighting {
append('<', { x => x == "<-" || x == "<:" || x == "<%" }, keyword)
case '>' =>
append('>', { x => x == ">:" }, keyword)
- case '#' if prev != ' ' && prev != '.' =>
- newBuf append keyword("#")
+ case '#' =>
+ if (prev != ' ' && prev != '.') newBuf append keyword("#")
+ else newBuf += n
prev = '#'
case '@' =>
appendWhile('@', _ != ' ', annotation)
@@ -100,12 +101,14 @@ object SyntaxHighlighting {
appendLiteral('\'')
case '`' =>
appendTo('`', _ == '`', none)
- case c if c.isUpper && keywordStart =>
- appendWhile(c, !typeEnders.contains(_), typeDef)
- case c if numberStart(c) =>
- appendWhile(c, { x => x.isDigit || x == '.' || x == '\u0000'}, literal)
- case c =>
- newBuf += c; prev = c
+ case _ => {
+ if (n.isUpper && keywordStart)
+ appendWhile(n, !typeEnders.contains(_), typeDef)
+ else if (numberStart(n))
+ appendWhile(n, { x => x.isDigit || x == '.' || x == '\u0000'}, literal)
+ else
+ newBuf += n; prev = n
+ }
}
}
}