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-07-18 07:22:12 -04:00
|
|
|
colors = {
|
|
|
|
'mesg': ('blue', 'default'),
|
|
|
|
'input': ('cyan', 'default'),
|
|
|
|
'output': ('default', 'default'),
|
2007-07-14 10:21:22 -04:00
|
|
|
|
2007-07-18 07:22:12 -04:00
|
|
|
'string.start': ('green', 'default'),
|
|
|
|
'string.octal': ('magenta', 'default'),
|
|
|
|
'string.escaped': ('magenta', 'default'),
|
|
|
|
'string.null': ('green', 'default'),
|
|
|
|
'string.end': ('green', 'default'),
|
|
|
|
}
|
2007-03-06 10:05:38 -05:00
|
|
|
def name(self):
|
|
|
|
return "Console"
|