in Ox.doc, fix item.line; in Ox.tokenize, make line and column start at 1, not 0
This commit is contained in:
parent
5204ef14b4
commit
948437b535
1 changed files with 4 additions and 5 deletions
|
@ -162,8 +162,7 @@ Ox.doc = (function() {
|
||||||
// main item
|
// main item
|
||||||
// include leading whitespace
|
// include leading whitespace
|
||||||
item.source = parseTokens(tokens[i]);
|
item.source = parseTokens(tokens[i]);
|
||||||
item.line = source.slice(0, item.source[0].offset)
|
item.line = item.source[0].line;
|
||||||
.split('\n').length;
|
|
||||||
items.push(item);
|
items.push(item);
|
||||||
} else {
|
} else {
|
||||||
// property of a function item
|
// property of a function item
|
||||||
|
@ -700,11 +699,11 @@ Ox.tokenize = (function() {
|
||||||
|
|
||||||
return function(source) {
|
return function(source) {
|
||||||
var char,
|
var char,
|
||||||
column = 0,
|
column = 1,
|
||||||
cursor = 0,
|
cursor = 0,
|
||||||
delimiter,
|
delimiter,
|
||||||
length = source.length,
|
length = source.length,
|
||||||
line = 0,
|
line = 1,
|
||||||
lines,
|
lines,
|
||||||
next,
|
next,
|
||||||
tokens = [],
|
tokens = [],
|
||||||
|
@ -763,7 +762,7 @@ Ox.tokenize = (function() {
|
||||||
column = lines[lines.length - 1].length;
|
column = lines[lines.length - 1].length;
|
||||||
line += lines.length - 1;
|
line += lines.length - 1;
|
||||||
} else if (type == 'linebreak') {
|
} else if (type == 'linebreak') {
|
||||||
column = 0;
|
column = 1;
|
||||||
line += value.length;
|
line += value.length;
|
||||||
} else {
|
} else {
|
||||||
column += value.length;
|
column += value.length;
|
||||||
|
|
Loading…
Reference in a new issue