pmacs3/mode/console.py

23 lines
739 B
Python

import color, mode
from lex import Grammar, PatternRule, RegionRule
from mode.python import StringGrammar
class ConsoleGrammar(Grammar):
rules = [
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"'"),
PatternRule(r'bareword', r'[a-zA-Z_][a-zA-Z0-9_]*'),
]
class Console(mode.Fundamental):
modename = 'Console'
grammar = ConsoleGrammar()
colors = {
'console_mesg': ('blue', 'default', 'bold'),
'console_input': ('cyan', 'default', 'bold'),
}
install = Console.install