Rename |peg$cache| to |peg$resultsCache|

This change will make the results cache clearly distinguishable from the
position details cache (which I'll add in a minute).
redux
David Majda 9 years ago
parent eaca5f0acf
commit 29bb921994

@ -56,7 +56,7 @@ function generateJavascript(ast, options) {
if (options.cache) { if (options.cache) {
parts.push([ parts.push([
'var key = peg$currPos * ' + ast.rules.length + ' + ' + ruleIndexCode + ',', 'var key = peg$currPos * ' + ast.rules.length + ' + ' + ruleIndexCode + ',',
' cached = peg$cache[key];', ' cached = peg$resultsCache[key];',
'', '',
'if (cached) {', 'if (cached) {',
' peg$currPos = cached.nextPos;', ' peg$currPos = cached.nextPos;',
@ -99,7 +99,7 @@ function generateJavascript(ast, options) {
if (options.cache) { if (options.cache) {
parts.push([ parts.push([
'', '',
'peg$cache[key] = { nextPos: peg$currPos, result: ' + resultCode + ' };' 'peg$resultsCache[key] = { nextPos: peg$currPos, result: ' + resultCode + ' };'
].join('\n')); ].join('\n'));
} }
@ -897,7 +897,7 @@ function generateJavascript(ast, options) {
if (options.cache) { if (options.cache) {
parts.push([ parts.push([
' peg$cache = {},', ' peg$resultsCache = {},',
'' ''
].join('\n')); ].join('\n'));
} }

Loading…
Cancel
Save