diff --git a/lib/ace/mode/xml_highlight_rules.js b/lib/ace/mode/xml_highlight_rules.js index 5bb1086b..91da0e70 100644 --- a/lib/ace/mode/xml_highlight_rules.js +++ b/lib/ace/mode/xml_highlight_rules.js @@ -35,6 +35,9 @@ var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var XmlHighlightRules = function(normalize) { + + var tagRegex = "[a-zA-Z][-_a-zA-Z0-9]*"; + this.$rules = { start : [ {token : "string.cdata.xml", regex : "<\\!\\[CDATA\\[", next : "cdata"}, @@ -44,7 +47,7 @@ var XmlHighlightRules = function(normalize) { }, { token : ["punctuation.instruction.xml", "keyword.instruction.xml"], - regex : "(<\\?)([-_a-zA-Z0-9]+)", next : "processing_instruction", + regex : "(<\\?)(" + tagRegex + ")", next : "processing_instruction", }, {token : "comment.xml", regex : "<\\!--", next : "comment"}, { @@ -60,7 +63,7 @@ var XmlHighlightRules = function(normalize) { xml_decl : [{ token : "entity.other.attribute-name.decl-attribute-name.xml", - regex : "(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+" + regex : "(?:" + tagRegex + ":)?" + tagRegex + "" }, { token : "keyword.operator.decl-attribute-equals.xml", regex : "=" @@ -96,7 +99,7 @@ var XmlHighlightRules = function(normalize) { next: "pop" }, { token : ["punctuation.markup-decl.xml", "keyword.markup-decl.xml"], - regex : "(<\\!)([-_a-zA-Z0-9]+)", + regex : "(<\\!)(" + tagRegex + ")", push : [{ token : "text", regex : "\\s+" @@ -132,7 +135,7 @@ var XmlHighlightRules = function(normalize) { tag : [{ token : ["meta.tag.punctuation.tag-open.xml", "meta.tag.punctuation.end-tag-open.xml", "meta.tag.tag-name.xml"], - regex : "(?:(<)|(", next : "start"} @@ -166,7 +169,7 @@ var XmlHighlightRules = function(normalize) { attributes: [{ token : "entity.other.attribute-name.xml", - regex : "(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+" + regex : "(?:" + tagRegex + ":)?" + tagRegex + "" }, { token : "keyword.operator.attribute-equals.xml", regex : "="