summaryrefslogtreecommitdiff
path: root/js/lib
diff options
context:
space:
mode:
Diffstat (limited to 'js/lib')
-rw-r--r--js/lib/blocks.js9
-rw-r--r--js/lib/node.js6
2 files changed, 7 insertions, 8 deletions
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;
diff --git a/js/lib/node.js b/js/lib/node.js
index da33b9e..dfc77ab 100644
--- a/js/lib/node.js
+++ b/js/lib/node.js
@@ -60,14 +60,14 @@ NodeWalker.prototype.next = function(){
return {entering: entering, node: cur};
};
-function Node(nodeType, pos) {
+function Node(nodeType, sourceloc) {
this.t = nodeType;
this.parent = null;
this.firstChild = null;
this.lastChild = null;
this.prev = null;
this.next = null;
- this.pos = pos || {};
+ this.sourceloc = sourceloc;
this.last_line_blank = false;
this.open = true;
this.strings = undefined;
@@ -167,7 +167,7 @@ Node.prototype.toAST = function() {
var cur;
var result = { t: this.t };
- var propsToShow = ['t', 'c', 'list_data', 'pos', 'info', 'level'];
+ var propsToShow = ['t', 'c', 'list_data', 'sourceloc', 'info', 'level'];
for (var i = 0; i < propsToShow.length; i++) {
var prop = propsToShow[i];