pmacs3/mode_console.py

22 lines
719 B
Python

import color, mode2
from lex2 import Grammar, PatternRule
class ConsoleGrammar(Grammar):
rules = [
PatternRule(name=r'mesg', pattern=r'^[A-Za-z].*$'),
PatternRule(name=r'input', pattern=r'^>>>.*$'),
PatternRule(name=r'input', pattern=r'^-->.*$'),
PatternRule(name=r'output', pattern=r'^ .*$'),
]
class Console(mode2.Fundamental):
grammar = ConsoleGrammar()
def __init__(self, w):
mode2.Fundamental.__init__(self, w)
self.colors = {
'mesg': color.build('blue', 'default'),
'input': color.build('cyan', 'default'),
'output': color.build('default', 'default'),
}
def name(self):
return "Console"