From 05c60132f4ba80f5d62d99e7d0be27715ade06e5 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Fri, 9 Jan 2015 18:41:28 -0800 Subject: Replaced 'pos' with 'sourceloc', making it an array. This is a more compact representation. --- js/lib/blocks.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'js/lib/blocks.js') diff --git a/js/lib/blocks.js b/js/lib/blocks.js index f6e8f87..63eca24 100644 --- a/js/lib/blocks.js +++ b/js/lib/blocks.js @@ -136,8 +136,7 @@ var addChild = function(tag, line_number, offset) { } var column_number = offset + 1; // offset 0 = column 1 - var newBlock = new Node(tag, { start: [line_number, column_number], - end: [0, 0] }); + var newBlock = new Node(tag, [[line_number, column_number], [0, 0]]); newBlock.strings = []; newBlock.string_content = undefined; this.tip.appendChild(newBlock); @@ -483,7 +482,7 @@ var incorporateLine = function(ln, line_number) { container.t === 'FencedCode' || (container.t === 'ListItem' && !container.firstChild && - container.pos.start[0] === line_number)); + container.sourceloc[0][0] === line_number)); var cont = container; while (cont.parent) { @@ -549,7 +548,7 @@ var finalize = function(block, line_number) { return 0; } block.open = false; - block.pos.end = [line_number, this.lastLineLength + 1]; + block.sourceloc[1] = [line_number, this.lastLineLength + 1]; switch (block.t) { case 'Paragraph': @@ -639,7 +638,7 @@ var processInlines = function(block) { }; var Document = function() { - var doc = new Node('Document', { start: [1, 1], end: [0, 0] }); + var doc = new Node('Document', [[1, 1], [0, 0]]); doc.string_content = undefined; doc.strings = []; return doc; -- cgit v1.2.3