fix #1241 PHP highlighting of closing tag in comment
This commit is contained in:
parent
c83f48b371
commit
6001ba815c
3 changed files with 25 additions and 20 deletions
|
|
@ -899,11 +899,7 @@ var PhpLangHighlightRules = function() {
|
|||
"start" : [
|
||||
{
|
||||
token : "comment",
|
||||
regex : "\\/\\/.*$"
|
||||
},
|
||||
{
|
||||
token : "comment",
|
||||
regex : "#.*$"
|
||||
regex : /(?:#|\/\/)(?:[^?]|\?[^>])*/
|
||||
},
|
||||
docComment.getStartRule("doc-start"),
|
||||
{
|
||||
|
|
@ -1059,7 +1055,7 @@ var PhpHighlightRules = function() {
|
|||
this.$rules[i].unshift({
|
||||
token : "support.php_tag", // php open tag
|
||||
regex : "<\\?(?:php|=)?",
|
||||
next : {push: "php-start"}
|
||||
push : "php-start"
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -124,22 +124,27 @@ var TextHighlightRules = function() {
|
|||
}, {
|
||||
token: rule.token + ".end",
|
||||
regex: rule.end || rule.start,
|
||||
next: key
|
||||
next: "pop"
|
||||
});
|
||||
rule.token = rule.token + ".start";
|
||||
rule.push = true;
|
||||
}
|
||||
if (rule.next && Array.isArray(rule.next)) {
|
||||
var next = rule.next || rule.push;
|
||||
if (next && Array.isArray(next)) {
|
||||
var stateName = rule.stateName || (rule.token + id++);
|
||||
rules[stateName] = rule.next;
|
||||
rules[stateName] = next;
|
||||
rule.next = stateName;
|
||||
processState(stateName);
|
||||
} else if (rule.next && typeof rule.next == "object") {
|
||||
var next = rule.next;
|
||||
rule.nextState = next.push;
|
||||
rule.next = pushState;
|
||||
} else if (rule.next == "pop") {
|
||||
} else if (next == "pop") {
|
||||
rule.next = popState;
|
||||
}
|
||||
|
||||
if (rule.push) {
|
||||
rule.nextState = rule.next || rule.push;
|
||||
rule.next = pushState;
|
||||
delete rule.push;
|
||||
}
|
||||
|
||||
if (rule.rules) {
|
||||
for (var r in rule.rules) {
|
||||
if (rules[r]) {
|
||||
|
|
|
|||
|
|
@ -208,7 +208,11 @@ var Tokenizer = function(rules) {
|
|||
: rule.token;
|
||||
|
||||
if (rule.next) {
|
||||
currentState = rule.next;
|
||||
if (typeof rule.next == "string")
|
||||
currentState = rule.next;
|
||||
else
|
||||
currentState = rule.next(currentState, stack);
|
||||
|
||||
state = this.states[currentState];
|
||||
if (!state) {
|
||||
window.console && console.error && console.error(currentState, "doesn't exist");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue