do not break the editor if highlighter is malformed

This commit is contained in:
nightwing 2012-12-28 20:20:37 +04:00
commit 3da1f3f3ba

View file

@ -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;