parent
6fd32c02df
commit
2cb5939d3d
|
@ -175,7 +175,7 @@ class Application(object):
|
||||||
'haskell', 'erlang', 'iperl', 'iperlmini', 'ipython', 'ipythonmini',
|
'haskell', 'erlang', 'iperl', 'iperlmini', 'ipython', 'ipythonmini',
|
||||||
'awk', 'shell', 'shellmini', 'fstab', 'yacc', 'pipe', 'mbox',
|
'awk', 'shell', 'shellmini', 'fstab', 'yacc', 'pipe', 'mbox',
|
||||||
'error', 'lua', 'lily', 'forth', 'ebnf', 'colortest', 'go',
|
'error', 'lua', 'lily', 'forth', 'ebnf', 'colortest', 'go',
|
||||||
'inform6'
|
'inform6', 'scala',
|
||||||
)
|
)
|
||||||
for name in names:
|
for name in names:
|
||||||
exec("import mode.%s; mode.%s.install(self)" % (name, name))
|
exec("import mode.%s; mode.%s.install(self)" % (name, name))
|
||||||
|
|
|
@ -0,0 +1,62 @@
|
||||||
|
import commands
|
||||||
|
import time
|
||||||
|
from tab import StackTabber
|
||||||
|
from method import Method
|
||||||
|
from mode import Fundamental
|
||||||
|
from lex import Grammar, PatternRule, RegionRule, PatternMatchRule
|
||||||
|
from mode.python import StringGrammar1, StringGrammar2
|
||||||
|
from mode.pipe import Pipe
|
||||||
|
from method.shell import Interact
|
||||||
|
|
||||||
|
chr1 = '[a-zA-Z_]'
|
||||||
|
chr2 = '[a-zA-Z_0-9]'
|
||||||
|
word = chr1 + chr2 + '*'
|
||||||
|
|
||||||
|
class NestedCommentGrammar(Grammar): pass
|
||||||
|
NestedCommentGrammar.rules = [
|
||||||
|
RegionRule('comment', r'/\*', NestedCommentGrammar, r'\*/'),
|
||||||
|
PatternRule('data', r'(?:[^\*]|\*(?!/))+'),
|
||||||
|
]
|
||||||
|
|
||||||
|
class ScalaGrammar(Grammar):
|
||||||
|
rules = [
|
||||||
|
PatternRule('scala.comment', '//.*$'),
|
||||||
|
RegionRule('scala.comment', r'/\*', NestedCommentGrammar, r'\*/'),
|
||||||
|
|
||||||
|
PatternRule('spaces', r'(?:\t| )+'),
|
||||||
|
PatternRule('eol', r'\n'),
|
||||||
|
|
||||||
|
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]?'),
|
||||||
|
PatternRule('scala.integer', '-?0x[0-9A-Fa-f]+[Ll]?'),
|
||||||
|
PatternRule('scala.integer', '-?0[0-7]+[Ll]?'),
|
||||||
|
|
||||||
|
PatternRule('scala.float', r'-?[0-9]+\.[0-9]*'), # FIXME
|
||||||
|
|
||||||
|
PatternRule('scala.bool', '(?:true|false)(?![a-zA-Z0-9_])'),
|
||||||
|
|
||||||
|
PatternRule('scala.char', r"'(?:[^'\\]|\\u[0-9A-Fa-f]{4}|\\[0-7]{1,3}|\\[btnfr\"'\\])'"),
|
||||||
|
#PatternRule('scala.string', '-?[0-9]'),
|
||||||
|
#PatternRule('scala.symbol', '-?[0-9]'),
|
||||||
|
PatternRule('scalar.null', 'null'),
|
||||||
|
]
|
||||||
|
|
||||||
|
class Scala(Fundamental):
|
||||||
|
name = 'Scala'
|
||||||
|
extensions = ['.scala']
|
||||||
|
grammar = ScalaGrammar
|
||||||
|
commentc = '--'
|
||||||
|
opentokens = ('delimiter',)
|
||||||
|
opentags = {'(': ')', '[': ']', '{': '}'}
|
||||||
|
closetokens = ('delimiter',)
|
||||||
|
closetags = {')': '(', ']': '[', '}': '{'}
|
||||||
|
colors = {}
|
||||||
|
_bindings = {
|
||||||
|
'close-paren': (')',),
|
||||||
|
'close-brace': ('}',),
|
||||||
|
'close-bracket': (']',),
|
||||||
|
}
|
||||||
|
|
||||||
|
def install(*args):
|
||||||
|
Scala.install(*args)
|
Loading…
Reference in New Issue