Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save xuwei-k/1009618 to your computer and use it in GitHub Desktop.
Save xuwei-k/1009618 to your computer and use it in GitHub Desktop.
// http://d.hatena.ne.jp/yuroyoro/20110527/1306496377 を使う
val keywords = Seq(
"abstract",
"case",
"catch",
"class",
"def",
"do",
"else",
"extends",
"false",
"finally",
"final",
"forSome",
"for",
"if",
"implicit",
"import",
"lazy",
"match",
"new",
"null",
"object",
"override",
"package",
"private",
"protected",
"return",
"sealed",
"super",
"this",
"throw",
"trait",
"try",
"true",
"type",
"val",
"var",
"while",
"with",
"yield",
"_",
":",
"=",
"=>",
"<:",
"<%",
">:",
"#",
"@"
)
def print(obj:Any){
System.out.print(
keywords.foldLeft(obj.toString){(a,b) => a.replace(b,b.colored.red.toString) }
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment