diff --git a/lib/compiler/passes/generate-javascript.js b/lib/compiler/passes/generate-javascript.js index 5d5c384..206ed15 100644 --- a/lib/compiler/passes/generate-javascript.js +++ b/lib/compiler/passes/generate-javascript.js @@ -836,10 +836,10 @@ module.exports = function(ast, options) { ' }', '', ' function peg$computePosDetails(pos) {', - ' function advance(details, pos) {', + ' function advance(details, startPos, endPos) {', ' var p, ch;', '', - ' for (p = 0; p < pos; p++) {', + ' for (p = startPos; p < endPos; p++) {', ' ch = input.charAt(p);', ' if (ch === "\\n") {', ' if (!details.seenCR) { details.line++; }', @@ -861,8 +861,8 @@ module.exports = function(ast, options) { ' peg$cachedPos = 0;', ' peg$cachedPosDetails = { line: 1, column: 1, seenCR: false };', ' }', + ' advance(peg$cachedPosDetails, peg$cachedPos, pos);', ' peg$cachedPos = pos;', - ' advance(peg$cachedPosDetails, peg$cachedPos);', ' }', '', ' return peg$cachedPosDetails;',