Fix bug with array iteration.

This commit is contained in:
William Candillon 2013-01-27 19:32:50 +01:00 committed by nightwing
commit f65d123dc8

View file

@ -266,18 +266,18 @@ exports.XQueryLexer = function() {
var diff = cachedLine.length - line.length;
var idx = 0;
var col = 0;
for(var i in tokens) {
for(var i = 0; i < tokens.length; i++) {
var token = tokens[i];
for(var j in this.tokens[row]) {
var semanticToken = this.tokens[row][j];
if(
((col + token.value.length) <= begin.length && semanticToken.sc === col && semanticToken.ec === (col + token.value.length)) ||
(semanticToken.sc === (col + diff) && semanticToken.ec === (col + token.value.length + diff))
) {
idx = i;
tokens[i].type = semanticToken.type;
}
for(var j = 0; j < this.tokens[row].length; j++) {
var semanticToken = this.tokens[row][j];
if(
((col + token.value.length) <= begin.length && semanticToken.sc === col && semanticToken.ec === (col + token.value.length)) ||
(semanticToken.sc === (col + diff) && semanticToken.ec === (col + token.value.length + diff))
) {
idx = i;
tokens[i].type = semanticToken.type;
}
}
col += token.value.length;
}
}