From 6495210d685fcf89e8ee453e8999ee8883f20683 Mon Sep 17 00:00:00 2001 From: Felix Mulder Date: Thu, 15 Sep 2016 11:52:22 +0200 Subject: Add highlighting for `???` --- src/dotty/tools/dotc/printing/SyntaxHighlighting.scala | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/dotty/tools/dotc/printing/SyntaxHighlighting.scala b/src/dotty/tools/dotc/printing/SyntaxHighlighting.scala index c933dd0b9..51dee349b 100644 --- a/src/dotty/tools/dotc/printing/SyntaxHighlighting.scala +++ b/src/dotty/tools/dotc/printing/SyntaxHighlighting.scala @@ -36,6 +36,7 @@ object SyntaxHighlighting { private def typeDef(str: String) = TypeColor + str + NoColor private def literal(str: String) = LiteralColor + str + NoColor private def annotation(str: String) = AnnotationColor + str + NoColor + private val tripleQs = Console.RED_B + "???" + NoColor private val keywords: Seq[String] = for { index <- IF to INLINE // All alpha keywords @@ -123,7 +124,11 @@ object SyntaxHighlighting { case '`' => appendTo('`', _ == '`', none) case _ => { - if (n.isUpper && keywordStart) + if (n == '?' && remaining.take(2).mkString == "??") { + takeChars(2) + newBuf append tripleQs + prev = '?' + } else if (n.isUpper && keywordStart) appendWhile(n, !typeEnders.contains(_), typeDef) else if (numberStart(n)) appendWhile(n, { x => x.isDigit || x == '.' || x == '\u0000'}, literal) -- cgit v1.2.3