pmacs3/mode/console.py

32 lines
1.0 KiB
Python
Raw Normal View History

2007-10-21 20:55:29 -04:00
import color, mode
2007-10-21 20:52:48 -04:00
from lex import Grammar, PatternRule, RegionRule
2007-07-21 11:40:53 -04:00
from mode.python import StringGrammar
class ConsoleGrammar(Grammar):
rules = [
PatternRule(r'mesg', r'^[A-Za-z].*$'),
PatternRule(r'input', r'^>>>.*$'),
PatternRule(r'input', r'^-->.*$'),
#PatternRule(r'output', r'^ .*$'),
RegionRule(r'py_string', r'"', StringGrammar, r'"'),
RegionRule(r'py_string', r"'", StringGrammar, r"'"),
2007-07-21 11:40:53 -04:00
PatternRule(r'bareword', r'[a-zA-Z_][a-zA-Z0-9_]*'),
]
2007-10-21 20:55:29 -04:00
class Console(mode.Fundamental):
2007-10-18 17:07:35 -04:00
modename = 'Console'
2007-07-21 11:40:53 -04:00
grammar = ConsoleGrammar()
colors = {
'mesg': ('blue', 'default'),
'input': ('cyan', 'default'),
'output': ('default', 'default'),
'py_string.start': ('green', 'default'),
'py_string.octal': ('magenta', 'default'),
'py_string.escaped': ('magenta', 'default'),
'py_string.null': ('green', 'default'),
'py_string.end': ('green', 'default'),
2007-07-21 11:40:53 -04:00
}
2007-10-19 02:41:33 -04:00
install = Console.install