Fix bug on token iteration.

This commit is contained in:
William Candillon 2013-01-27 19:26:22 +01:00 committed by nightwing
commit 26345ebb31

View file

@ -222,7 +222,8 @@ exports.XQueryLexer = function() {
}
var token = h.tokens[0];
for(var k in Rules[currentState]) {
var rules = Rules[currentState];
for(var k = 0; k < rules.length; k++) {
var rule = Rules[currentState][k];
if((typeof(rule.name) === "function" && rule.name(token)) || rule.name === token.name) {
info = rule;
@ -244,7 +245,7 @@ exports.XQueryLexer = function() {
} catch(e) {
if(e instanceof tokenizer.ParseException) {
var index = 0;
for(var i in tokens) {
for(var i=0; i < tokens.length; i++) {
index += tokens[i].value.length;
}
tokens.push({ type: "text", value: line.substring(index) });