fix tokenizer check
This commit is contained in:
parent
d2d5fab86e
commit
554dafd1bf
1 changed files with 5 additions and 3 deletions
|
|
@ -74,6 +74,10 @@ var Tokenizer = function(rules) {
|
|||
var type = "text";
|
||||
var value = match[0];
|
||||
|
||||
if (re.lastIndex == lastIndex) {
|
||||
throw new Error("tokenizer error before line: '" + line + "'");
|
||||
}
|
||||
|
||||
for ( var i = 0; i < state.length; i++) {
|
||||
if (match[i + 1] !== undefined) {
|
||||
if (typeof state[i].token == "function") {
|
||||
|
|
@ -110,9 +114,7 @@ var Tokenizer = function(rules) {
|
|||
|
||||
if (lastIndex == line.length) {
|
||||
break;
|
||||
} else if (re.lastIndex == lastIndex) {
|
||||
throw new Error("tokenizer error");
|
||||
}
|
||||
}
|
||||
|
||||
lastIndex = re.lastIndex;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue