32 lines
1018 B
Python
32 lines
1018 B
Python
import color, mode2
|
|
from lex import Grammar, PatternRule, RegionRule
|
|
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'string', r'"', StringGrammar, r'"'),
|
|
RegionRule(r'string', r"'", StringGrammar, r"'"),
|
|
PatternRule(r'bareword', r'[a-zA-Z_][a-zA-Z0-9_]*'),
|
|
]
|
|
class Console(mode2.Fundamental):
|
|
modename = 'Console'
|
|
grammar = ConsoleGrammar()
|
|
colors = {
|
|
'mesg': ('blue', 'default'),
|
|
'input': ('cyan', 'default'),
|
|
'output': ('default', 'default'),
|
|
|
|
'string.start': ('green', 'default'),
|
|
'string.octal': ('magenta', 'default'),
|
|
'string.escaped': ('magenta', 'default'),
|
|
'string.null': ('green', 'default'),
|
|
'string.end': ('green', 'default'),
|
|
}
|
|
|
|
install = Console.install
|