2008-05-15 03:20:41 -04:00
|
|
|
import color, mode
|
2008-05-21 12:13:49 -04:00
|
|
|
from lex import Grammar, PatternRule, RegionRule
|
|
|
|
from mode.perl import StringGrammar, PerlGrammar
|
2008-05-15 03:20:41 -04:00
|
|
|
|
2008-05-21 12:13:49 -04:00
|
|
|
class IperlGrammar(Grammar):
|
|
|
|
rules = [
|
|
|
|
RegionRule(r'string', r'"', StringGrammar, r'"'),
|
|
|
|
RegionRule(r'string', r"'", StringGrammar, r"'"),
|
|
|
|
RegionRule(r'iperl_input', r'^(?:>>>|\.\.>)', PerlGrammar, '\n$'),
|
|
|
|
PatternRule(r'iperl_reserved', r'undef'),
|
|
|
|
]
|
|
|
|
class Iperl(mode.Fundamental):
|
2009-03-17 15:24:10 -04:00
|
|
|
name = 'IPerl'
|
2008-05-21 12:13:49 -04:00
|
|
|
grammar = IperlGrammar()
|
2009-03-17 15:24:10 -04:00
|
|
|
colors = {
|
2008-05-21 12:13:49 -04:00
|
|
|
'iperl_input.start': ('red', 'default', 'bold'),
|
|
|
|
'iperl_reserved': ('magenta', 'default', 'bold'),
|
|
|
|
}
|
2008-05-26 23:57:09 -04:00
|
|
|
def __init__(self, w):
|
|
|
|
mode.Fundamental.__init__(self, w)
|
|
|
|
self.add_bindings('iperl-start', ('M-e',))
|
2008-05-15 03:20:41 -04:00
|
|
|
|
2008-05-21 12:13:49 -04:00
|
|
|
install = Iperl.install
|