2007-07-13 08:26:29 -04:00
|
|
|
import color, mode2
|
2007-07-15 09:44:20 -04:00
|
|
|
from lex3 import Grammar, PatternRule, RegionRule
|
2007-07-14 10:21:22 -04:00
|
|
|
from mode_python import StringGrammar
|
2007-06-24 09:51:43 -04:00
|
|
|
|
|
|
|
class ConsoleGrammar(Grammar):
|
|
|
|
rules = [
|
2007-07-14 10:21:22 -04:00
|
|
|
PatternRule(r'mesg', r'^[A-Za-z].*$'),
|
|
|
|
PatternRule(r'input', r'^>>>.*$'),
|
|
|
|
PatternRule(r'input', r'^-->.*$'),
|
|
|
|
#PatternRule(r'output', r'^ .*$'),
|
|
|
|
|
|
|
|
RegionRule(r'string', r'"', StringGrammar, r'"'),
|
|
|
|
RegionRule(r'string', r"'", StringGrammar, r"'"),
|
|
|
|
PatternRule(r'bareword', r'[a-zA-Z_][a-zA-Z0-9_]*'),
|
2007-06-24 09:51:43 -04:00
|
|
|
]
|
|
|
|
class Console(mode2.Fundamental):
|
|
|
|
grammar = ConsoleGrammar()
|
2007-03-06 10:05:38 -05:00
|
|
|
def __init__(self, w):
|
2007-06-24 09:51:43 -04:00
|
|
|
mode2.Fundamental.__init__(self, w)
|
|
|
|
self.colors = {
|
|
|
|
'mesg': color.build('blue', 'default'),
|
|
|
|
'input': color.build('cyan', 'default'),
|
|
|
|
'output': color.build('default', 'default'),
|
2007-07-14 10:21:22 -04:00
|
|
|
|
|
|
|
'string.start': color.build('green', 'default'),
|
|
|
|
'string.octal': color.build('magenta', 'default'),
|
|
|
|
'string.escaped': color.build('magenta', 'default'),
|
|
|
|
'string.null': color.build('green', 'default'),
|
|
|
|
'string.end': color.build('green', 'default'),
|
2007-06-24 09:51:43 -04:00
|
|
|
}
|
2007-03-06 10:05:38 -05:00
|
|
|
def name(self):
|
|
|
|
return "Console"
|