|
|
@ -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'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|