first stab at scala indenter... by no means complete or correct
--HG-- branch : pmacs2
This commit is contained in:
parent
0f1a81d199
commit
dd3151d354
|
@ -1,5 +1,5 @@
|
|||
#import commands
|
||||
#from tab import StackTabber
|
||||
from tab import StackTabber2
|
||||
#from method import Method
|
||||
from mode import Fundamental
|
||||
from lex import Grammar, PatternRule, RegionRule, PatternMatchRule
|
||||
|
@ -54,11 +54,25 @@ class ScalaGrammar(Grammar):
|
|||
PatternRule('scala.null', 'null'),
|
||||
]
|
||||
|
||||
class ScalaTabber(StackTabber2):
|
||||
open_tokens = {'delimiter': {'{': '}', '(': ')', '[': ']'}}
|
||||
close_tokens = {'delimiter': {'}': '{', ')': '(', ']': '['}}
|
||||
control_tokens = {'scala.reserved': set(('if', 'else', 'while', 'do', 'for'))}
|
||||
end_at_eof = True
|
||||
start_free_tokens = {'string.start': 'string.end'}
|
||||
end_free_tokens = {'string.end': 'string.start'}
|
||||
is_ignored_tokens = set(('spaces', 'eol', 'comment', 'comment.start',
|
||||
'comment.data', 'comment.null', 'comment.end'))
|
||||
is_indent_tokens = set(('spaces',))
|
||||
def is_base(self, y): return y == 0
|
||||
|
||||
class Scala(Fundamental):
|
||||
name = 'Scala'
|
||||
extensions = ['.scala']
|
||||
tabwidth = 2
|
||||
tabbercls = ScalaTabber
|
||||
grammar = ScalaGrammar
|
||||
commentc = '--'
|
||||
commentc = '//'
|
||||
opentokens = ('delimiter',)
|
||||
opentags = {'(': ')', '[': ']', '{': '}'}
|
||||
closetokens = ('delimiter',)
|
||||
|
|
Loading…
Reference in New Issue