pmacs3/mode/console.py

32 lines
1016 B
Python
Raw Normal View History

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 = [
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-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 = {
'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'),
}
2007-10-19 02:41:33 -04:00
install = Console.install