From 223bbbd9eaaff4f1b1c9e570b684c28b8a9396ac Mon Sep 17 00:00:00 2001 From: Fabian Jakobs Date: Mon, 25 Oct 2010 10:30:08 +0200 Subject: [PATCH] revert xml highlight rules --- src/ace/mode/XmlHighlightRules.js | 134 +++++++++++++++++++----------- 1 file changed, 87 insertions(+), 47 deletions(-) diff --git a/src/ace/mode/XmlHighlightRules.js b/src/ace/mode/XmlHighlightRules.js index e3274867..e0670ee7 100644 --- a/src/ace/mode/XmlHighlightRules.js +++ b/src/ace/mode/XmlHighlightRules.js @@ -1,47 +1,87 @@ - - - - - - - - - - - - - Open files at startup - - - - - - - - - OK - Cancel - Apply - - - - \ No newline at end of file +/** + * Ajax.org Code Editor (ACE) + * + * @copyright 2010, Ajax.org Services B.V. + * @license LGPLv3 + * @author Fabian Jakobs + */ +require.def("ace/mode/XmlHighlightRules", + [ + "ace/lib/oop", + "ace/mode/TextHighlightRules" + ], function(oop, TextHighlightRules) { + +var XmlHighlightRules = function() { + + // regexp must not have capturing parentheses + // regexps are ordered -> the first match is used + + this.$rules = { + start : [ { + token : "text", + regex : "<\\!\\[CDATA\\[", + next : "cdata" + }, { + token : "xml_pe", + regex : "<\\?.*?\\?>" + }, { + token : "comment", + regex : "<\\!--", + next : "comment" + }, { + token : "text", // opening tag + regex : "<\\/?", + next : "tag" + }, { + token : "text", + regex : "\\s+" + }, { + token : "text", + regex : "[^<]+" + } ], + + tag : [ { + token : "text", + regex : ">", + next : "start" + }, { + token : "keyword", + regex : "[-_a-zA-Z0-9:]+" + }, { + token : "text", + regex : "\\s+" + }, { + token : "string", + regex : '".*?"' + }, { + token : "string", + regex : "'.*?'" + } ], + + cdata : [ { + token : "text", + regex : "\\]\\]>", + next : "start" + }, { + token : "text", + regex : "\\s+" + }, { + token : "text", + regex : ".+" + } ], + + comment : [ { + token : "comment", + regex : ".*?-->", + next : "start" + }, { + token : "comment", + regex : ".+" + } ] + }; +}; + +oop.inherits(XmlHighlightRules, TextHighlightRules); + +return XmlHighlightRules; +}); \ No newline at end of file