From f65d123dc8cdc025db25e759201c59d93622a43b Mon Sep 17 00:00:00 2001 From: William Candillon Date: Sun, 27 Jan 2013 19:32:50 +0100 Subject: [PATCH] Fix bug with array iteration. --- lib/ace/mode/xquery/XQueryLexer.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/ace/mode/xquery/XQueryLexer.js b/lib/ace/mode/xquery/XQueryLexer.js index 461e35e5..2a9ea060 100644 --- a/lib/ace/mode/xquery/XQueryLexer.js +++ b/lib/ace/mode/xquery/XQueryLexer.js @@ -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; } }