check for valid start state in tokenizer
This commit is contained in:
parent
d03e5d1120
commit
1704cbdcc2
1 changed files with 5 additions and 1 deletions
|
|
@ -222,6 +222,10 @@ var Tokenizer = function(rules) {
|
||||||
|
|
||||||
var currentState = startState || "start";
|
var currentState = startState || "start";
|
||||||
var state = this.states[currentState];
|
var state = this.states[currentState];
|
||||||
|
if (!state) {
|
||||||
|
currentState = "start";
|
||||||
|
state = this.states[currentState];
|
||||||
|
}
|
||||||
var mapping = this.matchMappings[currentState];
|
var mapping = this.matchMappings[currentState];
|
||||||
var re = this.regExps[currentState];
|
var re = this.regExps[currentState];
|
||||||
re.lastIndex = 0;
|
re.lastIndex = 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue