diff --git a/application.py b/application.py index 48ea08f..e294c3d 100755 --- a/application.py +++ b/application.py @@ -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'), diff --git a/mode/python.py b/mode/python.py index 0dd81fe..5519588 100644 --- a/mode/python.py +++ b/mode/python.py @@ -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'), diff --git a/mode/xml.py b/mode/xml.py index a9fcb29..f728d30 100644 --- a/mode/xml.py +++ b/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''), - 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'),