Merge pull request #579 from okonomiyaki3000/master

Don't let $tokenizeRows return empty array. Rename variable 'char' as 'chr'
This commit is contained in:
Fabian Jakobs 2011-12-16 00:12:35 -08:00
commit 3bd7b0a59a
2 changed files with 8 additions and 8 deletions

View file

@ -130,8 +130,8 @@ var BackgroundTokenizer = function(tokenizer, editor) {
}; };
this.$tokenizeRows = function(firstRow, lastRow) { this.$tokenizeRows = function(firstRow, lastRow) {
if (!this.doc) if (!this.doc || isNaN(firstRow) || isNaN(lastRow))
return []; return [{'state':'start','tokens':[]}];
var rows = []; var rows = [];

View file

@ -92,15 +92,15 @@ function BracketMatch() {
while (true) { while (true) {
while (valueIndex >= 0) { while (valueIndex >= 0) {
var char = value.charAt(valueIndex); var chr = value.charAt(valueIndex);
if (char == openBracket) { if (chr == openBracket) {
depth -= 1; depth -= 1;
if (depth == 0) { if (depth == 0) {
return {row: iterator.getCurrentTokenRow(), return {row: iterator.getCurrentTokenRow(),
column: valueIndex + iterator.getCurrentTokenColumn()}; column: valueIndex + iterator.getCurrentTokenColumn()};
} }
} }
else if (char == bracket) { else if (chr == bracket) {
depth += 1; depth += 1;
} }
valueIndex -= 1; valueIndex -= 1;
@ -146,15 +146,15 @@ function BracketMatch() {
var value = token.value; var value = token.value;
var valueLength = value.length; var valueLength = value.length;
while (valueIndex < valueLength) { while (valueIndex < valueLength) {
var char = value.charAt(valueIndex); var chr = value.charAt(valueIndex);
if (char == closingBracket) { if (chr == closingBracket) {
depth -= 1; depth -= 1;
if (depth == 0) { if (depth == 0) {
return {row: iterator.getCurrentTokenRow(), return {row: iterator.getCurrentTokenRow(),
column: valueIndex + iterator.getCurrentTokenColumn()}; column: valueIndex + iterator.getCurrentTokenColumn()};
} }
} }
else if (char == bracket) { else if (chr == bracket) {
depth += 1; depth += 1;
} }
valueIndex += 1; valueIndex += 1;