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 type = "text";
|
||||||
var value = match[0];
|
var value = match[0];
|
||||||
|
|
||||||
|
if (re.lastIndex == lastIndex) {
|
||||||
|
throw new Error("tokenizer error before line: '" + line + "'");
|
||||||
|
}
|
||||||
|
|
||||||
for ( var i = 0; i < state.length; i++) {
|
for ( var i = 0; i < state.length; i++) {
|
||||||
if (match[i + 1] !== undefined) {
|
if (match[i + 1] !== undefined) {
|
||||||
if (typeof state[i].token == "function") {
|
if (typeof state[i].token == "function") {
|
||||||
|
|
@ -110,9 +114,7 @@ var Tokenizer = function(rules) {
|
||||||
|
|
||||||
if (lastIndex == line.length) {
|
if (lastIndex == line.length) {
|
||||||
break;
|
break;
|
||||||
} else if (re.lastIndex == lastIndex) {
|
}
|
||||||
throw new Error("tokenizer error");
|
|
||||||
}
|
|
||||||
|
|
||||||
lastIndex = re.lastIndex;
|
lastIndex = re.lastIndex;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue