do not break the editor if highlighter is malformed
This commit is contained in:
parent
4012a11208
commit
3da1f3f3ba
1 changed files with 5 additions and 6 deletions
|
|
@ -141,15 +141,14 @@ var Tokenizer = function(rules, flag) {
|
|||
if (rule.next) {
|
||||
currentState = rule.next;
|
||||
state = this.rules[currentState];
|
||||
if (!state) {
|
||||
window.console && console.error && console.error(currentState, "doesn't exist");
|
||||
currentState = "start";
|
||||
state = this.rules[currentState];
|
||||
}
|
||||
mapping = this.matchMappings[currentState];
|
||||
lastIndex = re.lastIndex;
|
||||
|
||||
re = this.regExps[currentState];
|
||||
|
||||
if (re === undefined) {
|
||||
throw new Error("You indicated a state of " + rule.next + " to go to, but it doesn't exist!");
|
||||
}
|
||||
|
||||
re.lastIndex = lastIndex;
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue