Multiple line commenting highlight fails when contains a single line comment.
fix #426
This commit is contained in:
parent
578aeb1241
commit
314b95eb78
2 changed files with 27 additions and 0 deletions
|
|
@ -161,6 +161,11 @@ var JavaScriptHighlightRules = function() {
|
||||||
// makes sure we don't mix up regexps with the divison operator
|
// makes sure we don't mix up regexps with the divison operator
|
||||||
"regex_allowed": [
|
"regex_allowed": [
|
||||||
{
|
{
|
||||||
|
token : "comment", // multi line comment
|
||||||
|
merge : true,
|
||||||
|
regex : "\\/\\*",
|
||||||
|
next : "comment_regex_allowed"
|
||||||
|
}, {
|
||||||
token : "comment",
|
token : "comment",
|
||||||
regex : "\\/\\/.*$"
|
regex : "\\/\\/.*$"
|
||||||
}, {
|
}, {
|
||||||
|
|
@ -180,10 +185,23 @@ var JavaScriptHighlightRules = function() {
|
||||||
next: "start"
|
next: "start"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"comment_regex_allowed" : [
|
||||||
|
{
|
||||||
|
token : "comment", // closing comment
|
||||||
|
regex : ".*?\\*\\/",
|
||||||
|
merge : true,
|
||||||
|
next : "regex_allowed"
|
||||||
|
}, {
|
||||||
|
token : "comment", // comment spanning whole line
|
||||||
|
merge : true,
|
||||||
|
regex : ".+"
|
||||||
|
}
|
||||||
|
],
|
||||||
"comment" : [
|
"comment" : [
|
||||||
{
|
{
|
||||||
token : "comment", // closing comment
|
token : "comment", // closing comment
|
||||||
regex : ".*?\\*\\/",
|
regex : ".*?\\*\\/",
|
||||||
|
merge : true,
|
||||||
next : "start"
|
next : "start"
|
||||||
}, {
|
}, {
|
||||||
token : "comment", // comment spanning whole line
|
token : "comment", // comment spanning whole line
|
||||||
|
|
|
||||||
|
|
@ -142,6 +142,15 @@ module.exports = {
|
||||||
assert.equal("string.regexp", tokens[2].type);
|
assert.equal("string.regexp", tokens[2].type);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"test tokenize multi-line comment containing a single line comment" : function() {
|
||||||
|
var tokens = this.tokenizer.getLineTokens("/* foo // bar */", "start").tokens;
|
||||||
|
assert.equal(1, tokens.length);
|
||||||
|
assert.equal("comment", tokens[0].type);
|
||||||
|
|
||||||
|
var tokens = this.tokenizer.getLineTokens("/* foo // bar */", "regex_allowed").tokens;
|
||||||
|
assert.equal(1, tokens.length);
|
||||||
|
assert.equal("comment", tokens[0].type);
|
||||||
|
},
|
||||||
|
|
||||||
"test tokenize identifier with umlauts": function() {
|
"test tokenize identifier with umlauts": function() {
|
||||||
var tokens = this.tokenizer.getLineTokens("füße", "start").tokens;
|
var tokens = this.tokenizer.getLineTokens("füße", "start").tokens;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue