diff --git a/mode/scala.py b/mode/scala.py index 4a664c9..deff0b1 100644 --- a/mode/scala.py +++ b/mode/scala.py @@ -31,6 +31,8 @@ class ScalaGrammar(Grammar): PatternRule('spaces', r'(?:\t| )+'), PatternRule('eol', r'\n'), + PatternRule('delimiter', r'(?:;|{|}|\[|\]|\(|\)|,|\.|<|>|:|/|\+|-|\*|=)'), + PatternRule('scala.reserved', '(?:yield|with|while|var|val|type|true|try|trait|throw|this|super|sealed|return|protected|private|package|override|object|null|new|match|lazy|import|implicit|if|forSome|for|finally|final|false|extends|else|do|def|class|catch|case|abstract)(?!%s)' % word), PatternRule('scala.integer', '-?(?:0|[1-9])[0-9]*[Ll]?'), @@ -44,7 +46,12 @@ class ScalaGrammar(Grammar): PatternRule('scala.char', r"'(?:[^'\\]|\\u[0-9A-Fa-f]{4}|\\[0-7]{1,3}|\\[btnfr\"'\\])'"), RegionRule('scala.string', '"', StringGrammar, '"'), PatternRule('scala.symbol', "'[a-zA-Z_][a-zA-Z0-9_]*"), - PatternRule('scalar.null', 'null'), + + PatternRule('scala.annotation', '@[a-zA-Z_][a-zA-Z0-9_]*'), + + PatternRule('scala.bareword', '[a-zA-Z_][a-zA-Z0-9_]*'), + + PatternRule('scala.null', 'null'), ] class Scala(Fundamental): @@ -56,7 +63,17 @@ class Scala(Fundamental): opentags = {'(': ')', '[': ']', '{': '}'} closetokens = ('delimiter',) closetags = {')': '(', ']': '[', '}': '{'} - colors = {} + + colors = { + 'scala.annotation': ('magenta', 'default'), + 'scala.bool': ('magenta', 'default'), + 'scala.null': ('magenta', 'default'), + + 'scala.integer': ('default', 'default'), + 'scala.float': ('default', 'default'), + 'scala.bareword': ('default', 'default'), + } + _bindings = { 'close-paren': (')',), 'close-brace': ('}',),