File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed
library/src/scala/tasty/util Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package scala.tasty
2
2
package util
3
3
4
4
import scala .annotation .switch
5
+ import scala .tasty .util .SyntaxHighlightUtils ._
5
6
6
7
class ShowSourceCode [T <: Tasty with Singleton ](tasty0 : T ) extends Show [T ](tasty0) {
7
8
import tasty .{rootContext => _ , _ }
Original file line number Diff line number Diff line change
1
+ package scala .tasty
2
+ package util
3
+
4
+ object SyntaxHighlightUtils {
5
+
6
+ // Keep in sync with SyntaxHighlighting
7
+ private val NoColor = Console .RESET
8
+ private val CommentColor = Console .BLUE
9
+ private val KeywordColor = Console .YELLOW
10
+ private val ValDefColor = Console .CYAN
11
+ private val LiteralColor = Console .RED
12
+ private val StringColor = Console .GREEN
13
+ private val TypeColor = Console .MAGENTA
14
+ private val AnnotationColor = Console .MAGENTA
15
+
16
+ def none (str : String ) = str
17
+ def keyword (str : String ) = KeywordColor + str + NoColor
18
+ def typeDef (str : String ) = TypeColor + str + NoColor
19
+ def literal (str : String ) = LiteralColor + str + NoColor
20
+ def valDef (str : String ) = ValDefColor + str + NoColor
21
+ def operator (str : String ) = TypeColor + str + NoColor
22
+ def annotation (str : String ) =
23
+ if (str.trim == " @" ) str else { AnnotationColor + str + NoColor }
24
+ val tripleQs = Console .RED_B + " ???" + NoColor
25
+
26
+ }
You can’t perform that action at this time.
0 commit comments