parent
b673ef2a52
commit
d1195b991f
|
@ -26,11 +26,16 @@ class HaskellGrammar(Grammar):
|
|||
PatternRule(r'char', r"'[^'\\]'"),
|
||||
PatternRule(r'char', r"'(?:[^'\\]|\\(?:NUL|SOH|STX|ETX|EOT|ENQ|ACK|BEL|BS|HT|LF|VT|FF|CR|SO|SI|DLE|DC1|DC2|DC3|DC4|NAK|SYN|ETB|CAN|EM|SUB|ESC|FS|GS|RS|US|SP|DEL|[&abfnrtv\\\"\']|\^[a-z]|\d{1,3}|o[0-7]{0,3}|x(?:[0-9a-f]){0,2}))'"),
|
||||
|
||||
PatternRule(r'spaces', r' +'),
|
||||
PatternRule(r'eol', r'\n'),
|
||||
PatternRule(r'delimiter', r'[\[\](){};]'),
|
||||
|
||||
RegionRule(r'string', r'"', StringGrammar, r'"'),
|
||||
PatternRule(r'reserved', r"(?:_|where|type|then|of|newtype|module|let|instance|infixr|infixl|infix|in|import|if|else|do|deriving|default|data|class|case)(?![a-zA-Z0-9_'])"),
|
||||
PatternRule(r'hs_declaration', r"^[a-z_][a-zA-Z0-9_']*"),
|
||||
PatternRule(r'hs_variable', r"[a-z_][a-zA-Z0-9_']*"),
|
||||
PatternRule(r'hs_constructor', r"[A-Z][a-zA-Z0-9_']*"),
|
||||
PatternRule(r'hs_operator', r'`[a-z_][a-zA-Z0-9_\']*`'),
|
||||
PatternRule(r'operator', r'@|!|>@>|>>=|>>|=>|::|->|;|<-|\\\\|\.\.|!!|:|\+\+|\||\.|\\|>=|>|/=|==|<=|<|\|\||&&|\^\^|\*\*|##|\^|/|\*|-|\+|='),
|
||||
]
|
||||
|
||||
|
@ -44,17 +49,23 @@ class Haskell(mode.Fundamental):
|
|||
commentc = '--'
|
||||
#tabbercls = mode.lisp.LispTabber
|
||||
grammar = HaskellGrammar
|
||||
#opentokens = ('delimiter',)
|
||||
#opentags = {'(': ')'}
|
||||
#closetokens = ('delimiter',)
|
||||
#closetags = {')': '('}
|
||||
opentokens = ('delimiter',)
|
||||
opentags = {'(': ')', '{': '}', '[': ']'}
|
||||
closetokens = ('delimiter',)
|
||||
closetags = {')': '(', '}': '{', ']': '['}
|
||||
colors = {
|
||||
'hs_constructor': ('magenta', 'default', 'bold'),
|
||||
'hs_declaration': ('blue', 'default', 'bold'),
|
||||
'hs_variable': ('yellow', 'default', 'bold'),
|
||||
'hs_operator': ('cyan', 'default', 'bold'),
|
||||
'string.gap.start': ('red', 'default', 'bold'),
|
||||
'string.gap.null': ('red', 'default', 'bold'),
|
||||
'string.gap.end': ('red', 'default', 'bold'),
|
||||
}
|
||||
def __init__(self, w):
|
||||
mode.Fundamental.__init__(self, w)
|
||||
self.add_bindings('close-paren', (')',))
|
||||
self.add_bindings('close-brace', ('}',))
|
||||
self.add_bindings('close-bracket', (']',))
|
||||
|
||||
install = Haskell.install
|
||||
|
|
Loading…
Reference in New Issue