diff --git a/grammars/xml.cson b/grammars/xml.cson
index d484a36..30f45b9 100644
--- a/grammars/xml.cson
+++ b/grammars/xml.cson
@@ -397,9 +397,29 @@
}
]
'comments':
- 'begin': '<[!%]--'
- 'captures':
- '0':
- 'name': 'punctuation.definition.comment.xml'
- 'end': '--%?>'
- 'name': 'comment.block.xml'
+ 'patterns': [
+ {
+ 'begin': '<%--'
+ 'captures':
+ '0':
+ 'name': 'punctuation.definition.comment.xml'
+ 'end': '--%>'
+ 'name': 'comment.block.xml'
+ }
+ {
+ 'begin': ''
+ 'name': 'comment.block.xml'
+ 'patterns': [
+ {
+ 'begin': '--(?!>)'
+ 'captures':
+ '0':
+ 'name': 'invalid.illegal.bad-comments-or-CDATA.xml'
+ }
+ ]
+ }
+ ]
diff --git a/spec/xml-spec.coffee b/spec/xml-spec.coffee
index c7055fc..6320738 100644
--- a/spec/xml-spec.coffee
+++ b/spec/xml-spec.coffee
@@ -25,6 +25,19 @@ describe "XML grammar", ->
expect(lines[2][1]).toEqual value: '')
+ expect(tokens[0]).toEqual value: '')
+ expect(tokens[0]).toEqual value: '', scopes: ['text.xml', 'comment.block.xml']
+
it "tokenizes empty element meta.tag.no-content.xml", ->
{tokens} = grammar.tokenizeLine('')
expect(tokens[0]).toEqual value: '<', scopes: ['text.xml', 'meta.tag.no-content.xml', 'punctuation.definition.tag.xml']
@@ -41,7 +54,7 @@ describe "XML grammar", ->
"""
expect(linesWithIndent[1][1]).toEqual value: 'attrName', scopes: ['text.xml', 'meta.tag.xml', 'entity.other.attribute-name.localname.xml']
-
+
linesWithoutIndent = grammar.tokenizeLines """