in Ox.doc, fix item.line; in Ox.tokenize, make line and column start at 1, not 0

This commit is contained in:
rolux 2012-05-27 21:53:02 +02:00
parent 5204ef14b4
commit 948437b535

View file

@ -162,8 +162,7 @@ Ox.doc = (function() {
// main item
// include leading whitespace
item.source = parseTokens(tokens[i]);
item.line = source.slice(0, item.source[0].offset)
.split('\n').length;
item.line = item.source[0].line;
items.push(item);
} else {
// property of a function item
@ -700,11 +699,11 @@ Ox.tokenize = (function() {
return function(source) {
var char,
column = 0,
column = 1,
cursor = 0,
delimiter,
length = source.length,
line = 0,
line = 1,
lines,
next,
tokens = [],
@ -763,7 +762,7 @@ Ox.tokenize = (function() {
column = lines[lines.length - 1].length;
line += lines.length - 1;
} else if (type == 'linebreak') {
column = 0;
column = 1;
line += value.length;
} else {
column += value.length;