more mode and efficiency improvements
--HG-- branch : pmacs2
This commit is contained in:
parent
a0f0de1bc3
commit
0aaa84c894
|
@ -55,6 +55,7 @@ class Application(object):
|
|||
self.token_colors = {
|
||||
'comment': ('red', 'default', 'bold'),
|
||||
'comment.start': ('red', 'default', 'bold'),
|
||||
'comment.data': ('red', 'default', 'bold'),
|
||||
'comment.null': ('red', 'default', 'bold'),
|
||||
'comment.end': ('red', 'default', 'bold'),
|
||||
'continuation': ('red', 'default', 'bold'),
|
||||
|
|
|
@ -468,6 +468,7 @@ class Python(mode.Fundamental):
|
|||
'classname': ('green', 'default', 'bold'),
|
||||
'rawstring.start': ('green', 'default', 'bold'),
|
||||
'rawstring.data': ('green', 'default', 'bold'),
|
||||
'rawstring.null': ('green', 'default', 'bold'),
|
||||
'rawstring.escaped': ('magenta', 'default', 'bold'),
|
||||
'rawstring.end': ('green', 'default', 'bold'),
|
||||
'system_identifier': ('cyan', 'default', 'bold'),
|
||||
|
|
17
mode/xml.py
17
mode/xml.py
|
@ -2,9 +2,15 @@ import color, method, mode
|
|||
from lex import Grammar, PatternRule, RegionRule
|
||||
|
||||
class StringGrammar1(Grammar):
|
||||
rules = [PatternRule(r'data', r'[^"]+')]
|
||||
rules = [
|
||||
PatternRule(r'data', r'[^"&]+'),
|
||||
PatternRule(r'escaped', r'&[a-z]+;'),
|
||||
]
|
||||
class StringGrammar2(Grammar):
|
||||
rules = [PatternRule(r'data', r"[^']+")]
|
||||
rules = [
|
||||
PatternRule(r'data', r"[^'&]+"),
|
||||
PatternRule(r'escaped', r'&[a-z]+;'),
|
||||
]
|
||||
|
||||
class CommentGrammar(Grammar):
|
||||
rules = [PatternRule(r'data', r'(?:[^-]|-(?!-)|--(?!>))+')]
|
||||
|
@ -29,10 +35,10 @@ class XMLGrammar(Grammar):
|
|||
PatternRule(r'data', r'[^<& \n]+'),
|
||||
PatternRule(r'spaces', r' +'),
|
||||
RegionRule(r'comment', r'<!--', CommentGrammar, r'-->'),
|
||||
RegionRule(r'xml_tag', r'<', TagGrammar, r'/?>'),
|
||||
RegionRule(r'xml_tag', r'<(?!\?)', TagGrammar, r'/?>'),
|
||||
PatternRule(r'xml_entity', r'&[a-z]+;'),
|
||||
PatternRule(r'eol', r'\n'),
|
||||
RegionRule(r'metadata', r'<\?', MetadataGrammar, r'\?>'),
|
||||
RegionRule(r'xml_metadata', r'<\?', MetadataGrammar, r'\?>'),
|
||||
]
|
||||
|
||||
class XmlValidate(method.shell.Exec):
|
||||
|
@ -57,6 +63,9 @@ class XML(mode.Fundamental):
|
|||
extensions = ['.xml', '.xml.in', '.xsl', '.xsd']
|
||||
grammar = XMLGrammar
|
||||
colors = {
|
||||
'xml_metadata.start': ('magenta', 'default', 'bold'),
|
||||
'xml_metadata.data': ('magenta', 'default', 'bold'),
|
||||
'xml_metadata.end': ('magenta', 'default', 'bold'),
|
||||
'xml_tag.start': ('default', 'default', 'bold'),
|
||||
'xml_tag.namespace': ('magenta', 'default', 'bold'),
|
||||
'xml_tag.name': ('blue', 'default', 'bold'),
|
||||
|
|
Loading…
Reference in New Issue