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 = [
|
2008-03-16 11:39:17 -04:00
|
|
|
PatternRule(r'console_mesg', r'^[A-Za-z].*$'),
|
|
|
|
PatternRule(r'console_input', r'^>>>.*$'),
|
|
|
|
PatternRule(r'console_input', r'^-->.*$'),
|
|
|
|
RegionRule(r'string', r'"', StringGrammar, r'"'),
|
|
|
|
RegionRule(r'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 = {
|
2008-03-16 11:39:17 -04:00
|
|
|
'console_mesg': ('blue', 'default'),
|
|
|
|
'console_input': ('cyan', 'default'),
|
2007-07-21 11:40:53 -04:00
|
|
|
}
|
2007-10-19 02:41:33 -04:00
|
|
|
|
|
|
|
install = Console.install
|