pmacs3/mode/ipython.py

25 lines
802 B
Python
Raw Permalink Normal View History

from mode import Fundamental
2008-05-26 23:57:09 -04:00
from lex import Grammar, PatternRule, RegionRule
from mode.python import StringGrammar1, StringGrammar2, PythonGrammar
2008-05-26 23:57:09 -04:00
class IpythonGrammar(Grammar):
rules = [
PatternRule(r'comment', r'#.*$'),
RegionRule(r'string', r'"', StringGrammar2, r'"'),
RegionRule(r'string', r"'", StringGrammar1, r"'"),
2009-02-22 21:51:31 -05:00
RegionRule(r'ipython_input', r'^(?:>>>|-->)', PythonGrammar, '\n$'),
2008-05-26 23:57:09 -04:00
PatternRule(r'ipython_reserved', r'undef'),
]
class Ipython(Fundamental):
name = 'IPython'
2008-05-26 23:57:09 -04:00
grammar = IpythonGrammar()
colors = {
2008-05-26 23:57:09 -04:00
'ipython_input.start': ('red', 'default', 'bold'),
'ipython_reserved': ('magenta', 'default', 'bold'),
}
_bindings = {
'ipython-start': ('M-e',),
}
2008-05-26 23:57:09 -04:00
install = Ipython.install