Created
June 6, 2011 01:24
-
-
Save xuwei-k/1009618 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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