From 3f85a9ca8479cb6eef3c7929a4702b0834d99498 Mon Sep 17 00:00:00 2001 From: David Majda Date: Sun, 11 Apr 2010 17:02:53 +0200 Subject: [PATCH] Regenerated the metaparser with one-level rule cache. --- lib/metagrammar.js | 312 ++++++++++++++++++++++----------------------- 1 file changed, 156 insertions(+), 156 deletions(-) diff --git a/lib/metagrammar.js b/lib/metagrammar.js index fe4a680..c042a1a 100644 --- a/lib/metagrammar.js +++ b/lib/metagrammar.js @@ -2,8 +2,8 @@ PEG.grammarParser = (function(){ var result = new PEG.Parser("grammar"); result._parse_grammar = function(context) { - this._cache["grammar"] = this._cache["grammar"] || []; - var cachedResult = this._cache["grammar"][this._pos]; + var cacheKey = "grammar" + '@' + this._pos; + var cachedResult = this._cache[cacheKey]; if (cachedResult !== undefined) { this._pos = cachedResult.nextPos; return cachedResult.result; @@ -61,7 +61,7 @@ PEG.grammarParser = (function(){ - this._cache["grammar"][pos] = { + this._cache[cacheKey] = { nextPos: this._pos, result: result0 }; @@ -69,8 +69,8 @@ PEG.grammarParser = (function(){ }; result._parse_rule = function(context) { - this._cache["rule"] = this._cache["rule"] || []; - var cachedResult = this._cache["rule"][this._pos]; + var cacheKey = "rule" + '@' + this._pos; + var cachedResult = this._cache[cacheKey]; if (cachedResult !== undefined) { this._pos = cachedResult.nextPos; return cachedResult.result; @@ -131,7 +131,7 @@ PEG.grammarParser = (function(){ - this._cache["rule"][pos] = { + this._cache[cacheKey] = { nextPos: this._pos, result: result8 }; @@ -139,8 +139,8 @@ PEG.grammarParser = (function(){ }; result._parse_expression = function(context) { - this._cache["expression"] = this._cache["expression"] || []; - var cachedResult = this._cache["expression"][this._pos]; + var cacheKey = "expression" + '@' + this._pos; + var cachedResult = this._cache[cacheKey]; if (cachedResult !== undefined) { this._pos = cachedResult.nextPos; return cachedResult.result; @@ -153,7 +153,7 @@ PEG.grammarParser = (function(){ - this._cache["expression"][pos] = { + this._cache[cacheKey] = { nextPos: this._pos, result: result16 }; @@ -161,8 +161,8 @@ PEG.grammarParser = (function(){ }; result._parse_choice = function(context) { - this._cache["choice"] = this._cache["choice"] || []; - var cachedResult = this._cache["choice"][this._pos]; + var cacheKey = "choice" + '@' + this._pos; + var cachedResult = this._cache[cacheKey]; if (cachedResult !== undefined) { this._pos = cachedResult.nextPos; return cachedResult.result; @@ -229,7 +229,7 @@ PEG.grammarParser = (function(){ - this._cache["choice"][pos] = { + this._cache[cacheKey] = { nextPos: this._pos, result: result17 }; @@ -237,8 +237,8 @@ PEG.grammarParser = (function(){ }; result._parse_sequence = function(context) { - this._cache["sequence"] = this._cache["sequence"] || []; - var cachedResult = this._cache["sequence"][this._pos]; + var cacheKey = "sequence" + '@' + this._pos; + var cachedResult = this._cache[cacheKey]; if (cachedResult !== undefined) { this._pos = cachedResult.nextPos; return cachedResult.result; @@ -295,7 +295,7 @@ PEG.grammarParser = (function(){ - this._cache["sequence"][pos] = { + this._cache[cacheKey] = { nextPos: this._pos, result: result24 }; @@ -303,8 +303,8 @@ PEG.grammarParser = (function(){ }; result._parse_prefixed = function(context) { - this._cache["prefixed"] = this._cache["prefixed"] || []; - var cachedResult = this._cache["prefixed"][this._pos]; + var cacheKey = "prefixed" + '@' + this._pos; + var cachedResult = this._cache[cacheKey]; if (cachedResult !== undefined) { this._pos = cachedResult.nextPos; return cachedResult.result; @@ -366,7 +366,7 @@ PEG.grammarParser = (function(){ - this._cache["prefixed"][pos] = { + this._cache[cacheKey] = { nextPos: this._pos, result: result33 }; @@ -374,8 +374,8 @@ PEG.grammarParser = (function(){ }; result._parse_suffixed = function(context) { - this._cache["suffixed"] = this._cache["suffixed"] || []; - var cachedResult = this._cache["suffixed"][this._pos]; + var cacheKey = "suffixed" + '@' + this._pos; + var cachedResult = this._cache[cacheKey]; if (cachedResult !== undefined) { this._pos = cachedResult.nextPos; return cachedResult.result; @@ -463,7 +463,7 @@ PEG.grammarParser = (function(){ - this._cache["suffixed"][pos] = { + this._cache[cacheKey] = { nextPos: this._pos, result: result43 }; @@ -471,8 +471,8 @@ PEG.grammarParser = (function(){ }; result._parse_primary = function(context) { - this._cache["primary"] = this._cache["primary"] || []; - var cachedResult = this._cache["primary"][this._pos]; + var cacheKey = "primary" + '@' + this._pos; + var cachedResult = this._cache[cacheKey]; if (cachedResult !== undefined) { this._pos = cachedResult.nextPos; return cachedResult.result; @@ -598,7 +598,7 @@ PEG.grammarParser = (function(){ - this._cache["primary"][pos] = { + this._cache[cacheKey] = { nextPos: this._pos, result: result57 }; @@ -606,8 +606,8 @@ PEG.grammarParser = (function(){ }; result._parse_action = function(context) { - this._cache["action"] = this._cache["action"] || []; - var cachedResult = this._cache["action"][this._pos]; + var cacheKey = "action" + '@' + this._pos; + var cachedResult = this._cache[cacheKey]; if (cachedResult !== undefined) { this._pos = cachedResult.nextPos; return cachedResult.result; @@ -639,7 +639,7 @@ PEG.grammarParser = (function(){ this._matchFailed("action"); } - this._cache["action"][pos] = { + this._cache[cacheKey] = { nextPos: this._pos, result: result78 }; @@ -647,8 +647,8 @@ PEG.grammarParser = (function(){ }; result._parse_braced = function(context) { - this._cache["braced"] = this._cache["braced"] || []; - var cachedResult = this._cache["braced"][this._pos]; + var cacheKey = "braced" + '@' + this._pos; + var cachedResult = this._cache[cacheKey]; if (cachedResult !== undefined) { this._pos = cachedResult.nextPos; return cachedResult.result; @@ -724,7 +724,7 @@ PEG.grammarParser = (function(){ - this._cache["braced"][pos] = { + this._cache[cacheKey] = { nextPos: this._pos, result: result82 }; @@ -732,8 +732,8 @@ PEG.grammarParser = (function(){ }; result._parse_nonBraceCharacters = function(context) { - this._cache["nonBraceCharacters"] = this._cache["nonBraceCharacters"] || []; - var cachedResult = this._cache["nonBraceCharacters"][this._pos]; + var cacheKey = "nonBraceCharacters" + '@' + this._pos; + var cachedResult = this._cache[cacheKey]; if (cachedResult !== undefined) { this._pos = cachedResult.nextPos; return cachedResult.result; @@ -774,7 +774,7 @@ PEG.grammarParser = (function(){ - this._cache["nonBraceCharacters"][pos] = { + this._cache[cacheKey] = { nextPos: this._pos, result: result90 }; @@ -782,8 +782,8 @@ PEG.grammarParser = (function(){ }; result._parse_nonBraceCharacter = function(context) { - this._cache["nonBraceCharacter"] = this._cache["nonBraceCharacter"] || []; - var cachedResult = this._cache["nonBraceCharacter"][this._pos]; + var cacheKey = "nonBraceCharacter" + '@' + this._pos; + var cachedResult = this._cache[cacheKey]; if (cachedResult !== undefined) { this._pos = cachedResult.nextPos; return cachedResult.result; @@ -807,7 +807,7 @@ PEG.grammarParser = (function(){ - this._cache["nonBraceCharacter"][pos] = { + this._cache[cacheKey] = { nextPos: this._pos, result: result96 }; @@ -815,8 +815,8 @@ PEG.grammarParser = (function(){ }; result._parse_colon = function(context) { - this._cache["colon"] = this._cache["colon"] || []; - var cachedResult = this._cache["colon"][this._pos]; + var cacheKey = "colon" + '@' + this._pos; + var cachedResult = this._cache[cacheKey]; if (cachedResult !== undefined) { this._pos = cachedResult.nextPos; return cachedResult.result; @@ -853,7 +853,7 @@ PEG.grammarParser = (function(){ - this._cache["colon"][pos] = { + this._cache[cacheKey] = { nextPos: this._pos, result: result98 }; @@ -861,8 +861,8 @@ PEG.grammarParser = (function(){ }; result._parse_slash = function(context) { - this._cache["slash"] = this._cache["slash"] || []; - var cachedResult = this._cache["slash"][this._pos]; + var cacheKey = "slash" + '@' + this._pos; + var cachedResult = this._cache[cacheKey]; if (cachedResult !== undefined) { this._pos = cachedResult.nextPos; return cachedResult.result; @@ -899,7 +899,7 @@ PEG.grammarParser = (function(){ - this._cache["slash"][pos] = { + this._cache[cacheKey] = { nextPos: this._pos, result: result102 }; @@ -907,8 +907,8 @@ PEG.grammarParser = (function(){ }; result._parse_and = function(context) { - this._cache["and"] = this._cache["and"] || []; - var cachedResult = this._cache["and"][this._pos]; + var cacheKey = "and" + '@' + this._pos; + var cachedResult = this._cache[cacheKey]; if (cachedResult !== undefined) { this._pos = cachedResult.nextPos; return cachedResult.result; @@ -945,7 +945,7 @@ PEG.grammarParser = (function(){ - this._cache["and"][pos] = { + this._cache[cacheKey] = { nextPos: this._pos, result: result106 }; @@ -953,8 +953,8 @@ PEG.grammarParser = (function(){ }; result._parse_not = function(context) { - this._cache["not"] = this._cache["not"] || []; - var cachedResult = this._cache["not"][this._pos]; + var cacheKey = "not" + '@' + this._pos; + var cachedResult = this._cache[cacheKey]; if (cachedResult !== undefined) { this._pos = cachedResult.nextPos; return cachedResult.result; @@ -991,7 +991,7 @@ PEG.grammarParser = (function(){ - this._cache["not"][pos] = { + this._cache[cacheKey] = { nextPos: this._pos, result: result110 }; @@ -999,8 +999,8 @@ PEG.grammarParser = (function(){ }; result._parse_question = function(context) { - this._cache["question"] = this._cache["question"] || []; - var cachedResult = this._cache["question"][this._pos]; + var cacheKey = "question" + '@' + this._pos; + var cachedResult = this._cache[cacheKey]; if (cachedResult !== undefined) { this._pos = cachedResult.nextPos; return cachedResult.result; @@ -1037,7 +1037,7 @@ PEG.grammarParser = (function(){ - this._cache["question"][pos] = { + this._cache[cacheKey] = { nextPos: this._pos, result: result114 }; @@ -1045,8 +1045,8 @@ PEG.grammarParser = (function(){ }; result._parse_star = function(context) { - this._cache["star"] = this._cache["star"] || []; - var cachedResult = this._cache["star"][this._pos]; + var cacheKey = "star" + '@' + this._pos; + var cachedResult = this._cache[cacheKey]; if (cachedResult !== undefined) { this._pos = cachedResult.nextPos; return cachedResult.result; @@ -1083,7 +1083,7 @@ PEG.grammarParser = (function(){ - this._cache["star"][pos] = { + this._cache[cacheKey] = { nextPos: this._pos, result: result118 }; @@ -1091,8 +1091,8 @@ PEG.grammarParser = (function(){ }; result._parse_plus = function(context) { - this._cache["plus"] = this._cache["plus"] || []; - var cachedResult = this._cache["plus"][this._pos]; + var cacheKey = "plus" + '@' + this._pos; + var cachedResult = this._cache[cacheKey]; if (cachedResult !== undefined) { this._pos = cachedResult.nextPos; return cachedResult.result; @@ -1129,7 +1129,7 @@ PEG.grammarParser = (function(){ - this._cache["plus"][pos] = { + this._cache[cacheKey] = { nextPos: this._pos, result: result122 }; @@ -1137,8 +1137,8 @@ PEG.grammarParser = (function(){ }; result._parse_lparen = function(context) { - this._cache["lparen"] = this._cache["lparen"] || []; - var cachedResult = this._cache["lparen"][this._pos]; + var cacheKey = "lparen" + '@' + this._pos; + var cachedResult = this._cache[cacheKey]; if (cachedResult !== undefined) { this._pos = cachedResult.nextPos; return cachedResult.result; @@ -1175,7 +1175,7 @@ PEG.grammarParser = (function(){ - this._cache["lparen"][pos] = { + this._cache[cacheKey] = { nextPos: this._pos, result: result126 }; @@ -1183,8 +1183,8 @@ PEG.grammarParser = (function(){ }; result._parse_rparen = function(context) { - this._cache["rparen"] = this._cache["rparen"] || []; - var cachedResult = this._cache["rparen"][this._pos]; + var cacheKey = "rparen" + '@' + this._pos; + var cachedResult = this._cache[cacheKey]; if (cachedResult !== undefined) { this._pos = cachedResult.nextPos; return cachedResult.result; @@ -1221,7 +1221,7 @@ PEG.grammarParser = (function(){ - this._cache["rparen"][pos] = { + this._cache[cacheKey] = { nextPos: this._pos, result: result130 }; @@ -1229,8 +1229,8 @@ PEG.grammarParser = (function(){ }; result._parse_dot = function(context) { - this._cache["dot"] = this._cache["dot"] || []; - var cachedResult = this._cache["dot"][this._pos]; + var cacheKey = "dot" + '@' + this._pos; + var cachedResult = this._cache[cacheKey]; if (cachedResult !== undefined) { this._pos = cachedResult.nextPos; return cachedResult.result; @@ -1267,7 +1267,7 @@ PEG.grammarParser = (function(){ - this._cache["dot"][pos] = { + this._cache[cacheKey] = { nextPos: this._pos, result: result134 }; @@ -1275,8 +1275,8 @@ PEG.grammarParser = (function(){ }; result._parse_identifier = function(context) { - this._cache["identifier"] = this._cache["identifier"] || []; - var cachedResult = this._cache["identifier"][this._pos]; + var cacheKey = "identifier" + '@' + this._pos; + var cachedResult = this._cache[cacheKey]; if (cachedResult !== undefined) { this._pos = cachedResult.nextPos; return cachedResult.result; @@ -1424,7 +1424,7 @@ PEG.grammarParser = (function(){ this._matchFailed("identifier"); } - this._cache["identifier"][pos] = { + this._cache[cacheKey] = { nextPos: this._pos, result: result138 }; @@ -1432,8 +1432,8 @@ PEG.grammarParser = (function(){ }; result._parse_literal = function(context) { - this._cache["literal"] = this._cache["literal"] || []; - var cachedResult = this._cache["literal"][this._pos]; + var cacheKey = "literal" + '@' + this._pos; + var cachedResult = this._cache[cacheKey]; if (cachedResult !== undefined) { this._pos = cachedResult.nextPos; return cachedResult.result; @@ -1475,7 +1475,7 @@ PEG.grammarParser = (function(){ this._matchFailed("literal"); } - this._cache["literal"][pos] = { + this._cache[cacheKey] = { nextPos: this._pos, result: result151 }; @@ -1483,8 +1483,8 @@ PEG.grammarParser = (function(){ }; result._parse_doubleQuotedLiteral = function(context) { - this._cache["doubleQuotedLiteral"] = this._cache["doubleQuotedLiteral"] || []; - var cachedResult = this._cache["doubleQuotedLiteral"][this._pos]; + var cacheKey = "doubleQuotedLiteral" + '@' + this._pos; + var cachedResult = this._cache[cacheKey]; if (cachedResult !== undefined) { this._pos = cachedResult.nextPos; return cachedResult.result; @@ -1540,7 +1540,7 @@ PEG.grammarParser = (function(){ - this._cache["doubleQuotedLiteral"][pos] = { + this._cache[cacheKey] = { nextPos: this._pos, result: result157 }; @@ -1548,8 +1548,8 @@ PEG.grammarParser = (function(){ }; result._parse_doubleQuotedCharacter = function(context) { - this._cache["doubleQuotedCharacter"] = this._cache["doubleQuotedCharacter"] || []; - var cachedResult = this._cache["doubleQuotedCharacter"][this._pos]; + var cacheKey = "doubleQuotedCharacter" + '@' + this._pos; + var cachedResult = this._cache[cacheKey]; if (cachedResult !== undefined) { this._pos = cachedResult.nextPos; return cachedResult.result; @@ -1592,7 +1592,7 @@ PEG.grammarParser = (function(){ - this._cache["doubleQuotedCharacter"][pos] = { + this._cache[cacheKey] = { nextPos: this._pos, result: result163 }; @@ -1600,8 +1600,8 @@ PEG.grammarParser = (function(){ }; result._parse_simpleDoubleQuotedCharacter = function(context) { - this._cache["simpleDoubleQuotedCharacter"] = this._cache["simpleDoubleQuotedCharacter"] || []; - var cachedResult = this._cache["simpleDoubleQuotedCharacter"][this._pos]; + var cacheKey = "simpleDoubleQuotedCharacter" + '@' + this._pos; + var cachedResult = this._cache[cacheKey]; if (cachedResult !== undefined) { this._pos = cachedResult.nextPos; return cachedResult.result; @@ -1679,7 +1679,7 @@ PEG.grammarParser = (function(){ - this._cache["simpleDoubleQuotedCharacter"][pos] = { + this._cache[cacheKey] = { nextPos: this._pos, result: result170 }; @@ -1687,8 +1687,8 @@ PEG.grammarParser = (function(){ }; result._parse_singleQuotedLiteral = function(context) { - this._cache["singleQuotedLiteral"] = this._cache["singleQuotedLiteral"] || []; - var cachedResult = this._cache["singleQuotedLiteral"][this._pos]; + var cacheKey = "singleQuotedLiteral" + '@' + this._pos; + var cachedResult = this._cache[cacheKey]; if (cachedResult !== undefined) { this._pos = cachedResult.nextPos; return cachedResult.result; @@ -1744,7 +1744,7 @@ PEG.grammarParser = (function(){ - this._cache["singleQuotedLiteral"][pos] = { + this._cache[cacheKey] = { nextPos: this._pos, result: result178 }; @@ -1752,8 +1752,8 @@ PEG.grammarParser = (function(){ }; result._parse_singleQuotedCharacter = function(context) { - this._cache["singleQuotedCharacter"] = this._cache["singleQuotedCharacter"] || []; - var cachedResult = this._cache["singleQuotedCharacter"][this._pos]; + var cacheKey = "singleQuotedCharacter" + '@' + this._pos; + var cachedResult = this._cache[cacheKey]; if (cachedResult !== undefined) { this._pos = cachedResult.nextPos; return cachedResult.result; @@ -1796,7 +1796,7 @@ PEG.grammarParser = (function(){ - this._cache["singleQuotedCharacter"][pos] = { + this._cache[cacheKey] = { nextPos: this._pos, result: result184 }; @@ -1804,8 +1804,8 @@ PEG.grammarParser = (function(){ }; result._parse_simpleSingleQuotedCharacter = function(context) { - this._cache["simpleSingleQuotedCharacter"] = this._cache["simpleSingleQuotedCharacter"] || []; - var cachedResult = this._cache["simpleSingleQuotedCharacter"][this._pos]; + var cacheKey = "simpleSingleQuotedCharacter" + '@' + this._pos; + var cachedResult = this._cache[cacheKey]; if (cachedResult !== undefined) { this._pos = cachedResult.nextPos; return cachedResult.result; @@ -1883,7 +1883,7 @@ PEG.grammarParser = (function(){ - this._cache["simpleSingleQuotedCharacter"][pos] = { + this._cache[cacheKey] = { nextPos: this._pos, result: result191 }; @@ -1891,8 +1891,8 @@ PEG.grammarParser = (function(){ }; result._parse_class = function(context) { - this._cache["class"] = this._cache["class"] || []; - var cachedResult = this._cache["class"][this._pos]; + var cacheKey = "class" + '@' + this._pos; + var cachedResult = this._cache[cacheKey]; if (cachedResult !== undefined) { this._pos = cachedResult.nextPos; return cachedResult.result; @@ -2011,7 +2011,7 @@ PEG.grammarParser = (function(){ this._matchFailed("character class"); } - this._cache["class"][pos] = { + this._cache[cacheKey] = { nextPos: this._pos, result: result199 }; @@ -2019,8 +2019,8 @@ PEG.grammarParser = (function(){ }; result._parse_classCharacterRange = function(context) { - this._cache["classCharacterRange"] = this._cache["classCharacterRange"] || []; - var cachedResult = this._cache["classCharacterRange"][this._pos]; + var cacheKey = "classCharacterRange" + '@' + this._pos; + var cachedResult = this._cache[cacheKey]; if (cachedResult !== undefined) { this._pos = cachedResult.nextPos; return cachedResult.result; @@ -2077,7 +2077,7 @@ PEG.grammarParser = (function(){ - this._cache["classCharacterRange"][pos] = { + this._cache[cacheKey] = { nextPos: this._pos, result: result211 }; @@ -2085,8 +2085,8 @@ PEG.grammarParser = (function(){ }; result._parse_classCharacter = function(context) { - this._cache["classCharacter"] = this._cache["classCharacter"] || []; - var cachedResult = this._cache["classCharacter"][this._pos]; + var cacheKey = "classCharacter" + '@' + this._pos; + var cachedResult = this._cache[cacheKey]; if (cachedResult !== undefined) { this._pos = cachedResult.nextPos; return cachedResult.result; @@ -2104,7 +2104,7 @@ PEG.grammarParser = (function(){ - this._cache["classCharacter"][pos] = { + this._cache[cacheKey] = { nextPos: this._pos, result: result216 }; @@ -2112,8 +2112,8 @@ PEG.grammarParser = (function(){ }; result._parse_bracketDelimitedCharacter = function(context) { - this._cache["bracketDelimitedCharacter"] = this._cache["bracketDelimitedCharacter"] || []; - var cachedResult = this._cache["bracketDelimitedCharacter"][this._pos]; + var cacheKey = "bracketDelimitedCharacter" + '@' + this._pos; + var cachedResult = this._cache[cacheKey]; if (cachedResult !== undefined) { this._pos = cachedResult.nextPos; return cachedResult.result; @@ -2156,7 +2156,7 @@ PEG.grammarParser = (function(){ - this._cache["bracketDelimitedCharacter"][pos] = { + this._cache[cacheKey] = { nextPos: this._pos, result: result218 }; @@ -2164,8 +2164,8 @@ PEG.grammarParser = (function(){ }; result._parse_simpleBracketDelimitedCharacter = function(context) { - this._cache["simpleBracketDelimitedCharacter"] = this._cache["simpleBracketDelimitedCharacter"] || []; - var cachedResult = this._cache["simpleBracketDelimitedCharacter"][this._pos]; + var cacheKey = "simpleBracketDelimitedCharacter" + '@' + this._pos; + var cachedResult = this._cache[cacheKey]; if (cachedResult !== undefined) { this._pos = cachedResult.nextPos; return cachedResult.result; @@ -2243,7 +2243,7 @@ PEG.grammarParser = (function(){ - this._cache["simpleBracketDelimitedCharacter"][pos] = { + this._cache[cacheKey] = { nextPos: this._pos, result: result225 }; @@ -2251,8 +2251,8 @@ PEG.grammarParser = (function(){ }; result._parse_simpleEscapeSequence = function(context) { - this._cache["simpleEscapeSequence"] = this._cache["simpleEscapeSequence"] || []; - var cachedResult = this._cache["simpleEscapeSequence"][this._pos]; + var cacheKey = "simpleEscapeSequence" + '@' + this._pos; + var cachedResult = this._cache[cacheKey]; if (cachedResult !== undefined) { this._pos = cachedResult.nextPos; return cachedResult.result; @@ -2357,7 +2357,7 @@ PEG.grammarParser = (function(){ - this._cache["simpleEscapeSequence"][pos] = { + this._cache[cacheKey] = { nextPos: this._pos, result: result233 }; @@ -2365,8 +2365,8 @@ PEG.grammarParser = (function(){ }; result._parse_zeroEscapeSequence = function(context) { - this._cache["zeroEscapeSequence"] = this._cache["zeroEscapeSequence"] || []; - var cachedResult = this._cache["zeroEscapeSequence"][this._pos]; + var cacheKey = "zeroEscapeSequence" + '@' + this._pos; + var cachedResult = this._cache[cacheKey]; if (cachedResult !== undefined) { this._pos = cachedResult.nextPos; return cachedResult.result; @@ -2413,7 +2413,7 @@ PEG.grammarParser = (function(){ - this._cache["zeroEscapeSequence"][pos] = { + this._cache[cacheKey] = { nextPos: this._pos, result: result243 }; @@ -2421,8 +2421,8 @@ PEG.grammarParser = (function(){ }; result._parse_hexEscapeSequence = function(context) { - this._cache["hexEscapeSequence"] = this._cache["hexEscapeSequence"] || []; - var cachedResult = this._cache["hexEscapeSequence"][this._pos]; + var cacheKey = "hexEscapeSequence" + '@' + this._pos; + var cachedResult = this._cache[cacheKey]; if (cachedResult !== undefined) { this._pos = cachedResult.nextPos; return cachedResult.result; @@ -2467,7 +2467,7 @@ PEG.grammarParser = (function(){ - this._cache["hexEscapeSequence"][pos] = { + this._cache[cacheKey] = { nextPos: this._pos, result: result248 }; @@ -2475,8 +2475,8 @@ PEG.grammarParser = (function(){ }; result._parse_unicodeEscapeSequence = function(context) { - this._cache["unicodeEscapeSequence"] = this._cache["unicodeEscapeSequence"] || []; - var cachedResult = this._cache["unicodeEscapeSequence"][this._pos]; + var cacheKey = "unicodeEscapeSequence" + '@' + this._pos; + var cachedResult = this._cache[cacheKey]; if (cachedResult !== undefined) { this._pos = cachedResult.nextPos; return cachedResult.result; @@ -2533,7 +2533,7 @@ PEG.grammarParser = (function(){ - this._cache["unicodeEscapeSequence"][pos] = { + this._cache[cacheKey] = { nextPos: this._pos, result: result253 }; @@ -2541,8 +2541,8 @@ PEG.grammarParser = (function(){ }; result._parse_eolEscapeSequence = function(context) { - this._cache["eolEscapeSequence"] = this._cache["eolEscapeSequence"] || []; - var cachedResult = this._cache["eolEscapeSequence"][this._pos]; + var cacheKey = "eolEscapeSequence" + '@' + this._pos; + var cachedResult = this._cache[cacheKey]; if (cachedResult !== undefined) { this._pos = cachedResult.nextPos; return cachedResult.result; @@ -2579,7 +2579,7 @@ PEG.grammarParser = (function(){ - this._cache["eolEscapeSequence"][pos] = { + this._cache[cacheKey] = { nextPos: this._pos, result: result260 }; @@ -2587,8 +2587,8 @@ PEG.grammarParser = (function(){ }; result._parse_digit = function(context) { - this._cache["digit"] = this._cache["digit"] || []; - var cachedResult = this._cache["digit"][this._pos]; + var cacheKey = "digit" + '@' + this._pos; + var cachedResult = this._cache[cacheKey]; if (cachedResult !== undefined) { this._pos = cachedResult.nextPos; return cachedResult.result; @@ -2609,7 +2609,7 @@ PEG.grammarParser = (function(){ - this._cache["digit"][pos] = { + this._cache[cacheKey] = { nextPos: this._pos, result: result264 }; @@ -2617,8 +2617,8 @@ PEG.grammarParser = (function(){ }; result._parse_hexDigit = function(context) { - this._cache["hexDigit"] = this._cache["hexDigit"] || []; - var cachedResult = this._cache["hexDigit"][this._pos]; + var cacheKey = "hexDigit" + '@' + this._pos; + var cachedResult = this._cache[cacheKey]; if (cachedResult !== undefined) { this._pos = cachedResult.nextPos; return cachedResult.result; @@ -2639,7 +2639,7 @@ PEG.grammarParser = (function(){ - this._cache["hexDigit"][pos] = { + this._cache[cacheKey] = { nextPos: this._pos, result: result265 }; @@ -2647,8 +2647,8 @@ PEG.grammarParser = (function(){ }; result._parse_letter = function(context) { - this._cache["letter"] = this._cache["letter"] || []; - var cachedResult = this._cache["letter"][this._pos]; + var cacheKey = "letter" + '@' + this._pos; + var cachedResult = this._cache[cacheKey]; if (cachedResult !== undefined) { this._pos = cachedResult.nextPos; return cachedResult.result; @@ -2671,7 +2671,7 @@ PEG.grammarParser = (function(){ - this._cache["letter"][pos] = { + this._cache[cacheKey] = { nextPos: this._pos, result: result266 }; @@ -2679,8 +2679,8 @@ PEG.grammarParser = (function(){ }; result._parse_lowerCaseLetter = function(context) { - this._cache["lowerCaseLetter"] = this._cache["lowerCaseLetter"] || []; - var cachedResult = this._cache["lowerCaseLetter"][this._pos]; + var cacheKey = "lowerCaseLetter" + '@' + this._pos; + var cachedResult = this._cache[cacheKey]; if (cachedResult !== undefined) { this._pos = cachedResult.nextPos; return cachedResult.result; @@ -2701,7 +2701,7 @@ PEG.grammarParser = (function(){ - this._cache["lowerCaseLetter"][pos] = { + this._cache[cacheKey] = { nextPos: this._pos, result: result269 }; @@ -2709,8 +2709,8 @@ PEG.grammarParser = (function(){ }; result._parse_upperCaseLetter = function(context) { - this._cache["upperCaseLetter"] = this._cache["upperCaseLetter"] || []; - var cachedResult = this._cache["upperCaseLetter"][this._pos]; + var cacheKey = "upperCaseLetter" + '@' + this._pos; + var cachedResult = this._cache[cacheKey]; if (cachedResult !== undefined) { this._pos = cachedResult.nextPos; return cachedResult.result; @@ -2731,7 +2731,7 @@ PEG.grammarParser = (function(){ - this._cache["upperCaseLetter"][pos] = { + this._cache[cacheKey] = { nextPos: this._pos, result: result270 }; @@ -2739,8 +2739,8 @@ PEG.grammarParser = (function(){ }; result._parse___ = function(context) { - this._cache["__"] = this._cache["__"] || []; - var cachedResult = this._cache["__"][this._pos]; + var cacheKey = "__" + '@' + this._pos; + var cachedResult = this._cache[cacheKey]; if (cachedResult !== undefined) { this._pos = cachedResult.nextPos; return cachedResult.result; @@ -2788,7 +2788,7 @@ PEG.grammarParser = (function(){ - this._cache["__"][pos] = { + this._cache[cacheKey] = { nextPos: this._pos, result: result271 }; @@ -2796,8 +2796,8 @@ PEG.grammarParser = (function(){ }; result._parse_comment = function(context) { - this._cache["comment"] = this._cache["comment"] || []; - var cachedResult = this._cache["comment"][this._pos]; + var cacheKey = "comment" + '@' + this._pos; + var cachedResult = this._cache[cacheKey]; if (cachedResult !== undefined) { this._pos = cachedResult.nextPos; return cachedResult.result; @@ -2823,7 +2823,7 @@ PEG.grammarParser = (function(){ this._matchFailed("comment"); } - this._cache["comment"][pos] = { + this._cache[cacheKey] = { nextPos: this._pos, result: result276 }; @@ -2831,8 +2831,8 @@ PEG.grammarParser = (function(){ }; result._parse_singleLineComment = function(context) { - this._cache["singleLineComment"] = this._cache["singleLineComment"] || []; - var cachedResult = this._cache["singleLineComment"][this._pos]; + var cacheKey = "singleLineComment" + '@' + this._pos; + var cachedResult = this._cache[cacheKey]; if (cachedResult !== undefined) { this._pos = cachedResult.nextPos; return cachedResult.result; @@ -2933,7 +2933,7 @@ PEG.grammarParser = (function(){ - this._cache["singleLineComment"][pos] = { + this._cache[cacheKey] = { nextPos: this._pos, result: result279 }; @@ -2941,8 +2941,8 @@ PEG.grammarParser = (function(){ }; result._parse_multiLineComment = function(context) { - this._cache["multiLineComment"] = this._cache["multiLineComment"] || []; - var cachedResult = this._cache["multiLineComment"][this._pos]; + var cacheKey = "multiLineComment" + '@' + this._pos; + var cachedResult = this._cache[cacheKey]; if (cachedResult !== undefined) { this._pos = cachedResult.nextPos; return cachedResult.result; @@ -3073,7 +3073,7 @@ PEG.grammarParser = (function(){ - this._cache["multiLineComment"][pos] = { + this._cache[cacheKey] = { nextPos: this._pos, result: result286 }; @@ -3081,8 +3081,8 @@ PEG.grammarParser = (function(){ }; result._parse_eol = function(context) { - this._cache["eol"] = this._cache["eol"] || []; - var cachedResult = this._cache["eol"][this._pos]; + var cacheKey = "eol" + '@' + this._pos; + var cachedResult = this._cache[cacheKey]; if (cachedResult !== undefined) { this._pos = cachedResult.nextPos; return cachedResult.result; @@ -3163,7 +3163,7 @@ PEG.grammarParser = (function(){ this._matchFailed("end of line"); } - this._cache["eol"][pos] = { + this._cache[cacheKey] = { nextPos: this._pos, result: result294 }; @@ -3171,8 +3171,8 @@ PEG.grammarParser = (function(){ }; result._parse_eolChar = function(context) { - this._cache["eolChar"] = this._cache["eolChar"] || []; - var cachedResult = this._cache["eolChar"][this._pos]; + var cacheKey = "eolChar" + '@' + this._pos; + var cachedResult = this._cache[cacheKey]; if (cachedResult !== undefined) { this._pos = cachedResult.nextPos; return cachedResult.result; @@ -3193,7 +3193,7 @@ PEG.grammarParser = (function(){ - this._cache["eolChar"][pos] = { + this._cache[cacheKey] = { nextPos: this._pos, result: result300 }; @@ -3201,8 +3201,8 @@ PEG.grammarParser = (function(){ }; result._parse_whitespace = function(context) { - this._cache["whitespace"] = this._cache["whitespace"] || []; - var cachedResult = this._cache["whitespace"][this._pos]; + var cacheKey = "whitespace" + '@' + this._pos; + var cachedResult = this._cache[cacheKey]; if (cachedResult !== undefined) { this._pos = cachedResult.nextPos; return cachedResult.result; @@ -3226,7 +3226,7 @@ PEG.grammarParser = (function(){ this._matchFailed("whitespace"); } - this._cache["whitespace"][pos] = { + this._cache[cacheKey] = { nextPos: this._pos, result: result301 };