diff --git a/lib/compiler.js b/lib/compiler.js index fcb7782..2931516 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -267,7 +267,7 @@ PEG.Grammar.Rule.prototype.compile = function() { " this._cache[${name|string}] = this._cache[${name|string}] || [];", " var cachedResult = this._cache[${name|string}][this._pos];", " if (cachedResult !== undefined) {", - " this._pos += cachedResult.length;", + " this._pos = cachedResult.nextPos;", " return cachedResult.result;", " }", " ", @@ -279,8 +279,8 @@ PEG.Grammar.Rule.prototype.compile = function() { " ${reportMatchFailureCode}", " ", " this._cache[${name|string}][pos] = {", - " length: this._pos - pos,", - " result: ${resultVar}", + " nextPos: this._pos,", + " result: ${resultVar}", " };", " return ${resultVar};", "};",