From c3c1c796659c64b19f4ad098835dff6426e72cb0 Mon Sep 17 00:00:00 2001 From: David Majda Date: Tue, 20 Apr 2010 21:09:23 +0200 Subject: [PATCH] Added OneOrMore AST node. This speeds up the benchmark suite execution by 1.08% on V8. Detailed results (benchmark suite totals): --------------------------------- Test # Before After --------------------------------- 1 28.38 kB/s 28.72 kB/s 2 28.52 kB/s 28.84 kB/s 3 28.41 kB/s 28.83 kB/s 4 28.47 kB/s 28.81 kB/s 5 28.64 kB/s 28.76 kB/s --------------------------------- Average 28.48 kB/s 28.79 kB/s --------------------------------- Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/533.2 (KHTML, like Gecko) Chrome/5.0.342.9 Safari/533.2 --- lib/compiler.js | 32 + lib/metagrammar.js | 2353 +++++++++++++++++++------------------- lib/metagrammar.pegjs | 7 +- test/compiler-test.js | 2 + test/metagrammar-test.js | 8 +- 5 files changed, 1194 insertions(+), 1208 deletions(-) diff --git a/lib/compiler.js b/lib/compiler.js index 77c2050..d1aa173 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -200,6 +200,8 @@ PEG.Grammar.Choice = function(alternatives) { PEG.Grammar.ZeroOrMore = function(element) { this._element = element; }; +PEG.Grammar.OneOrMore = function(element) { this._element = element; }; + PEG.Grammar.NotPredicate = function(expression) { this._expression = expression; }; @@ -240,6 +242,9 @@ PEG.Grammar.extendNodes("checkReferencedRulesExist", { ZeroOrMore: function(grammar) { this._element.checkReferencedRulesExist(grammar); }, + OneOrMore: + function(grammar) { this._element.checkReferencedRulesExist(grammar); }, + NotPredicate: function(grammar) { this._expression.checkReferencedRulesExist(grammar); }, @@ -288,6 +293,11 @@ PEG.Grammar.extendNodes("checkNoLeftRecursion", { this._element.checkNoLeftRecursion(grammar, appliedRules); }, + OneOrMore: + function(grammar, appliedRules) { + this._element.checkNoLeftRecursion(grammar, appliedRules); + }, + NotPredicate: function(grammar, appliedRules) { this._expression.checkNoLeftRecursion(grammar, appliedRules); @@ -858,6 +868,28 @@ PEG.Grammar.ZeroOrMore.prototype.compile = function(resultVar) { ); }; +PEG.Grammar.OneOrMore.prototype.compile = function(resultVar) { + var elementResultVar = PEG.Compiler.generateUniqueIdentifier("result"); + + return PEG.Compiler.formatCode( + "${elementCode}", + "if (${elementResultVar} !== null) {", + " var ${resultVar} = [];", + " while (${elementResultVar} !== null) {", + " ${resultVar}.push(${elementResultVar});", + " ${elementCode}", + " }", + "} else {", + " var ${resultVar} = null;", + "}", + { + elementCode: this._element.compile(elementResultVar), + elementResultVar: elementResultVar, + resultVar: resultVar + } + ); +}; + PEG.Grammar.NotPredicate.prototype.compile = function(resultVar) { var savedPosVar = PEG.Compiler.generateUniqueIdentifier("savedPos"); var savedReportMatchFailuresVar = PEG.Compiler.generateUniqueIdentifier("savedReportMatchFailuresVar"); diff --git a/lib/metagrammar.js b/lib/metagrammar.js index e98023a..1fdd0e8 100644 --- a/lib/metagrammar.js +++ b/lib/metagrammar.js @@ -60,32 +60,16 @@ PEG.grammarParser = (function(){ var savedPos0 = this._pos; var result2 = this._parse___(context); if (result2 !== null) { - var savedPos1 = this._pos; - var result5 = this._parse_rule(context); - if (result5 !== null) { - var result6 = []; - var result7 = this._parse_rule(context); - while (result7 !== null) { - result6.push(result7); - var result7 = this._parse_rule(context); - } - if (result6 !== null) { - var result4 = [result5, result6]; - } else { - var result4 = null; - this._pos = savedPos1; + var result4 = this._parse_rule(context); + if (result4 !== null) { + var result3 = []; + while (result4 !== null) { + result3.push(result4); + var result4 = this._parse_rule(context); } } else { - var result4 = null; - this._pos = savedPos1; + var result3 = null; } - var result3 = result4 !== null - ? ( - function (first, rest) { - return [first].concat(rest); - } - ).apply(this, result4) - : null; if (result3 !== null) { var result1 = [result2, result3]; } else { @@ -124,63 +108,63 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var savedPos2 = this._pos; - var result10 = this._parse_identifier(context); - if (result10 !== null) { - var result15 = this._parse_literal(context); - if (result15 !== null) { - var result11 = result15; + var savedPos1 = this._pos; + var result7 = this._parse_identifier(context); + if (result7 !== null) { + var result12 = this._parse_literal(context); + if (result12 !== null) { + var result8 = result12; } else { if (this._input.substr(this._pos, 0) === "") { - var result14 = ""; + var result11 = ""; this._pos += 0; } else { - var result14 = null; + var result11 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("")); } } - if (result14 !== null) { - var result11 = result14; + if (result11 !== null) { + var result8 = result11; } else { - var result11 = null;; + var result8 = null;; }; } - if (result11 !== null) { - var result12 = this._parse_colon(context); - if (result12 !== null) { - var result13 = this._parse_expression(context); - if (result13 !== null) { - var result9 = [result10, result11, result12, result13]; + if (result8 !== null) { + var result9 = this._parse_colon(context); + if (result9 !== null) { + var result10 = this._parse_expression(context); + if (result10 !== null) { + var result6 = [result7, result8, result9, result10]; } else { - var result9 = null; - this._pos = savedPos2; + var result6 = null; + this._pos = savedPos1; } } else { - var result9 = null; - this._pos = savedPos2; + var result6 = null; + this._pos = savedPos1; } } else { - var result9 = null; - this._pos = savedPos2; + var result6 = null; + this._pos = savedPos1; } } else { - var result9 = null; - this._pos = savedPos2; + var result6 = null; + this._pos = savedPos1; } - var result8 = result9 !== null + var result5 = result6 !== null ? (function() { return new PEG.Grammar.Rule((arguments[0]), (arguments[1]) !== "" ? (arguments[1]) : null, (arguments[3])); - }).apply(this, result9) + }).apply(this, result6) : null; this._cache[cacheKey] = { nextPos: this._pos, - result: result8 + result: result5 }; - return result8; + return result5; }, _parse_expression: function(context) { @@ -194,15 +178,15 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var result16 = this._parse_choice(context); + var result13 = this._parse_choice(context); this._cache[cacheKey] = { nextPos: this._pos, - result: result16 + result: result13 }; - return result16; + return result13; }, _parse_choice: function(context) { @@ -216,52 +200,52 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var savedPos3 = this._pos; - var result19 = this._parse_sequence(context); - if (result19 !== null) { - var result20 = []; - var savedPos4 = this._pos; - var result22 = this._parse_slash(context); - if (result22 !== null) { - var result23 = this._parse_sequence(context); - if (result23 !== null) { - var result21 = [result22, result23]; + var savedPos2 = this._pos; + var result16 = this._parse_sequence(context); + if (result16 !== null) { + var result17 = []; + var savedPos3 = this._pos; + var result19 = this._parse_slash(context); + if (result19 !== null) { + var result20 = this._parse_sequence(context); + if (result20 !== null) { + var result18 = [result19, result20]; } else { - var result21 = null; - this._pos = savedPos4; + var result18 = null; + this._pos = savedPos3; } } else { - var result21 = null; - this._pos = savedPos4; + var result18 = null; + this._pos = savedPos3; } - while (result21 !== null) { - result20.push(result21); - var savedPos4 = this._pos; - var result22 = this._parse_slash(context); - if (result22 !== null) { - var result23 = this._parse_sequence(context); - if (result23 !== null) { - var result21 = [result22, result23]; + while (result18 !== null) { + result17.push(result18); + var savedPos3 = this._pos; + var result19 = this._parse_slash(context); + if (result19 !== null) { + var result20 = this._parse_sequence(context); + if (result20 !== null) { + var result18 = [result19, result20]; } else { - var result21 = null; - this._pos = savedPos4; + var result18 = null; + this._pos = savedPos3; } } else { - var result21 = null; - this._pos = savedPos4; + var result18 = null; + this._pos = savedPos3; } } - if (result20 !== null) { - var result18 = [result19, result20]; + if (result17 !== null) { + var result15 = [result16, result17]; } else { - var result18 = null; - this._pos = savedPos3; + var result15 = null; + this._pos = savedPos2; } } else { - var result18 = null; - this._pos = savedPos3; + var result15 = null; + this._pos = savedPos2; } - var result17 = result18 !== null + var result14 = result15 !== null ? (function() { return (arguments[1]).length > 0 ? new PEG.Grammar.Choice([(arguments[0])].concat(PEG.ArrayUtils.map( @@ -269,16 +253,16 @@ PEG.grammarParser = (function(){ function(element) { return element[1]; } ))) : (arguments[0]); - }).apply(this, result18) + }).apply(this, result15) : null; this._cache[cacheKey] = { nextPos: this._pos, - result: result17 + result: result14 }; - return result17; + return result14; }, _parse_sequence: function(context) { @@ -292,49 +276,49 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var savedPos5 = this._pos; - var result30 = []; - var result32 = this._parse_prefixed(context); - while (result32 !== null) { - result30.push(result32); - var result32 = this._parse_prefixed(context); + var savedPos4 = this._pos; + var result27 = []; + var result29 = this._parse_prefixed(context); + while (result29 !== null) { + result27.push(result29); + var result29 = this._parse_prefixed(context); } - if (result30 !== null) { - var result31 = this._parse_action(context); - if (result31 !== null) { - var result29 = [result30, result31]; + if (result27 !== null) { + var result28 = this._parse_action(context); + if (result28 !== null) { + var result26 = [result27, result28]; } else { - var result29 = null; - this._pos = savedPos5; + var result26 = null; + this._pos = savedPos4; } } else { - var result29 = null; - this._pos = savedPos5; + var result26 = null; + this._pos = savedPos4; } - var result28 = result29 !== null + var result25 = result26 !== null ? (function() { return new PEG.Grammar.Action( (arguments[0]).length != 1 ? new PEG.Grammar.Sequence((arguments[0])) : (arguments[0])[0], (arguments[1]) ); - }).apply(this, result29) + }).apply(this, result26) : null; - if (result28 !== null) { - var result24 = result28; + if (result25 !== null) { + var result21 = result25; } else { - var result26 = []; - var result27 = this._parse_prefixed(context); - while (result27 !== null) { - result26.push(result27); - var result27 = this._parse_prefixed(context); + var result23 = []; + var result24 = this._parse_prefixed(context); + while (result24 !== null) { + result23.push(result24); + var result24 = this._parse_prefixed(context); } - var result25 = result26 !== null - ? (function() { return (arguments[0]).length != 1 ? new PEG.Grammar.Sequence((arguments[0])) : (arguments[0])[0]; }).call(this, result26) + var result22 = result23 !== null + ? (function() { return (arguments[0]).length != 1 ? new PEG.Grammar.Sequence((arguments[0])) : (arguments[0])[0]; }).call(this, result23) : null; - if (result25 !== null) { - var result24 = result25; + if (result22 !== null) { + var result21 = result22; } else { - var result24 = null;; + var result21 = null;; }; } @@ -342,9 +326,9 @@ PEG.grammarParser = (function(){ this._cache[cacheKey] = { nextPos: this._pos, - result: result24 + result: result21 }; - return result24; + return result21; }, _parse_prefixed: function(context) { @@ -358,53 +342,53 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var savedPos7 = this._pos; - var result41 = this._parse_and(context); - if (result41 !== null) { - var result42 = this._parse_suffixed(context); - if (result42 !== null) { - var result40 = [result41, result42]; + var savedPos6 = this._pos; + var result38 = this._parse_and(context); + if (result38 !== null) { + var result39 = this._parse_suffixed(context); + if (result39 !== null) { + var result37 = [result38, result39]; } else { - var result40 = null; - this._pos = savedPos7; + var result37 = null; + this._pos = savedPos6; } } else { - var result40 = null; - this._pos = savedPos7; + var result37 = null; + this._pos = savedPos6; } - var result39 = result40 !== null + var result36 = result37 !== null ? (function() { return new PEG.Grammar.NotPredicate(new PEG.Grammar.NotPredicate((arguments[1]))); - }).apply(this, result40) + }).apply(this, result37) : null; - if (result39 !== null) { - var result33 = result39; - } else { - var savedPos6 = this._pos; - var result37 = this._parse_not(context); - if (result37 !== null) { - var result38 = this._parse_suffixed(context); - if (result38 !== null) { - var result36 = [result37, result38]; + if (result36 !== null) { + var result30 = result36; + } else { + var savedPos5 = this._pos; + var result34 = this._parse_not(context); + if (result34 !== null) { + var result35 = this._parse_suffixed(context); + if (result35 !== null) { + var result33 = [result34, result35]; } else { - var result36 = null; - this._pos = savedPos6; + var result33 = null; + this._pos = savedPos5; } } else { - var result36 = null; - this._pos = savedPos6; + var result33 = null; + this._pos = savedPos5; } - var result35 = result36 !== null - ? (function() { return new PEG.Grammar.NotPredicate((arguments[1])); }).apply(this, result36) + var result32 = result33 !== null + ? (function() { return new PEG.Grammar.NotPredicate((arguments[1])); }).apply(this, result33) : null; - if (result35 !== null) { - var result33 = result35; + if (result32 !== null) { + var result30 = result32; } else { - var result34 = this._parse_suffixed(context); - if (result34 !== null) { - var result33 = result34; + var result31 = this._parse_suffixed(context); + if (result31 !== null) { + var result30 = result31; } else { - var result33 = null;; + var result30 = null;; }; }; } @@ -413,9 +397,9 @@ PEG.grammarParser = (function(){ this._cache[cacheKey] = { nextPos: this._pos, - result: result33 + result: result30 }; - return result33; + return result30; }, _parse_suffixed: function(context) { @@ -429,78 +413,73 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var savedPos10 = this._pos; - var result55 = this._parse_primary(context); - if (result55 !== null) { - var result56 = this._parse_question(context); - if (result56 !== null) { - var result54 = [result55, result56]; + var savedPos9 = this._pos; + var result52 = this._parse_primary(context); + if (result52 !== null) { + var result53 = this._parse_question(context); + if (result53 !== null) { + var result51 = [result52, result53]; } else { - var result54 = null; - this._pos = savedPos10; + var result51 = null; + this._pos = savedPos9; } } else { - var result54 = null; - this._pos = savedPos10; + var result51 = null; + this._pos = savedPos9; } - var result53 = result54 !== null + var result50 = result51 !== null ? (function() { return new PEG.Grammar.Choice([(arguments[0]), new PEG.Grammar.Literal("")]); - }).apply(this, result54) + }).apply(this, result51) : null; - if (result53 !== null) { - var result43 = result53; - } else { - var savedPos9 = this._pos; - var result51 = this._parse_primary(context); - if (result51 !== null) { - var result52 = this._parse_star(context); - if (result52 !== null) { - var result50 = [result51, result52]; + if (result50 !== null) { + var result40 = result50; + } else { + var savedPos8 = this._pos; + var result48 = this._parse_primary(context); + if (result48 !== null) { + var result49 = this._parse_star(context); + if (result49 !== null) { + var result47 = [result48, result49]; } else { - var result50 = null; - this._pos = savedPos9; + var result47 = null; + this._pos = savedPos8; } } else { - var result50 = null; - this._pos = savedPos9; + var result47 = null; + this._pos = savedPos8; } - var result49 = result50 !== null - ? (function() { return new PEG.Grammar.ZeroOrMore((arguments[0])); }).apply(this, result50) + var result46 = result47 !== null + ? (function() { return new PEG.Grammar.ZeroOrMore((arguments[0])); }).apply(this, result47) : null; - if (result49 !== null) { - var result43 = result49; - } else { - var savedPos8 = this._pos; - var result47 = this._parse_primary(context); - if (result47 !== null) { - var result48 = this._parse_plus(context); - if (result48 !== null) { - var result46 = [result47, result48]; + if (result46 !== null) { + var result40 = result46; + } else { + var savedPos7 = this._pos; + var result44 = this._parse_primary(context); + if (result44 !== null) { + var result45 = this._parse_plus(context); + if (result45 !== null) { + var result43 = [result44, result45]; } else { - var result46 = null; - this._pos = savedPos8; + var result43 = null; + this._pos = savedPos7; } } else { - var result46 = null; - this._pos = savedPos8; + var result43 = null; + this._pos = savedPos7; } - var result45 = result46 !== null - ? (function() { - return new PEG.Grammar.Action( - new PEG.Grammar.Sequence([(arguments[0]), new PEG.Grammar.ZeroOrMore((arguments[0]))]), - function(first, rest) { return [first].concat(rest); } - ); - }).apply(this, result46) + var result42 = result43 !== null + ? (function() { return new PEG.Grammar.OneOrMore((arguments[0])); }).apply(this, result43) : null; - if (result45 !== null) { - var result43 = result45; + if (result42 !== null) { + var result40 = result42; } else { - var result44 = this._parse_primary(context); - if (result44 !== null) { - var result43 = result44; + var result41 = this._parse_primary(context); + if (result41 !== null) { + var result40 = result41; } else { - var result43 = null;; + var result40 = null;; }; }; }; @@ -510,9 +489,9 @@ PEG.grammarParser = (function(){ this._cache[cacheKey] = { nextPos: this._pos, - result: result43 + result: result40 }; - return result43; + return result40; }, _parse_primary: function(context) { @@ -526,115 +505,115 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var savedPos12 = this._pos; - var result71 = this._parse_identifier(context); - if (result71 !== null) { - var savedPos13 = this._pos; + var savedPos11 = this._pos; + var result68 = this._parse_identifier(context); + if (result68 !== null) { + var savedPos12 = this._pos; var savedReportMatchFailuresVar0 = context.reportMatchFailures; context.reportMatchFailures = false; - var savedPos14 = this._pos; - var result77 = this._parse_literal(context); - if (result77 !== null) { - var result74 = result77; + var savedPos13 = this._pos; + var result74 = this._parse_literal(context); + if (result74 !== null) { + var result71 = result74; } else { if (this._input.substr(this._pos, 0) === "") { - var result76 = ""; + var result73 = ""; this._pos += 0; } else { - var result76 = null; + var result73 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("")); } } - if (result76 !== null) { - var result74 = result76; + if (result73 !== null) { + var result71 = result73; } else { - var result74 = null;; + var result71 = null;; }; } - if (result74 !== null) { - var result75 = this._parse_colon(context); - if (result75 !== null) { - var result73 = [result74, result75]; + if (result71 !== null) { + var result72 = this._parse_colon(context); + if (result72 !== null) { + var result70 = [result71, result72]; } else { - var result73 = null; - this._pos = savedPos14; + var result70 = null; + this._pos = savedPos13; } } else { - var result73 = null; - this._pos = savedPos14; + var result70 = null; + this._pos = savedPos13; } context.reportMatchFailures = savedReportMatchFailuresVar0; - if (result73 === null) { - var result72 = ''; + if (result70 === null) { + var result69 = ''; } else { - var result72 = null; - this._pos = savedPos13; + var result69 = null; + this._pos = savedPos12; } - if (result72 !== null) { - var result70 = [result71, result72]; + if (result69 !== null) { + var result67 = [result68, result69]; } else { - var result70 = null; - this._pos = savedPos12; + var result67 = null; + this._pos = savedPos11; } } else { - var result70 = null; - this._pos = savedPos12; + var result67 = null; + this._pos = savedPos11; } - var result69 = result70 !== null - ? (function() { return new PEG.Grammar.RuleRef((arguments[0])); }).apply(this, result70) + var result66 = result67 !== null + ? (function() { return new PEG.Grammar.RuleRef((arguments[0])); }).apply(this, result67) : null; - if (result69 !== null) { - var result57 = result69; + if (result66 !== null) { + var result54 = result66; } else { - var result68 = this._parse_literal(context); - var result67 = result68 !== null - ? (function() { return new PEG.Grammar.Literal((arguments[0])); }).call(this, result68) + var result65 = this._parse_literal(context); + var result64 = result65 !== null + ? (function() { return new PEG.Grammar.Literal((arguments[0])); }).call(this, result65) : null; - if (result67 !== null) { - var result57 = result67; + if (result64 !== null) { + var result54 = result64; } else { - var result66 = this._parse_dot(context); - var result65 = result66 !== null - ? (function() { return new PEG.Grammar.Any(); }).call(this, result66) + var result63 = this._parse_dot(context); + var result62 = result63 !== null + ? (function() { return new PEG.Grammar.Any(); }).call(this, result63) : null; - if (result65 !== null) { - var result57 = result65; + if (result62 !== null) { + var result54 = result62; } else { - var result64 = this._parse_class(context); - var result63 = result64 !== null - ? (function() { return new PEG.Grammar.Class((arguments[0])); }).call(this, result64) + var result61 = this._parse_class(context); + var result60 = result61 !== null + ? (function() { return new PEG.Grammar.Class((arguments[0])); }).call(this, result61) : null; - if (result63 !== null) { - var result57 = result63; + if (result60 !== null) { + var result54 = result60; } else { - var savedPos11 = this._pos; - var result60 = this._parse_lparen(context); - if (result60 !== null) { - var result61 = this._parse_expression(context); - if (result61 !== null) { - var result62 = this._parse_rparen(context); - if (result62 !== null) { - var result59 = [result60, result61, result62]; + var savedPos10 = this._pos; + var result57 = this._parse_lparen(context); + if (result57 !== null) { + var result58 = this._parse_expression(context); + if (result58 !== null) { + var result59 = this._parse_rparen(context); + if (result59 !== null) { + var result56 = [result57, result58, result59]; } else { - var result59 = null; - this._pos = savedPos11; + var result56 = null; + this._pos = savedPos10; } } else { - var result59 = null; - this._pos = savedPos11; + var result56 = null; + this._pos = savedPos10; } } else { - var result59 = null; - this._pos = savedPos11; + var result56 = null; + this._pos = savedPos10; } - var result58 = result59 !== null - ? (function() { return (arguments[1]); }).apply(this, result59) + var result55 = result56 !== null + ? (function() { return (arguments[1]); }).apply(this, result56) : null; - if (result58 !== null) { - var result57 = result58; + if (result55 !== null) { + var result54 = result55; } else { - var result57 = null;; + var result54 = null;; }; }; }; @@ -645,9 +624,9 @@ PEG.grammarParser = (function(){ this._cache[cacheKey] = { nextPos: this._pos, - result: result57 + result: result54 }; - return result57; + return result54; }, _parse_action: function(context) { @@ -662,33 +641,33 @@ PEG.grammarParser = (function(){ var savedReportMatchFailures = context.reportMatchFailures; context.reportMatchFailures = false; - var savedPos15 = this._pos; - var result80 = this._parse_braced(context); - if (result80 !== null) { - var result81 = this._parse___(context); - if (result81 !== null) { - var result79 = [result80, result81]; - } else { - var result79 = null; - this._pos = savedPos15; + var savedPos14 = this._pos; + var result77 = this._parse_braced(context); + if (result77 !== null) { + var result78 = this._parse___(context); + if (result78 !== null) { + var result76 = [result77, result78]; + } else { + var result76 = null; + this._pos = savedPos14; } } else { - var result79 = null; - this._pos = savedPos15; + var result76 = null; + this._pos = savedPos14; } - var result78 = result79 !== null - ? (function() { return (arguments[0]).substr(1, (arguments[0]).length - 2); }).apply(this, result79) + var result75 = result76 !== null + ? (function() { return (arguments[0]).substr(1, (arguments[0]).length - 2); }).apply(this, result76) : null; context.reportMatchFailures = savedReportMatchFailures; - if (context.reportMatchFailures && result78 === null) { + if (context.reportMatchFailures && result75 === null) { this._matchFailed("action"); } this._cache[cacheKey] = { nextPos: this._pos, - result: result78 + result: result75 }; - return result78; + return result75; }, _parse_braced: function(context) { @@ -702,78 +681,78 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var savedPos16 = this._pos; + var savedPos15 = this._pos; if (this._input.substr(this._pos, 1) === "{") { - var result84 = "{"; + var result81 = "{"; this._pos += 1; } else { - var result84 = null; + var result81 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("{")); } } - if (result84 !== null) { - var result85 = []; - var result89 = this._parse_braced(context); - if (result89 !== null) { - var result87 = result89; + if (result81 !== null) { + var result82 = []; + var result86 = this._parse_braced(context); + if (result86 !== null) { + var result84 = result86; } else { - var result88 = this._parse_nonBraceCharacter(context); - if (result88 !== null) { - var result87 = result88; + var result85 = this._parse_nonBraceCharacter(context); + if (result85 !== null) { + var result84 = result85; } else { - var result87 = null;; + var result84 = null;; }; } - while (result87 !== null) { - result85.push(result87); - var result89 = this._parse_braced(context); - if (result89 !== null) { - var result87 = result89; + while (result84 !== null) { + result82.push(result84); + var result86 = this._parse_braced(context); + if (result86 !== null) { + var result84 = result86; } else { - var result88 = this._parse_nonBraceCharacter(context); - if (result88 !== null) { - var result87 = result88; + var result85 = this._parse_nonBraceCharacter(context); + if (result85 !== null) { + var result84 = result85; } else { - var result87 = null;; + var result84 = null;; }; } } - if (result85 !== null) { + if (result82 !== null) { if (this._input.substr(this._pos, 1) === "}") { - var result86 = "}"; + var result83 = "}"; this._pos += 1; } else { - var result86 = null; + var result83 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("}")); } } - if (result86 !== null) { - var result83 = [result84, result85, result86]; + if (result83 !== null) { + var result80 = [result81, result82, result83]; } else { - var result83 = null; - this._pos = savedPos16; + var result80 = null; + this._pos = savedPos15; } } else { - var result83 = null; - this._pos = savedPos16; + var result80 = null; + this._pos = savedPos15; } } else { - var result83 = null; - this._pos = savedPos16; + var result80 = null; + this._pos = savedPos15; } - var result82 = result83 !== null - ? (function() { return (arguments[0]) + (arguments[1]).join("") + (arguments[2]); }).apply(this, result83) + var result79 = result80 !== null + ? (function() { return (arguments[0]) + (arguments[1]).join("") + (arguments[2]); }).apply(this, result80) : null; this._cache[cacheKey] = { nextPos: this._pos, - result: result82 + result: result79 }; - return result82; + return result79; }, _parse_nonBraceCharacters: function(context) { @@ -787,43 +766,27 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var savedPos17 = this._pos; - var result93 = this._parse_nonBraceCharacter(context); - if (result93 !== null) { - var result94 = []; - var result95 = this._parse_nonBraceCharacter(context); - while (result95 !== null) { - result94.push(result95); - var result95 = this._parse_nonBraceCharacter(context); - } - if (result94 !== null) { - var result92 = [result93, result94]; - } else { - var result92 = null; - this._pos = savedPos17; + var result89 = this._parse_nonBraceCharacter(context); + if (result89 !== null) { + var result88 = []; + while (result89 !== null) { + result88.push(result89); + var result89 = this._parse_nonBraceCharacter(context); } } else { - var result92 = null; - this._pos = savedPos17; + var result88 = null; } - var result91 = result92 !== null - ? ( - function (first, rest) { - return [first].concat(rest); - } - ).apply(this, result92) - : null; - var result90 = result91 !== null - ? (function() { return (arguments[0]).join(""); }).call(this, result91) + var result87 = result88 !== null + ? (function() { return (arguments[0]).join(""); }).call(this, result88) : null; this._cache[cacheKey] = { nextPos: this._pos, - result: result90 + result: result87 }; - return result90; + return result87; }, _parse_nonBraceCharacter: function(context) { @@ -838,25 +801,25 @@ PEG.grammarParser = (function(){ if (this._input.substr(this._pos).match(/^[^{}]/) !== null) { - var result97 = this._input.charAt(this._pos); + var result91 = this._input.charAt(this._pos); this._pos++; } else { - var result97 = null; + var result91 = null; if (context.reportMatchFailures) { this._matchFailed('[' + "^{}" + ']'); } } - var result96 = result97 !== null - ? (function() { return (arguments[0]); }).call(this, result97) + var result90 = result91 !== null + ? (function() { return (arguments[0]); }).call(this, result91) : null; this._cache[cacheKey] = { nextPos: this._pos, - result: result96 + result: result90 }; - return result96; + return result90; }, _parse_colon: function(context) { @@ -870,39 +833,39 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var savedPos18 = this._pos; + var savedPos16 = this._pos; if (this._input.substr(this._pos, 1) === ":") { - var result100 = ":"; + var result94 = ":"; this._pos += 1; } else { - var result100 = null; + var result94 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString(":")); } } - if (result100 !== null) { - var result101 = this._parse___(context); - if (result101 !== null) { - var result99 = [result100, result101]; + if (result94 !== null) { + var result95 = this._parse___(context); + if (result95 !== null) { + var result93 = [result94, result95]; } else { - var result99 = null; - this._pos = savedPos18; + var result93 = null; + this._pos = savedPos16; } } else { - var result99 = null; - this._pos = savedPos18; + var result93 = null; + this._pos = savedPos16; } - var result98 = result99 !== null - ? (function() { return (arguments[0]); }).apply(this, result99) + var result92 = result93 !== null + ? (function() { return (arguments[0]); }).apply(this, result93) : null; this._cache[cacheKey] = { nextPos: this._pos, - result: result98 + result: result92 }; - return result98; + return result92; }, _parse_slash: function(context) { @@ -916,39 +879,39 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var savedPos19 = this._pos; + var savedPos17 = this._pos; if (this._input.substr(this._pos, 1) === "/") { - var result104 = "/"; + var result98 = "/"; this._pos += 1; } else { - var result104 = null; + var result98 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("/")); } } - if (result104 !== null) { - var result105 = this._parse___(context); - if (result105 !== null) { - var result103 = [result104, result105]; + if (result98 !== null) { + var result99 = this._parse___(context); + if (result99 !== null) { + var result97 = [result98, result99]; } else { - var result103 = null; - this._pos = savedPos19; + var result97 = null; + this._pos = savedPos17; } } else { - var result103 = null; - this._pos = savedPos19; + var result97 = null; + this._pos = savedPos17; } - var result102 = result103 !== null - ? (function() { return (arguments[0]); }).apply(this, result103) + var result96 = result97 !== null + ? (function() { return (arguments[0]); }).apply(this, result97) : null; this._cache[cacheKey] = { nextPos: this._pos, - result: result102 + result: result96 }; - return result102; + return result96; }, _parse_and: function(context) { @@ -962,39 +925,39 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var savedPos20 = this._pos; + var savedPos18 = this._pos; if (this._input.substr(this._pos, 1) === "&") { - var result108 = "&"; + var result102 = "&"; this._pos += 1; } else { - var result108 = null; + var result102 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("&")); } } - if (result108 !== null) { - var result109 = this._parse___(context); - if (result109 !== null) { - var result107 = [result108, result109]; + if (result102 !== null) { + var result103 = this._parse___(context); + if (result103 !== null) { + var result101 = [result102, result103]; } else { - var result107 = null; - this._pos = savedPos20; + var result101 = null; + this._pos = savedPos18; } } else { - var result107 = null; - this._pos = savedPos20; + var result101 = null; + this._pos = savedPos18; } - var result106 = result107 !== null - ? (function() { return (arguments[0]); }).apply(this, result107) + var result100 = result101 !== null + ? (function() { return (arguments[0]); }).apply(this, result101) : null; this._cache[cacheKey] = { nextPos: this._pos, - result: result106 + result: result100 }; - return result106; + return result100; }, _parse_not: function(context) { @@ -1008,39 +971,39 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var savedPos21 = this._pos; + var savedPos19 = this._pos; if (this._input.substr(this._pos, 1) === "!") { - var result112 = "!"; + var result106 = "!"; this._pos += 1; } else { - var result112 = null; + var result106 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("!")); } } - if (result112 !== null) { - var result113 = this._parse___(context); - if (result113 !== null) { - var result111 = [result112, result113]; + if (result106 !== null) { + var result107 = this._parse___(context); + if (result107 !== null) { + var result105 = [result106, result107]; } else { - var result111 = null; - this._pos = savedPos21; + var result105 = null; + this._pos = savedPos19; } } else { - var result111 = null; - this._pos = savedPos21; + var result105 = null; + this._pos = savedPos19; } - var result110 = result111 !== null - ? (function() { return (arguments[0]); }).apply(this, result111) + var result104 = result105 !== null + ? (function() { return (arguments[0]); }).apply(this, result105) : null; this._cache[cacheKey] = { nextPos: this._pos, - result: result110 + result: result104 }; - return result110; + return result104; }, _parse_question: function(context) { @@ -1054,39 +1017,39 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var savedPos22 = this._pos; + var savedPos20 = this._pos; if (this._input.substr(this._pos, 1) === "?") { - var result116 = "?"; + var result110 = "?"; this._pos += 1; } else { - var result116 = null; + var result110 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("?")); } } - if (result116 !== null) { - var result117 = this._parse___(context); - if (result117 !== null) { - var result115 = [result116, result117]; + if (result110 !== null) { + var result111 = this._parse___(context); + if (result111 !== null) { + var result109 = [result110, result111]; } else { - var result115 = null; - this._pos = savedPos22; + var result109 = null; + this._pos = savedPos20; } } else { - var result115 = null; - this._pos = savedPos22; + var result109 = null; + this._pos = savedPos20; } - var result114 = result115 !== null - ? (function() { return (arguments[0]); }).apply(this, result115) + var result108 = result109 !== null + ? (function() { return (arguments[0]); }).apply(this, result109) : null; this._cache[cacheKey] = { nextPos: this._pos, - result: result114 + result: result108 }; - return result114; + return result108; }, _parse_star: function(context) { @@ -1100,39 +1063,39 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var savedPos23 = this._pos; + var savedPos21 = this._pos; if (this._input.substr(this._pos, 1) === "*") { - var result120 = "*"; + var result114 = "*"; this._pos += 1; } else { - var result120 = null; + var result114 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("*")); } } - if (result120 !== null) { - var result121 = this._parse___(context); - if (result121 !== null) { - var result119 = [result120, result121]; + if (result114 !== null) { + var result115 = this._parse___(context); + if (result115 !== null) { + var result113 = [result114, result115]; } else { - var result119 = null; - this._pos = savedPos23; + var result113 = null; + this._pos = savedPos21; } } else { - var result119 = null; - this._pos = savedPos23; + var result113 = null; + this._pos = savedPos21; } - var result118 = result119 !== null - ? (function() { return (arguments[0]); }).apply(this, result119) + var result112 = result113 !== null + ? (function() { return (arguments[0]); }).apply(this, result113) : null; this._cache[cacheKey] = { nextPos: this._pos, - result: result118 + result: result112 }; - return result118; + return result112; }, _parse_plus: function(context) { @@ -1146,39 +1109,39 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var savedPos24 = this._pos; + var savedPos22 = this._pos; if (this._input.substr(this._pos, 1) === "+") { - var result124 = "+"; + var result118 = "+"; this._pos += 1; } else { - var result124 = null; + var result118 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("+")); } } - if (result124 !== null) { - var result125 = this._parse___(context); - if (result125 !== null) { - var result123 = [result124, result125]; + if (result118 !== null) { + var result119 = this._parse___(context); + if (result119 !== null) { + var result117 = [result118, result119]; } else { - var result123 = null; - this._pos = savedPos24; + var result117 = null; + this._pos = savedPos22; } } else { - var result123 = null; - this._pos = savedPos24; + var result117 = null; + this._pos = savedPos22; } - var result122 = result123 !== null - ? (function() { return (arguments[0]); }).apply(this, result123) + var result116 = result117 !== null + ? (function() { return (arguments[0]); }).apply(this, result117) : null; this._cache[cacheKey] = { nextPos: this._pos, - result: result122 + result: result116 }; - return result122; + return result116; }, _parse_lparen: function(context) { @@ -1192,39 +1155,39 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var savedPos25 = this._pos; + var savedPos23 = this._pos; if (this._input.substr(this._pos, 1) === "(") { - var result128 = "("; + var result122 = "("; this._pos += 1; } else { - var result128 = null; + var result122 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("(")); } } - if (result128 !== null) { - var result129 = this._parse___(context); - if (result129 !== null) { - var result127 = [result128, result129]; + if (result122 !== null) { + var result123 = this._parse___(context); + if (result123 !== null) { + var result121 = [result122, result123]; } else { - var result127 = null; - this._pos = savedPos25; + var result121 = null; + this._pos = savedPos23; } } else { - var result127 = null; - this._pos = savedPos25; + var result121 = null; + this._pos = savedPos23; } - var result126 = result127 !== null - ? (function() { return (arguments[0]); }).apply(this, result127) + var result120 = result121 !== null + ? (function() { return (arguments[0]); }).apply(this, result121) : null; this._cache[cacheKey] = { nextPos: this._pos, - result: result126 + result: result120 }; - return result126; + return result120; }, _parse_rparen: function(context) { @@ -1238,39 +1201,39 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var savedPos26 = this._pos; + var savedPos24 = this._pos; if (this._input.substr(this._pos, 1) === ")") { - var result132 = ")"; + var result126 = ")"; this._pos += 1; } else { - var result132 = null; + var result126 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString(")")); } } - if (result132 !== null) { - var result133 = this._parse___(context); - if (result133 !== null) { - var result131 = [result132, result133]; + if (result126 !== null) { + var result127 = this._parse___(context); + if (result127 !== null) { + var result125 = [result126, result127]; } else { - var result131 = null; - this._pos = savedPos26; + var result125 = null; + this._pos = savedPos24; } } else { - var result131 = null; - this._pos = savedPos26; + var result125 = null; + this._pos = savedPos24; } - var result130 = result131 !== null - ? (function() { return (arguments[0]); }).apply(this, result131) + var result124 = result125 !== null + ? (function() { return (arguments[0]); }).apply(this, result125) : null; this._cache[cacheKey] = { nextPos: this._pos, - result: result130 + result: result124 }; - return result130; + return result124; }, _parse_dot: function(context) { @@ -1284,39 +1247,39 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var savedPos27 = this._pos; + var savedPos25 = this._pos; if (this._input.substr(this._pos, 1) === ".") { - var result136 = "."; + var result130 = "."; this._pos += 1; } else { - var result136 = null; + var result130 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString(".")); } } - if (result136 !== null) { - var result137 = this._parse___(context); - if (result137 !== null) { - var result135 = [result136, result137]; + if (result130 !== null) { + var result131 = this._parse___(context); + if (result131 !== null) { + var result129 = [result130, result131]; } else { - var result135 = null; - this._pos = savedPos27; + var result129 = null; + this._pos = savedPos25; } } else { - var result135 = null; - this._pos = savedPos27; + var result129 = null; + this._pos = savedPos25; } - var result134 = result135 !== null - ? (function() { return (arguments[0]); }).apply(this, result135) + var result128 = result129 !== null + ? (function() { return (arguments[0]); }).apply(this, result129) : null; this._cache[cacheKey] = { nextPos: this._pos, - result: result134 + result: result128 }; - return result134; + return result128; }, _parse_identifier: function(context) { @@ -1331,149 +1294,149 @@ PEG.grammarParser = (function(){ var savedReportMatchFailures = context.reportMatchFailures; context.reportMatchFailures = false; - var savedPos28 = this._pos; - var result150 = this._parse_letter(context); - if (result150 !== null) { - var result140 = result150; + var savedPos26 = this._pos; + var result144 = this._parse_letter(context); + if (result144 !== null) { + var result134 = result144; } else { if (this._input.substr(this._pos, 1) === "_") { - var result149 = "_"; + var result143 = "_"; this._pos += 1; } else { - var result149 = null; + var result143 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("_")); } } - if (result149 !== null) { - var result140 = result149; + if (result143 !== null) { + var result134 = result143; } else { if (this._input.substr(this._pos, 1) === "$") { - var result148 = "$"; + var result142 = "$"; this._pos += 1; } else { - var result148 = null; + var result142 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("$")); } } - if (result148 !== null) { - var result140 = result148; + if (result142 !== null) { + var result134 = result142; } else { - var result140 = null;; + var result134 = null;; }; }; } - if (result140 !== null) { - var result141 = []; - var result147 = this._parse_letter(context); - if (result147 !== null) { - var result143 = result147; + if (result134 !== null) { + var result135 = []; + var result141 = this._parse_letter(context); + if (result141 !== null) { + var result137 = result141; } else { - var result146 = this._parse_digit(context); - if (result146 !== null) { - var result143 = result146; + var result140 = this._parse_digit(context); + if (result140 !== null) { + var result137 = result140; } else { if (this._input.substr(this._pos, 1) === "_") { - var result145 = "_"; + var result139 = "_"; this._pos += 1; } else { - var result145 = null; + var result139 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("_")); } } - if (result145 !== null) { - var result143 = result145; + if (result139 !== null) { + var result137 = result139; } else { if (this._input.substr(this._pos, 1) === "$") { - var result144 = "$"; + var result138 = "$"; this._pos += 1; } else { - var result144 = null; + var result138 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("$")); } } - if (result144 !== null) { - var result143 = result144; + if (result138 !== null) { + var result137 = result138; } else { - var result143 = null;; + var result137 = null;; }; }; }; } - while (result143 !== null) { - result141.push(result143); - var result147 = this._parse_letter(context); - if (result147 !== null) { - var result143 = result147; + while (result137 !== null) { + result135.push(result137); + var result141 = this._parse_letter(context); + if (result141 !== null) { + var result137 = result141; } else { - var result146 = this._parse_digit(context); - if (result146 !== null) { - var result143 = result146; + var result140 = this._parse_digit(context); + if (result140 !== null) { + var result137 = result140; } else { if (this._input.substr(this._pos, 1) === "_") { - var result145 = "_"; + var result139 = "_"; this._pos += 1; } else { - var result145 = null; + var result139 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("_")); } } - if (result145 !== null) { - var result143 = result145; + if (result139 !== null) { + var result137 = result139; } else { if (this._input.substr(this._pos, 1) === "$") { - var result144 = "$"; + var result138 = "$"; this._pos += 1; } else { - var result144 = null; + var result138 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("$")); } } - if (result144 !== null) { - var result143 = result144; + if (result138 !== null) { + var result137 = result138; } else { - var result143 = null;; + var result137 = null;; }; }; }; } } - if (result141 !== null) { - var result142 = this._parse___(context); - if (result142 !== null) { - var result139 = [result140, result141, result142]; + if (result135 !== null) { + var result136 = this._parse___(context); + if (result136 !== null) { + var result133 = [result134, result135, result136]; } else { - var result139 = null; - this._pos = savedPos28; + var result133 = null; + this._pos = savedPos26; } } else { - var result139 = null; - this._pos = savedPos28; + var result133 = null; + this._pos = savedPos26; } } else { - var result139 = null; - this._pos = savedPos28; + var result133 = null; + this._pos = savedPos26; } - var result138 = result139 !== null + var result132 = result133 !== null ? (function() { return (arguments[0]) + (arguments[1]).join(""); - }).apply(this, result139) + }).apply(this, result133) : null; context.reportMatchFailures = savedReportMatchFailures; - if (context.reportMatchFailures && result138 === null) { + if (context.reportMatchFailures && result132 === null) { this._matchFailed("identifier"); } this._cache[cacheKey] = { nextPos: this._pos, - result: result138 + result: result132 }; - return result138; + return result132; }, _parse_literal: function(context) { @@ -1488,43 +1451,43 @@ PEG.grammarParser = (function(){ var savedReportMatchFailures = context.reportMatchFailures; context.reportMatchFailures = false; - var savedPos29 = this._pos; - var result156 = this._parse_doubleQuotedLiteral(context); - if (result156 !== null) { - var result153 = result156; + var savedPos27 = this._pos; + var result150 = this._parse_doubleQuotedLiteral(context); + if (result150 !== null) { + var result147 = result150; } else { - var result155 = this._parse_singleQuotedLiteral(context); - if (result155 !== null) { - var result153 = result155; + var result149 = this._parse_singleQuotedLiteral(context); + if (result149 !== null) { + var result147 = result149; } else { - var result153 = null;; + var result147 = null;; }; } - if (result153 !== null) { - var result154 = this._parse___(context); - if (result154 !== null) { - var result152 = [result153, result154]; + if (result147 !== null) { + var result148 = this._parse___(context); + if (result148 !== null) { + var result146 = [result147, result148]; } else { - var result152 = null; - this._pos = savedPos29; + var result146 = null; + this._pos = savedPos27; } } else { - var result152 = null; - this._pos = savedPos29; + var result146 = null; + this._pos = savedPos27; } - var result151 = result152 !== null - ? (function() { return (arguments[0]); }).apply(this, result152) + var result145 = result146 !== null + ? (function() { return (arguments[0]); }).apply(this, result146) : null; context.reportMatchFailures = savedReportMatchFailures; - if (context.reportMatchFailures && result151 === null) { + if (context.reportMatchFailures && result145 === null) { this._matchFailed("literal"); } this._cache[cacheKey] = { nextPos: this._pos, - result: result151 + result: result145 }; - return result151; + return result145; }, _parse_doubleQuotedLiteral: function(context) { @@ -1538,58 +1501,58 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var savedPos30 = this._pos; + var savedPos28 = this._pos; if (this._input.substr(this._pos, 1) === "\"") { - var result159 = "\""; + var result153 = "\""; this._pos += 1; } else { - var result159 = null; + var result153 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("\"")); } } - if (result159 !== null) { - var result160 = []; - var result162 = this._parse_doubleQuotedCharacter(context); - while (result162 !== null) { - result160.push(result162); - var result162 = this._parse_doubleQuotedCharacter(context); + if (result153 !== null) { + var result154 = []; + var result156 = this._parse_doubleQuotedCharacter(context); + while (result156 !== null) { + result154.push(result156); + var result156 = this._parse_doubleQuotedCharacter(context); } - if (result160 !== null) { + if (result154 !== null) { if (this._input.substr(this._pos, 1) === "\"") { - var result161 = "\""; + var result155 = "\""; this._pos += 1; } else { - var result161 = null; + var result155 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("\"")); } } - if (result161 !== null) { - var result158 = [result159, result160, result161]; + if (result155 !== null) { + var result152 = [result153, result154, result155]; } else { - var result158 = null; - this._pos = savedPos30; + var result152 = null; + this._pos = savedPos28; } } else { - var result158 = null; - this._pos = savedPos30; + var result152 = null; + this._pos = savedPos28; } } else { - var result158 = null; - this._pos = savedPos30; + var result152 = null; + this._pos = savedPos28; } - var result157 = result158 !== null - ? (function() { return (arguments[1]).join(""); }).apply(this, result158) + var result151 = result152 !== null + ? (function() { return (arguments[1]).join(""); }).apply(this, result152) : null; this._cache[cacheKey] = { nextPos: this._pos, - result: result157 + result: result151 }; - return result157; + return result151; }, _parse_doubleQuotedCharacter: function(context) { @@ -1603,31 +1566,31 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var result169 = this._parse_simpleDoubleQuotedCharacter(context); - if (result169 !== null) { - var result163 = result169; + var result163 = this._parse_simpleDoubleQuotedCharacter(context); + if (result163 !== null) { + var result157 = result163; } else { - var result168 = this._parse_simpleEscapeSequence(context); - if (result168 !== null) { - var result163 = result168; + var result162 = this._parse_simpleEscapeSequence(context); + if (result162 !== null) { + var result157 = result162; } else { - var result167 = this._parse_zeroEscapeSequence(context); - if (result167 !== null) { - var result163 = result167; + var result161 = this._parse_zeroEscapeSequence(context); + if (result161 !== null) { + var result157 = result161; } else { - var result166 = this._parse_hexEscapeSequence(context); - if (result166 !== null) { - var result163 = result166; + var result160 = this._parse_hexEscapeSequence(context); + if (result160 !== null) { + var result157 = result160; } else { - var result165 = this._parse_unicodeEscapeSequence(context); - if (result165 !== null) { - var result163 = result165; + var result159 = this._parse_unicodeEscapeSequence(context); + if (result159 !== null) { + var result157 = result159; } else { - var result164 = this._parse_eolEscapeSequence(context); - if (result164 !== null) { - var result163 = result164; + var result158 = this._parse_eolEscapeSequence(context); + if (result158 !== null) { + var result157 = result158; } else { - var result163 = null;; + var result157 = null;; }; }; }; @@ -1639,9 +1602,9 @@ PEG.grammarParser = (function(){ this._cache[cacheKey] = { nextPos: this._pos, - result: result163 + result: result157 }; - return result163; + return result157; }, _parse_simpleDoubleQuotedCharacter: function(context) { @@ -1655,80 +1618,80 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var savedPos31 = this._pos; - var savedPos32 = this._pos; + var savedPos29 = this._pos; + var savedPos30 = this._pos; var savedReportMatchFailuresVar1 = context.reportMatchFailures; context.reportMatchFailures = false; if (this._input.substr(this._pos, 1) === "\"") { - var result177 = "\""; + var result171 = "\""; this._pos += 1; } else { - var result177 = null; + var result171 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("\"")); } } - if (result177 !== null) { - var result174 = result177; + if (result171 !== null) { + var result168 = result171; } else { if (this._input.substr(this._pos, 1) === "\\") { - var result176 = "\\"; + var result170 = "\\"; this._pos += 1; } else { - var result176 = null; + var result170 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("\\")); } } - if (result176 !== null) { - var result174 = result176; + if (result170 !== null) { + var result168 = result170; } else { - var result175 = this._parse_eolChar(context); - if (result175 !== null) { - var result174 = result175; + var result169 = this._parse_eolChar(context); + if (result169 !== null) { + var result168 = result169; } else { - var result174 = null;; + var result168 = null;; }; }; } context.reportMatchFailures = savedReportMatchFailuresVar1; - if (result174 === null) { - var result172 = ''; + if (result168 === null) { + var result166 = ''; } else { - var result172 = null; - this._pos = savedPos32; + var result166 = null; + this._pos = savedPos30; } - if (result172 !== null) { + if (result166 !== null) { if (this._input.length > this._pos) { - var result173 = this._input.charAt(this._pos); + var result167 = this._input.charAt(this._pos); this._pos++; } else { - var result173 = null; + var result167 = null; if (context.reportMatchFailures) { this._matchFailed('any character'); } } - if (result173 !== null) { - var result171 = [result172, result173]; + if (result167 !== null) { + var result165 = [result166, result167]; } else { - var result171 = null; - this._pos = savedPos31; + var result165 = null; + this._pos = savedPos29; } } else { - var result171 = null; - this._pos = savedPos31; + var result165 = null; + this._pos = savedPos29; } - var result170 = result171 !== null - ? (function() { return (arguments[1]); }).apply(this, result171) + var result164 = result165 !== null + ? (function() { return (arguments[1]); }).apply(this, result165) : null; this._cache[cacheKey] = { nextPos: this._pos, - result: result170 + result: result164 }; - return result170; + return result164; }, _parse_singleQuotedLiteral: function(context) { @@ -1742,58 +1705,58 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var savedPos33 = this._pos; + var savedPos31 = this._pos; if (this._input.substr(this._pos, 1) === "'") { - var result180 = "'"; + var result174 = "'"; this._pos += 1; } else { - var result180 = null; + var result174 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("'")); } } - if (result180 !== null) { - var result181 = []; - var result183 = this._parse_singleQuotedCharacter(context); - while (result183 !== null) { - result181.push(result183); - var result183 = this._parse_singleQuotedCharacter(context); + if (result174 !== null) { + var result175 = []; + var result177 = this._parse_singleQuotedCharacter(context); + while (result177 !== null) { + result175.push(result177); + var result177 = this._parse_singleQuotedCharacter(context); } - if (result181 !== null) { + if (result175 !== null) { if (this._input.substr(this._pos, 1) === "'") { - var result182 = "'"; + var result176 = "'"; this._pos += 1; } else { - var result182 = null; + var result176 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("'")); } } - if (result182 !== null) { - var result179 = [result180, result181, result182]; + if (result176 !== null) { + var result173 = [result174, result175, result176]; } else { - var result179 = null; - this._pos = savedPos33; + var result173 = null; + this._pos = savedPos31; } } else { - var result179 = null; - this._pos = savedPos33; + var result173 = null; + this._pos = savedPos31; } } else { - var result179 = null; - this._pos = savedPos33; + var result173 = null; + this._pos = savedPos31; } - var result178 = result179 !== null - ? (function() { return (arguments[1]).join(""); }).apply(this, result179) + var result172 = result173 !== null + ? (function() { return (arguments[1]).join(""); }).apply(this, result173) : null; this._cache[cacheKey] = { nextPos: this._pos, - result: result178 + result: result172 }; - return result178; + return result172; }, _parse_singleQuotedCharacter: function(context) { @@ -1807,31 +1770,31 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var result190 = this._parse_simpleSingleQuotedCharacter(context); - if (result190 !== null) { - var result184 = result190; + var result184 = this._parse_simpleSingleQuotedCharacter(context); + if (result184 !== null) { + var result178 = result184; } else { - var result189 = this._parse_simpleEscapeSequence(context); - if (result189 !== null) { - var result184 = result189; + var result183 = this._parse_simpleEscapeSequence(context); + if (result183 !== null) { + var result178 = result183; } else { - var result188 = this._parse_zeroEscapeSequence(context); - if (result188 !== null) { - var result184 = result188; + var result182 = this._parse_zeroEscapeSequence(context); + if (result182 !== null) { + var result178 = result182; } else { - var result187 = this._parse_hexEscapeSequence(context); - if (result187 !== null) { - var result184 = result187; + var result181 = this._parse_hexEscapeSequence(context); + if (result181 !== null) { + var result178 = result181; } else { - var result186 = this._parse_unicodeEscapeSequence(context); - if (result186 !== null) { - var result184 = result186; + var result180 = this._parse_unicodeEscapeSequence(context); + if (result180 !== null) { + var result178 = result180; } else { - var result185 = this._parse_eolEscapeSequence(context); - if (result185 !== null) { - var result184 = result185; + var result179 = this._parse_eolEscapeSequence(context); + if (result179 !== null) { + var result178 = result179; } else { - var result184 = null;; + var result178 = null;; }; }; }; @@ -1843,9 +1806,9 @@ PEG.grammarParser = (function(){ this._cache[cacheKey] = { nextPos: this._pos, - result: result184 + result: result178 }; - return result184; + return result178; }, _parse_simpleSingleQuotedCharacter: function(context) { @@ -1859,80 +1822,80 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var savedPos34 = this._pos; - var savedPos35 = this._pos; + var savedPos32 = this._pos; + var savedPos33 = this._pos; var savedReportMatchFailuresVar2 = context.reportMatchFailures; context.reportMatchFailures = false; if (this._input.substr(this._pos, 1) === "'") { - var result198 = "'"; + var result192 = "'"; this._pos += 1; } else { - var result198 = null; + var result192 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("'")); } } - if (result198 !== null) { - var result195 = result198; + if (result192 !== null) { + var result189 = result192; } else { if (this._input.substr(this._pos, 1) === "\\") { - var result197 = "\\"; + var result191 = "\\"; this._pos += 1; } else { - var result197 = null; + var result191 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("\\")); } } - if (result197 !== null) { - var result195 = result197; + if (result191 !== null) { + var result189 = result191; } else { - var result196 = this._parse_eolChar(context); - if (result196 !== null) { - var result195 = result196; + var result190 = this._parse_eolChar(context); + if (result190 !== null) { + var result189 = result190; } else { - var result195 = null;; + var result189 = null;; }; }; } context.reportMatchFailures = savedReportMatchFailuresVar2; - if (result195 === null) { - var result193 = ''; + if (result189 === null) { + var result187 = ''; } else { - var result193 = null; - this._pos = savedPos35; + var result187 = null; + this._pos = savedPos33; } - if (result193 !== null) { + if (result187 !== null) { if (this._input.length > this._pos) { - var result194 = this._input.charAt(this._pos); + var result188 = this._input.charAt(this._pos); this._pos++; } else { - var result194 = null; + var result188 = null; if (context.reportMatchFailures) { this._matchFailed('any character'); } } - if (result194 !== null) { - var result192 = [result193, result194]; + if (result188 !== null) { + var result186 = [result187, result188]; } else { - var result192 = null; - this._pos = savedPos34; + var result186 = null; + this._pos = savedPos32; } } else { - var result192 = null; - this._pos = savedPos34; + var result186 = null; + this._pos = savedPos32; } - var result191 = result192 !== null - ? (function() { return (arguments[1]); }).apply(this, result192) + var result185 = result186 !== null + ? (function() { return (arguments[1]); }).apply(this, result186) : null; this._cache[cacheKey] = { nextPos: this._pos, - result: result191 + result: result185 }; - return result191; + return result185; }, _parse_class: function(context) { @@ -1947,120 +1910,120 @@ PEG.grammarParser = (function(){ var savedReportMatchFailures = context.reportMatchFailures; context.reportMatchFailures = false; - var savedPos36 = this._pos; + var savedPos34 = this._pos; if (this._input.substr(this._pos, 1) === "[") { - var result201 = "["; + var result195 = "["; this._pos += 1; } else { - var result201 = null; + var result195 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("[")); } } - if (result201 !== null) { + if (result195 !== null) { if (this._input.substr(this._pos, 1) === "^") { - var result210 = "^"; + var result204 = "^"; this._pos += 1; } else { - var result210 = null; + var result204 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("^")); } } - if (result210 !== null) { - var result202 = result210; + if (result204 !== null) { + var result196 = result204; } else { if (this._input.substr(this._pos, 0) === "") { - var result209 = ""; + var result203 = ""; this._pos += 0; } else { - var result209 = null; + var result203 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("")); } } - if (result209 !== null) { - var result202 = result209; + if (result203 !== null) { + var result196 = result203; } else { - var result202 = null;; + var result196 = null;; }; } - if (result202 !== null) { - var result203 = []; - var result208 = this._parse_classCharacterRange(context); - if (result208 !== null) { - var result206 = result208; + if (result196 !== null) { + var result197 = []; + var result202 = this._parse_classCharacterRange(context); + if (result202 !== null) { + var result200 = result202; } else { - var result207 = this._parse_classCharacter(context); - if (result207 !== null) { - var result206 = result207; + var result201 = this._parse_classCharacter(context); + if (result201 !== null) { + var result200 = result201; } else { - var result206 = null;; + var result200 = null;; }; } - while (result206 !== null) { - result203.push(result206); - var result208 = this._parse_classCharacterRange(context); - if (result208 !== null) { - var result206 = result208; + while (result200 !== null) { + result197.push(result200); + var result202 = this._parse_classCharacterRange(context); + if (result202 !== null) { + var result200 = result202; } else { - var result207 = this._parse_classCharacter(context); - if (result207 !== null) { - var result206 = result207; + var result201 = this._parse_classCharacter(context); + if (result201 !== null) { + var result200 = result201; } else { - var result206 = null;; + var result200 = null;; }; } } - if (result203 !== null) { + if (result197 !== null) { if (this._input.substr(this._pos, 1) === "]") { - var result204 = "]"; + var result198 = "]"; this._pos += 1; } else { - var result204 = null; + var result198 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("]")); } } - if (result204 !== null) { - var result205 = this._parse___(context); - if (result205 !== null) { - var result200 = [result201, result202, result203, result204, result205]; + if (result198 !== null) { + var result199 = this._parse___(context); + if (result199 !== null) { + var result194 = [result195, result196, result197, result198, result199]; } else { - var result200 = null; - this._pos = savedPos36; + var result194 = null; + this._pos = savedPos34; } } else { - var result200 = null; - this._pos = savedPos36; + var result194 = null; + this._pos = savedPos34; } } else { - var result200 = null; - this._pos = savedPos36; + var result194 = null; + this._pos = savedPos34; } } else { - var result200 = null; - this._pos = savedPos36; + var result194 = null; + this._pos = savedPos34; } } else { - var result200 = null; - this._pos = savedPos36; + var result194 = null; + this._pos = savedPos34; } - var result199 = result200 !== null + var result193 = result194 !== null ? (function() { return (arguments[1]) + (arguments[2]).join(""); - }).apply(this, result200) + }).apply(this, result194) : null; context.reportMatchFailures = savedReportMatchFailures; - if (context.reportMatchFailures && result199 === null) { + if (context.reportMatchFailures && result193 === null) { this._matchFailed("character class"); } this._cache[cacheKey] = { nextPos: this._pos, - result: result199 + result: result193 }; - return result199; + return result193; }, _parse_classCharacterRange: function(context) { @@ -2074,35 +2037,35 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var savedPos37 = this._pos; - var result213 = this._parse_bracketDelimitedCharacter(context); - if (result213 !== null) { + var savedPos35 = this._pos; + var result207 = this._parse_bracketDelimitedCharacter(context); + if (result207 !== null) { if (this._input.substr(this._pos, 1) === "-") { - var result214 = "-"; + var result208 = "-"; this._pos += 1; } else { - var result214 = null; + var result208 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("-")); } } - if (result214 !== null) { - var result215 = this._parse_bracketDelimitedCharacter(context); - if (result215 !== null) { - var result212 = [result213, result214, result215]; + if (result208 !== null) { + var result209 = this._parse_bracketDelimitedCharacter(context); + if (result209 !== null) { + var result206 = [result207, result208, result209]; } else { - var result212 = null; - this._pos = savedPos37; + var result206 = null; + this._pos = savedPos35; } } else { - var result212 = null; - this._pos = savedPos37; + var result206 = null; + this._pos = savedPos35; } } else { - var result212 = null; - this._pos = savedPos37; + var result206 = null; + this._pos = savedPos35; } - var result211 = result212 !== null + var result205 = result206 !== null ? (function() { if ((arguments[0]).charCodeAt(0) > (arguments[2]).charCodeAt(0)) { throw new this.SyntaxError( @@ -2117,16 +2080,16 @@ PEG.grammarParser = (function(){ return PEG.RegExpUtils.quoteForClass((arguments[0])) + "-" + PEG.RegExpUtils.quoteForClass((arguments[2])); - }).apply(this, result212) + }).apply(this, result206) : null; this._cache[cacheKey] = { nextPos: this._pos, - result: result211 + result: result205 }; - return result211; + return result205; }, _parse_classCharacter: function(context) { @@ -2140,20 +2103,20 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var result217 = this._parse_bracketDelimitedCharacter(context); - var result216 = result217 !== null + var result211 = this._parse_bracketDelimitedCharacter(context); + var result210 = result211 !== null ? (function() { return PEG.RegExpUtils.quoteForClass((arguments[0])); - }).call(this, result217) + }).call(this, result211) : null; this._cache[cacheKey] = { nextPos: this._pos, - result: result216 + result: result210 }; - return result216; + return result210; }, _parse_bracketDelimitedCharacter: function(context) { @@ -2167,31 +2130,31 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var result224 = this._parse_simpleBracketDelimitedCharacter(context); - if (result224 !== null) { - var result218 = result224; + var result218 = this._parse_simpleBracketDelimitedCharacter(context); + if (result218 !== null) { + var result212 = result218; } else { - var result223 = this._parse_simpleEscapeSequence(context); - if (result223 !== null) { - var result218 = result223; + var result217 = this._parse_simpleEscapeSequence(context); + if (result217 !== null) { + var result212 = result217; } else { - var result222 = this._parse_zeroEscapeSequence(context); - if (result222 !== null) { - var result218 = result222; + var result216 = this._parse_zeroEscapeSequence(context); + if (result216 !== null) { + var result212 = result216; } else { - var result221 = this._parse_hexEscapeSequence(context); - if (result221 !== null) { - var result218 = result221; + var result215 = this._parse_hexEscapeSequence(context); + if (result215 !== null) { + var result212 = result215; } else { - var result220 = this._parse_unicodeEscapeSequence(context); - if (result220 !== null) { - var result218 = result220; + var result214 = this._parse_unicodeEscapeSequence(context); + if (result214 !== null) { + var result212 = result214; } else { - var result219 = this._parse_eolEscapeSequence(context); - if (result219 !== null) { - var result218 = result219; + var result213 = this._parse_eolEscapeSequence(context); + if (result213 !== null) { + var result212 = result213; } else { - var result218 = null;; + var result212 = null;; }; }; }; @@ -2203,9 +2166,9 @@ PEG.grammarParser = (function(){ this._cache[cacheKey] = { nextPos: this._pos, - result: result218 + result: result212 }; - return result218; + return result212; }, _parse_simpleBracketDelimitedCharacter: function(context) { @@ -2219,80 +2182,80 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var savedPos38 = this._pos; - var savedPos39 = this._pos; + var savedPos36 = this._pos; + var savedPos37 = this._pos; var savedReportMatchFailuresVar3 = context.reportMatchFailures; context.reportMatchFailures = false; if (this._input.substr(this._pos, 1) === "]") { - var result232 = "]"; + var result226 = "]"; this._pos += 1; } else { - var result232 = null; + var result226 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("]")); } } - if (result232 !== null) { - var result229 = result232; + if (result226 !== null) { + var result223 = result226; } else { if (this._input.substr(this._pos, 1) === "\\") { - var result231 = "\\"; + var result225 = "\\"; this._pos += 1; } else { - var result231 = null; + var result225 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("\\")); } } - if (result231 !== null) { - var result229 = result231; + if (result225 !== null) { + var result223 = result225; } else { - var result230 = this._parse_eolChar(context); - if (result230 !== null) { - var result229 = result230; + var result224 = this._parse_eolChar(context); + if (result224 !== null) { + var result223 = result224; } else { - var result229 = null;; + var result223 = null;; }; }; } context.reportMatchFailures = savedReportMatchFailuresVar3; - if (result229 === null) { - var result227 = ''; + if (result223 === null) { + var result221 = ''; } else { - var result227 = null; - this._pos = savedPos39; + var result221 = null; + this._pos = savedPos37; } - if (result227 !== null) { + if (result221 !== null) { if (this._input.length > this._pos) { - var result228 = this._input.charAt(this._pos); + var result222 = this._input.charAt(this._pos); this._pos++; } else { - var result228 = null; + var result222 = null; if (context.reportMatchFailures) { this._matchFailed('any character'); } } - if (result228 !== null) { - var result226 = [result227, result228]; + if (result222 !== null) { + var result220 = [result221, result222]; } else { - var result226 = null; - this._pos = savedPos38; + var result220 = null; + this._pos = savedPos36; } } else { - var result226 = null; - this._pos = savedPos38; + var result220 = null; + this._pos = savedPos36; } - var result225 = result226 !== null - ? (function() { return (arguments[1]); }).apply(this, result226) + var result219 = result220 !== null + ? (function() { return (arguments[1]); }).apply(this, result220) : null; this._cache[cacheKey] = { nextPos: this._pos, - result: result225 + result: result219 }; - return result225; + return result219; }, _parse_simpleEscapeSequence: function(context) { @@ -2306,89 +2269,89 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var savedPos40 = this._pos; + var savedPos38 = this._pos; if (this._input.substr(this._pos, 1) === "\\") { - var result235 = "\\"; + var result229 = "\\"; this._pos += 1; } else { - var result235 = null; + var result229 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("\\")); } } - if (result235 !== null) { - var savedPos41 = this._pos; + if (result229 !== null) { + var savedPos39 = this._pos; var savedReportMatchFailuresVar4 = context.reportMatchFailures; context.reportMatchFailures = false; - var result242 = this._parse_digit(context); - if (result242 !== null) { - var result238 = result242; + var result236 = this._parse_digit(context); + if (result236 !== null) { + var result232 = result236; } else { if (this._input.substr(this._pos, 1) === "x") { - var result241 = "x"; + var result235 = "x"; this._pos += 1; } else { - var result241 = null; + var result235 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("x")); } } - if (result241 !== null) { - var result238 = result241; + if (result235 !== null) { + var result232 = result235; } else { if (this._input.substr(this._pos, 1) === "u") { - var result240 = "u"; + var result234 = "u"; this._pos += 1; } else { - var result240 = null; + var result234 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("u")); } } - if (result240 !== null) { - var result238 = result240; + if (result234 !== null) { + var result232 = result234; } else { - var result239 = this._parse_eolChar(context); - if (result239 !== null) { - var result238 = result239; + var result233 = this._parse_eolChar(context); + if (result233 !== null) { + var result232 = result233; } else { - var result238 = null;; + var result232 = null;; }; }; }; } context.reportMatchFailures = savedReportMatchFailuresVar4; - if (result238 === null) { - var result236 = ''; + if (result232 === null) { + var result230 = ''; } else { - var result236 = null; - this._pos = savedPos41; + var result230 = null; + this._pos = savedPos39; } - if (result236 !== null) { + if (result230 !== null) { if (this._input.length > this._pos) { - var result237 = this._input.charAt(this._pos); + var result231 = this._input.charAt(this._pos); this._pos++; } else { - var result237 = null; + var result231 = null; if (context.reportMatchFailures) { this._matchFailed('any character'); } } - if (result237 !== null) { - var result234 = [result235, result236, result237]; + if (result231 !== null) { + var result228 = [result229, result230, result231]; } else { - var result234 = null; - this._pos = savedPos40; + var result228 = null; + this._pos = savedPos38; } } else { - var result234 = null; - this._pos = savedPos40; + var result228 = null; + this._pos = savedPos38; } } else { - var result234 = null; - this._pos = savedPos40; + var result228 = null; + this._pos = savedPos38; } - var result233 = result234 !== null + var result227 = result228 !== null ? (function() { return (arguments[2]) .replace("b", "\b") @@ -2397,16 +2360,16 @@ PEG.grammarParser = (function(){ .replace("r", "\r") .replace("t", "\t") .replace("v", "\x0B") // IE does not recognize "\v". - }).apply(this, result234) + }).apply(this, result228) : null; this._cache[cacheKey] = { nextPos: this._pos, - result: result233 + result: result227 }; - return result233; + return result227; }, _parse_zeroEscapeSequence: function(context) { @@ -2420,49 +2383,49 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var savedPos42 = this._pos; + var savedPos40 = this._pos; if (this._input.substr(this._pos, 2) === "\\0") { - var result245 = "\\0"; + var result239 = "\\0"; this._pos += 2; } else { - var result245 = null; + var result239 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("\\0")); } } - if (result245 !== null) { - var savedPos43 = this._pos; + if (result239 !== null) { + var savedPos41 = this._pos; var savedReportMatchFailuresVar5 = context.reportMatchFailures; context.reportMatchFailures = false; - var result247 = this._parse_digit(context); + var result241 = this._parse_digit(context); context.reportMatchFailures = savedReportMatchFailuresVar5; - if (result247 === null) { - var result246 = ''; + if (result241 === null) { + var result240 = ''; } else { - var result246 = null; - this._pos = savedPos43; + var result240 = null; + this._pos = savedPos41; } - if (result246 !== null) { - var result244 = [result245, result246]; + if (result240 !== null) { + var result238 = [result239, result240]; } else { - var result244 = null; - this._pos = savedPos42; + var result238 = null; + this._pos = savedPos40; } } else { - var result244 = null; - this._pos = savedPos42; + var result238 = null; + this._pos = savedPos40; } - var result243 = result244 !== null - ? (function() { return "\0"; }).apply(this, result244) + var result237 = result238 !== null + ? (function() { return "\0"; }).apply(this, result238) : null; this._cache[cacheKey] = { nextPos: this._pos, - result: result243 + result: result237 }; - return result243; + return result237; }, _parse_hexEscapeSequence: function(context) { @@ -2476,47 +2439,47 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var savedPos44 = this._pos; + var savedPos42 = this._pos; if (this._input.substr(this._pos, 2) === "\\x") { - var result250 = "\\x"; + var result244 = "\\x"; this._pos += 2; } else { - var result250 = null; + var result244 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("\\x")); } } - if (result250 !== null) { - var result251 = this._parse_hexDigit(context); - if (result251 !== null) { - var result252 = this._parse_hexDigit(context); - if (result252 !== null) { - var result249 = [result250, result251, result252]; + if (result244 !== null) { + var result245 = this._parse_hexDigit(context); + if (result245 !== null) { + var result246 = this._parse_hexDigit(context); + if (result246 !== null) { + var result243 = [result244, result245, result246]; } else { - var result249 = null; - this._pos = savedPos44; + var result243 = null; + this._pos = savedPos42; } } else { - var result249 = null; - this._pos = savedPos44; + var result243 = null; + this._pos = savedPos42; } } else { - var result249 = null; - this._pos = savedPos44; + var result243 = null; + this._pos = savedPos42; } - var result248 = result249 !== null + var result242 = result243 !== null ? (function() { return String.fromCharCode(parseInt("0x" + (arguments[1]) + (arguments[2]))); - }).apply(this, result249) + }).apply(this, result243) : null; this._cache[cacheKey] = { nextPos: this._pos, - result: result248 + result: result242 }; - return result248; + return result242; }, _parse_unicodeEscapeSequence: function(context) { @@ -2530,59 +2493,59 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var savedPos45 = this._pos; + var savedPos43 = this._pos; if (this._input.substr(this._pos, 2) === "\\u") { - var result255 = "\\u"; + var result249 = "\\u"; this._pos += 2; } else { - var result255 = null; + var result249 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("\\u")); } } - if (result255 !== null) { - var result256 = this._parse_hexDigit(context); - if (result256 !== null) { - var result257 = this._parse_hexDigit(context); - if (result257 !== null) { - var result258 = this._parse_hexDigit(context); - if (result258 !== null) { - var result259 = this._parse_hexDigit(context); - if (result259 !== null) { - var result254 = [result255, result256, result257, result258, result259]; + if (result249 !== null) { + var result250 = this._parse_hexDigit(context); + if (result250 !== null) { + var result251 = this._parse_hexDigit(context); + if (result251 !== null) { + var result252 = this._parse_hexDigit(context); + if (result252 !== null) { + var result253 = this._parse_hexDigit(context); + if (result253 !== null) { + var result248 = [result249, result250, result251, result252, result253]; } else { - var result254 = null; - this._pos = savedPos45; + var result248 = null; + this._pos = savedPos43; } } else { - var result254 = null; - this._pos = savedPos45; + var result248 = null; + this._pos = savedPos43; } } else { - var result254 = null; - this._pos = savedPos45; + var result248 = null; + this._pos = savedPos43; } } else { - var result254 = null; - this._pos = savedPos45; + var result248 = null; + this._pos = savedPos43; } } else { - var result254 = null; - this._pos = savedPos45; + var result248 = null; + this._pos = savedPos43; } - var result253 = result254 !== null + var result247 = result248 !== null ? (function() { return String.fromCharCode(parseInt("0x" + (arguments[1]) + (arguments[2]) + (arguments[3]) + (arguments[4]))); - }).apply(this, result254) + }).apply(this, result248) : null; this._cache[cacheKey] = { nextPos: this._pos, - result: result253 + result: result247 }; - return result253; + return result247; }, _parse_eolEscapeSequence: function(context) { @@ -2596,39 +2559,39 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var savedPos46 = this._pos; + var savedPos44 = this._pos; if (this._input.substr(this._pos, 1) === "\\") { - var result262 = "\\"; + var result256 = "\\"; this._pos += 1; } else { - var result262 = null; + var result256 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("\\")); } } - if (result262 !== null) { - var result263 = this._parse_eol(context); - if (result263 !== null) { - var result261 = [result262, result263]; + if (result256 !== null) { + var result257 = this._parse_eol(context); + if (result257 !== null) { + var result255 = [result256, result257]; } else { - var result261 = null; - this._pos = savedPos46; + var result255 = null; + this._pos = savedPos44; } } else { - var result261 = null; - this._pos = savedPos46; + var result255 = null; + this._pos = savedPos44; } - var result260 = result261 !== null - ? (function() { return (arguments[1]); }).apply(this, result261) + var result254 = result255 !== null + ? (function() { return (arguments[1]); }).apply(this, result255) : null; this._cache[cacheKey] = { nextPos: this._pos, - result: result260 + result: result254 }; - return result260; + return result254; }, _parse_digit: function(context) { @@ -2643,10 +2606,10 @@ PEG.grammarParser = (function(){ if (this._input.substr(this._pos).match(/^[0-9]/) !== null) { - var result264 = this._input.charAt(this._pos); + var result258 = this._input.charAt(this._pos); this._pos++; } else { - var result264 = null; + var result258 = null; if (context.reportMatchFailures) { this._matchFailed('[' + "0-9" + ']'); } @@ -2656,9 +2619,9 @@ PEG.grammarParser = (function(){ this._cache[cacheKey] = { nextPos: this._pos, - result: result264 + result: result258 }; - return result264; + return result258; }, _parse_hexDigit: function(context) { @@ -2673,10 +2636,10 @@ PEG.grammarParser = (function(){ if (this._input.substr(this._pos).match(/^[0-9a-fA-F]/) !== null) { - var result265 = this._input.charAt(this._pos); + var result259 = this._input.charAt(this._pos); this._pos++; } else { - var result265 = null; + var result259 = null; if (context.reportMatchFailures) { this._matchFailed('[' + "0-9a-fA-F" + ']'); } @@ -2686,9 +2649,9 @@ PEG.grammarParser = (function(){ this._cache[cacheKey] = { nextPos: this._pos, - result: result265 + result: result259 }; - return result265; + return result259; }, _parse_letter: function(context) { @@ -2702,15 +2665,15 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var result268 = this._parse_lowerCaseLetter(context); - if (result268 !== null) { - var result266 = result268; + var result262 = this._parse_lowerCaseLetter(context); + if (result262 !== null) { + var result260 = result262; } else { - var result267 = this._parse_upperCaseLetter(context); - if (result267 !== null) { - var result266 = result267; + var result261 = this._parse_upperCaseLetter(context); + if (result261 !== null) { + var result260 = result261; } else { - var result266 = null;; + var result260 = null;; }; } @@ -2718,9 +2681,9 @@ PEG.grammarParser = (function(){ this._cache[cacheKey] = { nextPos: this._pos, - result: result266 + result: result260 }; - return result266; + return result260; }, _parse_lowerCaseLetter: function(context) { @@ -2735,10 +2698,10 @@ PEG.grammarParser = (function(){ if (this._input.substr(this._pos).match(/^[a-z]/) !== null) { - var result269 = this._input.charAt(this._pos); + var result263 = this._input.charAt(this._pos); this._pos++; } else { - var result269 = null; + var result263 = null; if (context.reportMatchFailures) { this._matchFailed('[' + "a-z" + ']'); } @@ -2748,9 +2711,9 @@ PEG.grammarParser = (function(){ this._cache[cacheKey] = { nextPos: this._pos, - result: result269 + result: result263 }; - return result269; + return result263; }, _parse_upperCaseLetter: function(context) { @@ -2765,10 +2728,10 @@ PEG.grammarParser = (function(){ if (this._input.substr(this._pos).match(/^[A-Z]/) !== null) { - var result270 = this._input.charAt(this._pos); + var result264 = this._input.charAt(this._pos); this._pos++; } else { - var result270 = null; + var result264 = null; if (context.reportMatchFailures) { this._matchFailed('[' + "A-Z" + ']'); } @@ -2778,9 +2741,9 @@ PEG.grammarParser = (function(){ this._cache[cacheKey] = { nextPos: this._pos, - result: result270 + result: result264 }; - return result270; + return result264; }, _parse___: function(context) { @@ -2794,38 +2757,38 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var result271 = []; - var result275 = this._parse_whitespace(context); - if (result275 !== null) { - var result272 = result275; + var result265 = []; + var result269 = this._parse_whitespace(context); + if (result269 !== null) { + var result266 = result269; } else { - var result274 = this._parse_eol(context); - if (result274 !== null) { - var result272 = result274; + var result268 = this._parse_eol(context); + if (result268 !== null) { + var result266 = result268; } else { - var result273 = this._parse_comment(context); - if (result273 !== null) { - var result272 = result273; + var result267 = this._parse_comment(context); + if (result267 !== null) { + var result266 = result267; } else { - var result272 = null;; + var result266 = null;; }; }; } - while (result272 !== null) { - result271.push(result272); - var result275 = this._parse_whitespace(context); - if (result275 !== null) { - var result272 = result275; + while (result266 !== null) { + result265.push(result266); + var result269 = this._parse_whitespace(context); + if (result269 !== null) { + var result266 = result269; } else { - var result274 = this._parse_eol(context); - if (result274 !== null) { - var result272 = result274; + var result268 = this._parse_eol(context); + if (result268 !== null) { + var result266 = result268; } else { - var result273 = this._parse_comment(context); - if (result273 !== null) { - var result272 = result273; + var result267 = this._parse_comment(context); + if (result267 !== null) { + var result266 = result267; } else { - var result272 = null;; + var result266 = null;; }; }; } @@ -2835,9 +2798,9 @@ PEG.grammarParser = (function(){ this._cache[cacheKey] = { nextPos: this._pos, - result: result271 + result: result265 }; - return result271; + return result265; }, _parse_comment: function(context) { @@ -2852,27 +2815,27 @@ PEG.grammarParser = (function(){ var savedReportMatchFailures = context.reportMatchFailures; context.reportMatchFailures = false; - var result278 = this._parse_singleLineComment(context); - if (result278 !== null) { - var result276 = result278; + var result272 = this._parse_singleLineComment(context); + if (result272 !== null) { + var result270 = result272; } else { - var result277 = this._parse_multiLineComment(context); - if (result277 !== null) { - var result276 = result277; + var result271 = this._parse_multiLineComment(context); + if (result271 !== null) { + var result270 = result271; } else { - var result276 = null;; + var result270 = null;; }; } context.reportMatchFailures = savedReportMatchFailures; - if (context.reportMatchFailures && result276 === null) { + if (context.reportMatchFailures && result270 === null) { this._matchFailed("comment"); } this._cache[cacheKey] = { nextPos: this._pos, - result: result276 + result: result270 }; - return result276; + return result270; }, _parse_singleLineComment: function(context) { @@ -2886,103 +2849,103 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var savedPos47 = this._pos; + var savedPos45 = this._pos; if (this._input.substr(this._pos, 2) === "//") { - var result280 = "//"; + var result274 = "//"; this._pos += 2; } else { - var result280 = null; + var result274 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("//")); } } - if (result280 !== null) { - var result281 = []; - var savedPos48 = this._pos; - var savedPos49 = this._pos; + if (result274 !== null) { + var result275 = []; + var savedPos46 = this._pos; + var savedPos47 = this._pos; var savedReportMatchFailuresVar6 = context.reportMatchFailures; context.reportMatchFailures = false; - var result285 = this._parse_eolChar(context); + var result279 = this._parse_eolChar(context); context.reportMatchFailures = savedReportMatchFailuresVar6; - if (result285 === null) { - var result283 = ''; + if (result279 === null) { + var result277 = ''; } else { - var result283 = null; - this._pos = savedPos49; + var result277 = null; + this._pos = savedPos47; } - if (result283 !== null) { + if (result277 !== null) { if (this._input.length > this._pos) { - var result284 = this._input.charAt(this._pos); + var result278 = this._input.charAt(this._pos); this._pos++; } else { - var result284 = null; + var result278 = null; if (context.reportMatchFailures) { this._matchFailed('any character'); } } - if (result284 !== null) { - var result282 = [result283, result284]; + if (result278 !== null) { + var result276 = [result277, result278]; } else { - var result282 = null; - this._pos = savedPos48; + var result276 = null; + this._pos = savedPos46; } } else { - var result282 = null; - this._pos = savedPos48; + var result276 = null; + this._pos = savedPos46; } - while (result282 !== null) { - result281.push(result282); - var savedPos48 = this._pos; - var savedPos49 = this._pos; + while (result276 !== null) { + result275.push(result276); + var savedPos46 = this._pos; + var savedPos47 = this._pos; var savedReportMatchFailuresVar6 = context.reportMatchFailures; context.reportMatchFailures = false; - var result285 = this._parse_eolChar(context); + var result279 = this._parse_eolChar(context); context.reportMatchFailures = savedReportMatchFailuresVar6; - if (result285 === null) { - var result283 = ''; + if (result279 === null) { + var result277 = ''; } else { - var result283 = null; - this._pos = savedPos49; + var result277 = null; + this._pos = savedPos47; } - if (result283 !== null) { + if (result277 !== null) { if (this._input.length > this._pos) { - var result284 = this._input.charAt(this._pos); + var result278 = this._input.charAt(this._pos); this._pos++; } else { - var result284 = null; + var result278 = null; if (context.reportMatchFailures) { this._matchFailed('any character'); } } - if (result284 !== null) { - var result282 = [result283, result284]; + if (result278 !== null) { + var result276 = [result277, result278]; } else { - var result282 = null; - this._pos = savedPos48; + var result276 = null; + this._pos = savedPos46; } } else { - var result282 = null; - this._pos = savedPos48; + var result276 = null; + this._pos = savedPos46; } } - if (result281 !== null) { - var result279 = [result280, result281]; + if (result275 !== null) { + var result273 = [result274, result275]; } else { - var result279 = null; - this._pos = savedPos47; + var result273 = null; + this._pos = savedPos45; } } else { - var result279 = null; - this._pos = savedPos47; + var result273 = null; + this._pos = savedPos45; } this._cache[cacheKey] = { nextPos: this._pos, - result: result279 + result: result273 }; - return result279; + return result273; }, _parse_multiLineComment: function(context) { @@ -2996,133 +2959,133 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var savedPos50 = this._pos; + var savedPos48 = this._pos; if (this._input.substr(this._pos, 2) === "/*") { - var result287 = "/*"; + var result281 = "/*"; this._pos += 2; } else { - var result287 = null; + var result281 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("/*")); } } - if (result287 !== null) { - var result288 = []; - var savedPos51 = this._pos; - var savedPos52 = this._pos; + if (result281 !== null) { + var result282 = []; + var savedPos49 = this._pos; + var savedPos50 = this._pos; var savedReportMatchFailuresVar7 = context.reportMatchFailures; context.reportMatchFailures = false; if (this._input.substr(this._pos, 2) === "*/") { - var result293 = "*/"; + var result287 = "*/"; this._pos += 2; } else { - var result293 = null; + var result287 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("*/")); } } context.reportMatchFailures = savedReportMatchFailuresVar7; - if (result293 === null) { - var result291 = ''; + if (result287 === null) { + var result285 = ''; } else { - var result291 = null; - this._pos = savedPos52; + var result285 = null; + this._pos = savedPos50; } - if (result291 !== null) { + if (result285 !== null) { if (this._input.length > this._pos) { - var result292 = this._input.charAt(this._pos); + var result286 = this._input.charAt(this._pos); this._pos++; } else { - var result292 = null; + var result286 = null; if (context.reportMatchFailures) { this._matchFailed('any character'); } } - if (result292 !== null) { - var result290 = [result291, result292]; + if (result286 !== null) { + var result284 = [result285, result286]; } else { - var result290 = null; - this._pos = savedPos51; + var result284 = null; + this._pos = savedPos49; } } else { - var result290 = null; - this._pos = savedPos51; + var result284 = null; + this._pos = savedPos49; } - while (result290 !== null) { - result288.push(result290); - var savedPos51 = this._pos; - var savedPos52 = this._pos; + while (result284 !== null) { + result282.push(result284); + var savedPos49 = this._pos; + var savedPos50 = this._pos; var savedReportMatchFailuresVar7 = context.reportMatchFailures; context.reportMatchFailures = false; if (this._input.substr(this._pos, 2) === "*/") { - var result293 = "*/"; + var result287 = "*/"; this._pos += 2; } else { - var result293 = null; + var result287 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("*/")); } } context.reportMatchFailures = savedReportMatchFailuresVar7; - if (result293 === null) { - var result291 = ''; + if (result287 === null) { + var result285 = ''; } else { - var result291 = null; - this._pos = savedPos52; + var result285 = null; + this._pos = savedPos50; } - if (result291 !== null) { + if (result285 !== null) { if (this._input.length > this._pos) { - var result292 = this._input.charAt(this._pos); + var result286 = this._input.charAt(this._pos); this._pos++; } else { - var result292 = null; + var result286 = null; if (context.reportMatchFailures) { this._matchFailed('any character'); } } - if (result292 !== null) { - var result290 = [result291, result292]; + if (result286 !== null) { + var result284 = [result285, result286]; } else { - var result290 = null; - this._pos = savedPos51; + var result284 = null; + this._pos = savedPos49; } } else { - var result290 = null; - this._pos = savedPos51; + var result284 = null; + this._pos = savedPos49; } } - if (result288 !== null) { + if (result282 !== null) { if (this._input.substr(this._pos, 2) === "*/") { - var result289 = "*/"; + var result283 = "*/"; this._pos += 2; } else { - var result289 = null; + var result283 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("*/")); } } - if (result289 !== null) { - var result286 = [result287, result288, result289]; + if (result283 !== null) { + var result280 = [result281, result282, result283]; } else { - var result286 = null; - this._pos = savedPos50; + var result280 = null; + this._pos = savedPos48; } } else { - var result286 = null; - this._pos = savedPos50; + var result280 = null; + this._pos = savedPos48; } } else { - var result286 = null; - this._pos = savedPos50; + var result280 = null; + this._pos = savedPos48; } this._cache[cacheKey] = { nextPos: this._pos, - result: result286 + result: result280 }; - return result286; + return result280; }, _parse_eol: function(context) { @@ -3138,81 +3101,81 @@ PEG.grammarParser = (function(){ var savedReportMatchFailures = context.reportMatchFailures; context.reportMatchFailures = false; if (this._input.substr(this._pos, 1) === "\n") { - var result299 = "\n"; + var result293 = "\n"; this._pos += 1; } else { - var result299 = null; + var result293 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("\n")); } } - if (result299 !== null) { - var result294 = result299; + if (result293 !== null) { + var result288 = result293; } else { if (this._input.substr(this._pos, 2) === "\r\n") { - var result298 = "\r\n"; + var result292 = "\r\n"; this._pos += 2; } else { - var result298 = null; + var result292 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("\r\n")); } } - if (result298 !== null) { - var result294 = result298; + if (result292 !== null) { + var result288 = result292; } else { if (this._input.substr(this._pos, 1) === "\r") { - var result297 = "\r"; + var result291 = "\r"; this._pos += 1; } else { - var result297 = null; + var result291 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("\r")); } } - if (result297 !== null) { - var result294 = result297; + if (result291 !== null) { + var result288 = result291; } else { if (this._input.substr(this._pos, 1) === "\u2028") { - var result296 = "\u2028"; + var result290 = "\u2028"; this._pos += 1; } else { - var result296 = null; + var result290 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("\u2028")); } } - if (result296 !== null) { - var result294 = result296; + if (result290 !== null) { + var result288 = result290; } else { if (this._input.substr(this._pos, 1) === "\u2029") { - var result295 = "\u2029"; + var result289 = "\u2029"; this._pos += 1; } else { - var result295 = null; + var result289 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("\u2029")); } } - if (result295 !== null) { - var result294 = result295; + if (result289 !== null) { + var result288 = result289; } else { - var result294 = null;; + var result288 = null;; }; }; }; }; } context.reportMatchFailures = savedReportMatchFailures; - if (context.reportMatchFailures && result294 === null) { + if (context.reportMatchFailures && result288 === null) { this._matchFailed("end of line"); } this._cache[cacheKey] = { nextPos: this._pos, - result: result294 + result: result288 }; - return result294; + return result288; }, _parse_eolChar: function(context) { @@ -3227,10 +3190,10 @@ PEG.grammarParser = (function(){ if (this._input.substr(this._pos).match(/^[\n\r\u2028\u2029]/) !== null) { - var result300 = this._input.charAt(this._pos); + var result294 = this._input.charAt(this._pos); this._pos++; } else { - var result300 = null; + var result294 = null; if (context.reportMatchFailures) { this._matchFailed('[' + "\\n\\r\\u2028\\u2029" + ']'); } @@ -3240,9 +3203,9 @@ PEG.grammarParser = (function(){ this._cache[cacheKey] = { nextPos: this._pos, - result: result300 + result: result294 }; - return result300; + return result294; }, _parse_whitespace: function(context) { @@ -3258,24 +3221,24 @@ PEG.grammarParser = (function(){ var savedReportMatchFailures = context.reportMatchFailures; context.reportMatchFailures = false; if (this._input.substr(this._pos).match(/^[   ᠎ -    ]/) !== null) { - var result301 = this._input.charAt(this._pos); + var result295 = this._input.charAt(this._pos); this._pos++; } else { - var result301 = null; + var result295 = null; if (context.reportMatchFailures) { this._matchFailed('[' + "   ᠎ -    " + ']'); } } context.reportMatchFailures = savedReportMatchFailures; - if (context.reportMatchFailures && result301 === null) { + if (context.reportMatchFailures && result295 === null) { this._matchFailed("whitespace"); } this._cache[cacheKey] = { nextPos: this._pos, - result: result301 + result: result295 }; - return result301; + return result295; }, /* diff --git a/lib/metagrammar.pegjs b/lib/metagrammar.pegjs index 147d86c..ae5eea4 100644 --- a/lib/metagrammar.pegjs +++ b/lib/metagrammar.pegjs @@ -40,12 +40,7 @@ suffixed return new PEG.Grammar.Choice([$1, new PEG.Grammar.Literal("")]); } / primary star { return new PEG.Grammar.ZeroOrMore($1); } - / primary plus { - return new PEG.Grammar.Action( - new PEG.Grammar.Sequence([$1, new PEG.Grammar.ZeroOrMore($1)]), - function(first, rest) { return [first].concat(rest); } - ); - } + / primary plus { return new PEG.Grammar.OneOrMore($1); } / primary primary diff --git a/test/compiler-test.js b/test/compiler-test.js index dc7d488..bbeb0b7 100644 --- a/test/compiler-test.js +++ b/test/compiler-test.js @@ -192,6 +192,7 @@ test("buildParser reports missing referenced rules", function() { 'start: missing / "a" / "b"', 'start: "a" / "b" / missing', 'start: missing*', + 'start: missing+', 'start: !missing', 'start: &missing', 'start: missing { }' @@ -214,6 +215,7 @@ test("buildParser reports left recursion", function() { 'start: start / "a" / "b"', 'start: "a" / "b" / start', 'start: start*', + 'start: start+', 'start: !start', 'start: &start', 'start: start { }', diff --git a/test/metagrammar-test.js b/test/metagrammar-test.js index 4783f5f..9715799 100644 --- a/test/metagrammar-test.js +++ b/test/metagrammar-test.js @@ -149,13 +149,7 @@ with (PEG.Grammar) { test("parses suffixed", function() { grammarParserParses('start: "abcd"?', oneRuleGrammar(choice)); grammarParserParses('start: "abcd"*', oneRuleGrammar(new ZeroOrMore(literalAbcd))); - grammarParserParses( - 'start: "abcd"+', - oneRuleGrammar(new Action( - new Sequence([literalAbcd, new ZeroOrMore(literalAbcd)]), - function(first, rest) { return [first].concat(rest); } - )) - ); + grammarParserParses('start: "abcd"+', oneRuleGrammar(new OneOrMore(literalAbcd))); grammarParserParses('start: "abcd"', literalGrammar("abcd")); });