From 9a612cd2e56e567936cdb1993267882563dd4a59 Mon Sep 17 00:00:00 2001 From: Fabian Jakobs Date: Thu, 1 Dec 2011 12:48:28 +0100 Subject: [PATCH] align xml mode with html mode --- lib/ace/mode/xml_highlight_rules.js | 32 ++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/lib/ace/mode/xml_highlight_rules.js b/lib/ace/mode/xml_highlight_rules.js index cc310c76..a9b87b52 100644 --- a/lib/ace/mode/xml_highlight_rules.js +++ b/lib/ace/mode/xml_highlight_rules.js @@ -59,8 +59,9 @@ var XmlHighlightRules = function() { regex : "<\\!--", next : "comment" }, { - token : "text", // opening tag + token : "meta.tag", // opening tag regex : "<\\/?", + merge : true, next : "tag" }, { token : "text", @@ -71,12 +72,33 @@ var XmlHighlightRules = function() { }], tag : [{ - token : "text", + token : "meta.tag", + merge : true, + regex : "\\s+" + }, { + token : "meta.tag", + regex : "[-_a-zA-Z0-9:]+", + merge : true, + next : "attribute-list" + }, { + token: "empty", + regex: "", + next : name + "attribute-list" + }], + + "attribute-list": [{ + token : "meta.tag", regex : ">", next : "start" }, { - token : "keyword", + token : "meta.tag", + regex : "=" + }, { + token : "entity.other.attribute-name", regex : "[-_a-zA-Z0-9:]+" + }, { + token : "constant.numeric", // float + regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" }, { token : "text", regex : "\\s+" @@ -101,7 +123,7 @@ var XmlHighlightRules = function() { qstring: [{ token : "string", regex : ".*?'", - next : "tag" + next : "attribute-list" }, { token : "string", merge : true, @@ -111,7 +133,7 @@ var XmlHighlightRules = function() { qqstring: [{ token : "string", regex : ".*?\"", - next : "tag" + next : "attribute-list" }, { token : "string", merge : true,