minor fix to xml tokenizer
This commit is contained in:
parent
7399cc94e3
commit
960d6abc34
3 changed files with 24 additions and 3 deletions
|
|
@ -14,7 +14,7 @@ ace.Tokenizer = function(rules) {
|
||||||
;
|
;
|
||||||
|
|
||||||
this.regExps[key] = new RegExp("(?:(" + ruleRegExps.join(")|(")
|
this.regExps[key] = new RegExp("(?:(" + ruleRegExps.join(")|(")
|
||||||
+ ")|(.))", "g");
|
+ ")|(.+))", "g");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,14 +19,14 @@ ace.mode.XmlHighlightRules = function() {
|
||||||
next : "comment"
|
next : "comment"
|
||||||
}, {
|
}, {
|
||||||
token : "text", // opening tag
|
token : "text", // opening tag
|
||||||
regex : "<",
|
regex : "<\\/?",
|
||||||
next : "tag"
|
next : "tag"
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "\\s+"
|
regex : "\\s+"
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : ".+"
|
regex : "[^<]+"
|
||||||
} ],
|
} ],
|
||||||
|
|
||||||
tag : [ {
|
tag : [ {
|
||||||
|
|
|
||||||
21
test/mode/XmlTokenizerTest.js
Normal file
21
test/mode/XmlTokenizerTest.js
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
var XmlTest = new TestCase("mode.XmlTest", {
|
||||||
|
|
||||||
|
setUp : function() {
|
||||||
|
this.tokenizer = new ace.mode.Xml().getTokenizer();
|
||||||
|
},
|
||||||
|
|
||||||
|
"test: tokenize1" : function() {
|
||||||
|
|
||||||
|
var line = "<Juhu>//Juhu Kinners</Kinners>";
|
||||||
|
var tokens = this.tokenizer.getLineTokens(line, "start").tokens;
|
||||||
|
|
||||||
|
assertEquals(7, tokens.length);
|
||||||
|
assertEquals("text", tokens[0].type);
|
||||||
|
assertEquals("keyword", tokens[1].type);
|
||||||
|
assertEquals("text", tokens[2].type);
|
||||||
|
assertEquals("text", tokens[3].type);
|
||||||
|
assertEquals("text", tokens[4].type);
|
||||||
|
assertEquals("keyword", tokens[5].type);
|
||||||
|
assertEquals("text", tokens[6].type);
|
||||||
|
}
|
||||||
|
});
|
||||||
Loading…
Add table
Add a link
Reference in a new issue