slightly better scala support

--HG--
branch : pmacs2
This commit is contained in:
Erik Osheim 2010-08-11 10:19:12 -04:00
parent ac0fb2afb2
commit 9ef9c4b633
1 changed files with 19 additions and 2 deletions

View File

@ -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': ('}',),