Fix buggy position computation

Fixes GH-152.
redux
David Majda 12 years ago
parent 76cc5d55b4
commit 0df8989f7a

@ -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;',

Loading…
Cancel
Save