diff --git a/lib/compiler.js b/lib/compiler.js index 286df45e..15dc8254 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -68,9 +68,7 @@ path: noop, literal: noop, raw: noop, - comment: nullify, - line: nullify, - col: nullify + comment: nullify }; compiler.pragmas = { @@ -109,7 +107,7 @@ if (res[0] === 'buffer' || res[0] === 'format') { if (memo) { memo[0] = (res[0] === 'buffer') ? 'buffer' : memo[0]; - memo[1] += res.slice(1, -2).join(''); + memo[1] += res.slice(1).join(''); } else { memo = res; out.push(res); @@ -143,10 +141,10 @@ function format(context, node) { if(dust.config.whitespace) { - // Format nodes are in the form ['format', eol, whitespace, line, col], + // Format nodes are in the form ['format', eol, whitespace], // which is unlike other nodes in that there are two pieces of content // Join eol and whitespace together to normalize the node format - node.splice(1, 2, node.slice(1, -2).join('')); + node.splice(1, 2, node.slice(1).join('')); return node; } return null; diff --git a/lib/parser.js b/lib/parser.js index eaf418e1..3ca30d60 100644 --- a/lib/parser.js +++ b/lib/parser.js @@ -112,7 +112,7 @@ peg$c40 = { type: "other", description: "identifier" }, peg$c41 = function(p) { var arr = ["path"].concat(p); - arr.text = p[1].join('.').replace(/,line,\d+,col,\d+/g,''); + arr.text = p[1].join('.'); return arr; }, peg$c42 = function(k) { @@ -2719,7 +2719,8 @@ return parseInt(arr.join(''), 10); } function withPosition(arr) { - return arr.concat([['line', location().start.line], ['col', location().start.column]]); + arr.location = location(); + return arr; } diff --git a/src/dust.pegjs b/src/dust.pegjs index 1f877b7c..27781d44 100644 --- a/src/dust.pegjs +++ b/src/dust.pegjs @@ -3,7 +3,8 @@ return parseInt(arr.join(''), 10); } function withPosition(arr) { - return arr.concat([['line', location().start.line], ['col', location().start.column]]); + arr.location = location(); + return arr; } } @@ -126,7 +127,7 @@ identifier "identifier" = p:path { var arr = ["path"].concat(p); - arr.text = p[1].join('.').replace(/,line,\d+,col,\d+/g,''); + arr.text = p[1].join('.'); return arr; } / k:key