iperl colors

--HG--
branch : pmacs2
This commit is contained in:
moculus 2008-05-21 16:13:49 +00:00
parent 4ebce6cc42
commit ac9f413b46
1 changed files with 16 additions and 33 deletions

View File

@ -1,37 +1,20 @@
import color, mode
#from lex import Grammar, PatternRule, RegionRule
#from mode.python import StringGrammar, PythonGrammar
from lex import Grammar, PatternRule, RegionRule
from mode.perl import StringGrammar, PerlGrammar
#class ReprGrammar(Grammar):
# rules = [
# RegionRule(r'string', r'"', StringGrammar, r'"'),
# RegionRule(r'string', r"'", StringGrammar, r"'"),
# ]
#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"'"),
# #RegionRule(r'console_repr', r"<", ReprGrammar, r">"),
# PatternRule(r'console_reserved', r'True|False|None'),
# PatternRule(r'console_bareword', r'[a-zA-Z_][a-zA-Z0-9_]*'),
# ]
class Console(mode.Fundamental):
class IperlGrammar(Grammar):
rules = [
RegionRule(r'string', r'"', StringGrammar, r'"'),
RegionRule(r'string', r"'", StringGrammar, r"'"),
RegionRule(r'iperl_input', r'^(?:>>>|\.\.>)', PerlGrammar, '\n$'),
PatternRule(r'iperl_reserved', r'undef'),
]
class Iperl(mode.Fundamental):
modename = 'IPerl'
# grammar = ConsoleGrammar()
# colors = {
# 'console_mesg': ('magenta', 'default', 'bold'),
# 'console_input': ('cyan', 'default', 'bold'),
# 'console_reserved': ('magenta', 'default', 'bold'),
# 'console_bareword': ('default', 'default', 'bold'),
# 'console_repr.start': ('default', 'default', 'bold'),
# 'console_repr.null': ('blue', 'default', 'bold'),
# 'console_repr.string.start': ('cyan', 'default', 'bold'),
# 'console_repr.string.null': ('cyan', 'default', 'bold'),
# 'console_repr.string.end': ('cyan', 'default', 'bold'),
# 'console_repr.end': ('default', 'default', 'bold'),
# }
grammar = IperlGrammar()
colors = {
'iperl_input.start': ('red', 'default', 'bold'),
'iperl_reserved': ('magenta', 'default', 'bold'),
}
install = Console.install
install = Iperl.install