diff --git a/lib/metagrammar.js b/lib/metagrammar.js index ad63540..211bbcd 100644 --- a/lib/metagrammar.js +++ b/lib/metagrammar.js @@ -792,66 +792,17 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var savedPos18 = this._pos; - var savedPos19 = this._pos; - var savedReportMatchFailuresVar1 = context.reportMatchFailures; - context.reportMatchFailures = false; - if (this._input.substr(this._pos, 1) === "{") { - var result102 = "{"; - this._pos += 1; + if (this._input.substr(this._pos).match(/^[^{}]/) !== null) { + var result97 = this._input[this._pos]; + this._pos++; } else { - var result102 = null; + var result97 = null; if (context.reportMatchFailures) { - this._matchFailed(new PEG.Parser.LiteralMatchFailure("{")); - } - } - if (result102 !== null) { - var result100 = result102; - } else { - if (this._input.substr(this._pos, 1) === "}") { - var result101 = "}"; - this._pos += 1; - } else { - var result101 = null; - if (context.reportMatchFailures) { - this._matchFailed(new PEG.Parser.LiteralMatchFailure("}")); - } - } - if (result101 !== null) { - var result100 = result101; - } else { - var result100 = null;; - }; - } - context.reportMatchFailures = savedReportMatchFailuresVar1; - if (result100 === null) { - var result98 = ''; - } else { - var result98 = null; - this._pos = savedPos19; - } - if (result98 !== null) { - if (this._input.length > this._pos) { - var result99 = this._input[this._pos]; - this._pos++; - } else { - var result99 = null; - if (context.reportMatchFailures) { - this._matchFailed(new PEG.Parser.AnyMatchFailure()); - } - } - if (result99 !== null) { - var result97 = [result98, result99]; - } else { - var result97 = null; - this._pos = savedPos18; + this._matchFailed(new PEG.Parser.ClassMatchFailure("^{}")); } - } else { - var result97 = null; - this._pos = savedPos18; } var result96 = result97 !== null - ? (function() { return (arguments[1]); }).apply(this, result97) + ? (function() { return (arguments[0]); }).call(this, result97) : null; @@ -874,39 +825,39 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var savedPos20 = this._pos; + var savedPos18 = this._pos; if (this._input.substr(this._pos, 1) === ":") { - var result105 = ":"; + var result100 = ":"; this._pos += 1; } else { - var result105 = null; + var result100 = null; if (context.reportMatchFailures) { this._matchFailed(new PEG.Parser.LiteralMatchFailure(":")); } } - if (result105 !== null) { - var result106 = this._parse___(context); - if (result106 !== null) { - var result104 = [result105, result106]; + if (result100 !== null) { + var result101 = this._parse___(context); + if (result101 !== null) { + var result99 = [result100, result101]; } else { - var result104 = null; - this._pos = savedPos20; + var result99 = null; + this._pos = savedPos18; } } else { - var result104 = null; - this._pos = savedPos20; + var result99 = null; + this._pos = savedPos18; } - var result103 = result104 !== null - ? (function() { return (arguments[0]); }).apply(this, result104) + var result98 = result99 !== null + ? (function() { return (arguments[0]); }).apply(this, result99) : null; this._cache["colon"][pos] = { nextPos: this._pos, - result: result103 + result: result98 }; - return result103; + return result98; }; result._parse_slash = function(context) { @@ -920,39 +871,39 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var savedPos21 = this._pos; + var savedPos19 = this._pos; if (this._input.substr(this._pos, 1) === "/") { - var result109 = "/"; + var result104 = "/"; this._pos += 1; } else { - var result109 = null; + var result104 = null; if (context.reportMatchFailures) { this._matchFailed(new PEG.Parser.LiteralMatchFailure("/")); } } - if (result109 !== null) { - var result110 = this._parse___(context); - if (result110 !== null) { - var result108 = [result109, result110]; + if (result104 !== null) { + var result105 = this._parse___(context); + if (result105 !== null) { + var result103 = [result104, result105]; } else { - var result108 = null; - this._pos = savedPos21; + var result103 = null; + this._pos = savedPos19; } } else { - var result108 = null; - this._pos = savedPos21; + var result103 = null; + this._pos = savedPos19; } - var result107 = result108 !== null - ? (function() { return (arguments[0]); }).apply(this, result108) + var result102 = result103 !== null + ? (function() { return (arguments[0]); }).apply(this, result103) : null; this._cache["slash"][pos] = { nextPos: this._pos, - result: result107 + result: result102 }; - return result107; + return result102; }; result._parse_and = function(context) { @@ -966,39 +917,39 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var savedPos22 = this._pos; + var savedPos20 = this._pos; if (this._input.substr(this._pos, 1) === "&") { - var result113 = "&"; + var result108 = "&"; this._pos += 1; } else { - var result113 = null; + var result108 = null; if (context.reportMatchFailures) { this._matchFailed(new PEG.Parser.LiteralMatchFailure("&")); } } - if (result113 !== null) { - var result114 = this._parse___(context); - if (result114 !== null) { - var result112 = [result113, result114]; + if (result108 !== null) { + var result109 = this._parse___(context); + if (result109 !== null) { + var result107 = [result108, result109]; } else { - var result112 = null; - this._pos = savedPos22; + var result107 = null; + this._pos = savedPos20; } } else { - var result112 = null; - this._pos = savedPos22; + var result107 = null; + this._pos = savedPos20; } - var result111 = result112 !== null - ? (function() { return (arguments[0]); }).apply(this, result112) + var result106 = result107 !== null + ? (function() { return (arguments[0]); }).apply(this, result107) : null; this._cache["and"][pos] = { nextPos: this._pos, - result: result111 + result: result106 }; - return result111; + return result106; }; result._parse_not = function(context) { @@ -1012,39 +963,39 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var savedPos23 = this._pos; + var savedPos21 = this._pos; if (this._input.substr(this._pos, 1) === "!") { - var result117 = "!"; + var result112 = "!"; this._pos += 1; } else { - var result117 = null; + var result112 = null; if (context.reportMatchFailures) { this._matchFailed(new PEG.Parser.LiteralMatchFailure("!")); } } - if (result117 !== null) { - var result118 = this._parse___(context); - if (result118 !== null) { - var result116 = [result117, result118]; + if (result112 !== null) { + var result113 = this._parse___(context); + if (result113 !== null) { + var result111 = [result112, result113]; } else { - var result116 = null; - this._pos = savedPos23; + var result111 = null; + this._pos = savedPos21; } } else { - var result116 = null; - this._pos = savedPos23; + var result111 = null; + this._pos = savedPos21; } - var result115 = result116 !== null - ? (function() { return (arguments[0]); }).apply(this, result116) + var result110 = result111 !== null + ? (function() { return (arguments[0]); }).apply(this, result111) : null; this._cache["not"][pos] = { nextPos: this._pos, - result: result115 + result: result110 }; - return result115; + return result110; }; result._parse_question = function(context) { @@ -1058,39 +1009,39 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var savedPos24 = this._pos; + var savedPos22 = this._pos; if (this._input.substr(this._pos, 1) === "?") { - var result121 = "?"; + var result116 = "?"; this._pos += 1; } else { - var result121 = null; + var result116 = null; if (context.reportMatchFailures) { this._matchFailed(new PEG.Parser.LiteralMatchFailure("?")); } } - if (result121 !== null) { - var result122 = this._parse___(context); - if (result122 !== null) { - var result120 = [result121, result122]; + if (result116 !== null) { + var result117 = this._parse___(context); + if (result117 !== null) { + var result115 = [result116, result117]; } else { - var result120 = null; - this._pos = savedPos24; + var result115 = null; + this._pos = savedPos22; } } else { - var result120 = null; - this._pos = savedPos24; + var result115 = null; + this._pos = savedPos22; } - var result119 = result120 !== null - ? (function() { return (arguments[0]); }).apply(this, result120) + var result114 = result115 !== null + ? (function() { return (arguments[0]); }).apply(this, result115) : null; this._cache["question"][pos] = { nextPos: this._pos, - result: result119 + result: result114 }; - return result119; + return result114; }; result._parse_star = function(context) { @@ -1104,39 +1055,39 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var savedPos25 = this._pos; + var savedPos23 = this._pos; if (this._input.substr(this._pos, 1) === "*") { - var result125 = "*"; + var result120 = "*"; this._pos += 1; } else { - var result125 = null; + var result120 = null; if (context.reportMatchFailures) { this._matchFailed(new PEG.Parser.LiteralMatchFailure("*")); } } - if (result125 !== null) { - var result126 = this._parse___(context); - if (result126 !== null) { - var result124 = [result125, result126]; + if (result120 !== null) { + var result121 = this._parse___(context); + if (result121 !== null) { + var result119 = [result120, result121]; } else { - var result124 = null; - this._pos = savedPos25; + var result119 = null; + this._pos = savedPos23; } } else { - var result124 = null; - this._pos = savedPos25; + var result119 = null; + this._pos = savedPos23; } - var result123 = result124 !== null - ? (function() { return (arguments[0]); }).apply(this, result124) + var result118 = result119 !== null + ? (function() { return (arguments[0]); }).apply(this, result119) : null; this._cache["star"][pos] = { nextPos: this._pos, - result: result123 + result: result118 }; - return result123; + return result118; }; result._parse_plus = function(context) { @@ -1150,39 +1101,39 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var savedPos26 = this._pos; + var savedPos24 = this._pos; if (this._input.substr(this._pos, 1) === "+") { - var result129 = "+"; + var result124 = "+"; this._pos += 1; } else { - var result129 = null; + var result124 = null; if (context.reportMatchFailures) { this._matchFailed(new PEG.Parser.LiteralMatchFailure("+")); } } - if (result129 !== null) { - var result130 = this._parse___(context); - if (result130 !== null) { - var result128 = [result129, result130]; + if (result124 !== null) { + var result125 = this._parse___(context); + if (result125 !== null) { + var result123 = [result124, result125]; } else { - var result128 = null; - this._pos = savedPos26; + var result123 = null; + this._pos = savedPos24; } } else { - var result128 = null; - this._pos = savedPos26; + var result123 = null; + this._pos = savedPos24; } - var result127 = result128 !== null - ? (function() { return (arguments[0]); }).apply(this, result128) + var result122 = result123 !== null + ? (function() { return (arguments[0]); }).apply(this, result123) : null; this._cache["plus"][pos] = { nextPos: this._pos, - result: result127 + result: result122 }; - return result127; + return result122; }; result._parse_lparen = function(context) { @@ -1196,39 +1147,39 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var savedPos27 = this._pos; + var savedPos25 = this._pos; if (this._input.substr(this._pos, 1) === "(") { - var result133 = "("; + var result128 = "("; this._pos += 1; } else { - var result133 = null; + var result128 = null; if (context.reportMatchFailures) { this._matchFailed(new PEG.Parser.LiteralMatchFailure("(")); } } - if (result133 !== null) { - var result134 = this._parse___(context); - if (result134 !== null) { - var result132 = [result133, result134]; + if (result128 !== null) { + var result129 = this._parse___(context); + if (result129 !== null) { + var result127 = [result128, result129]; } else { - var result132 = null; - this._pos = savedPos27; + var result127 = null; + this._pos = savedPos25; } } else { - var result132 = null; - this._pos = savedPos27; + var result127 = null; + this._pos = savedPos25; } - var result131 = result132 !== null - ? (function() { return (arguments[0]); }).apply(this, result132) + var result126 = result127 !== null + ? (function() { return (arguments[0]); }).apply(this, result127) : null; this._cache["lparen"][pos] = { nextPos: this._pos, - result: result131 + result: result126 }; - return result131; + return result126; }; result._parse_rparen = function(context) { @@ -1242,39 +1193,39 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var savedPos28 = this._pos; + var savedPos26 = this._pos; if (this._input.substr(this._pos, 1) === ")") { - var result137 = ")"; + var result132 = ")"; this._pos += 1; } else { - var result137 = null; + var result132 = null; if (context.reportMatchFailures) { this._matchFailed(new PEG.Parser.LiteralMatchFailure(")")); } } - if (result137 !== null) { - var result138 = this._parse___(context); - if (result138 !== null) { - var result136 = [result137, result138]; + if (result132 !== null) { + var result133 = this._parse___(context); + if (result133 !== null) { + var result131 = [result132, result133]; } else { - var result136 = null; - this._pos = savedPos28; + var result131 = null; + this._pos = savedPos26; } } else { - var result136 = null; - this._pos = savedPos28; + var result131 = null; + this._pos = savedPos26; } - var result135 = result136 !== null - ? (function() { return (arguments[0]); }).apply(this, result136) + var result130 = result131 !== null + ? (function() { return (arguments[0]); }).apply(this, result131) : null; this._cache["rparen"][pos] = { nextPos: this._pos, - result: result135 + result: result130 }; - return result135; + return result130; }; result._parse_dot = function(context) { @@ -1288,39 +1239,39 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var savedPos29 = this._pos; + var savedPos27 = this._pos; if (this._input.substr(this._pos, 1) === ".") { - var result141 = "."; + var result136 = "."; this._pos += 1; } else { - var result141 = null; + var result136 = null; if (context.reportMatchFailures) { this._matchFailed(new PEG.Parser.LiteralMatchFailure(".")); } } - if (result141 !== null) { - var result142 = this._parse___(context); - if (result142 !== null) { - var result140 = [result141, result142]; + if (result136 !== null) { + var result137 = this._parse___(context); + if (result137 !== null) { + var result135 = [result136, result137]; } else { - var result140 = null; - this._pos = savedPos29; + var result135 = null; + this._pos = savedPos27; } } else { - var result140 = null; - this._pos = savedPos29; + var result135 = null; + this._pos = savedPos27; } - var result139 = result140 !== null - ? (function() { return (arguments[0]); }).apply(this, result140) + var result134 = result135 !== null + ? (function() { return (arguments[0]); }).apply(this, result135) : null; this._cache["dot"][pos] = { nextPos: this._pos, - result: result139 + result: result134 }; - return result139; + return result134; }; result._parse_identifier = function(context) { @@ -1335,149 +1286,149 @@ PEG.grammarParser = (function(){ var savedReportMatchFailures = context.reportMatchFailures; context.reportMatchFailures = false; - var savedPos30 = this._pos; - var result155 = this._parse_letter(context); - if (result155 !== null) { - var result145 = result155; + var savedPos28 = this._pos; + var result150 = this._parse_letter(context); + if (result150 !== null) { + var result140 = result150; } else { if (this._input.substr(this._pos, 1) === "_") { - var result154 = "_"; + var result149 = "_"; this._pos += 1; } else { - var result154 = null; + var result149 = null; if (context.reportMatchFailures) { this._matchFailed(new PEG.Parser.LiteralMatchFailure("_")); } } - if (result154 !== null) { - var result145 = result154; + if (result149 !== null) { + var result140 = result149; } else { if (this._input.substr(this._pos, 1) === "$") { - var result153 = "$"; + var result148 = "$"; this._pos += 1; } else { - var result153 = null; + var result148 = null; if (context.reportMatchFailures) { this._matchFailed(new PEG.Parser.LiteralMatchFailure("$")); } } - if (result153 !== null) { - var result145 = result153; + if (result148 !== null) { + var result140 = result148; } else { - var result145 = null;; + var result140 = null;; }; }; } - if (result145 !== null) { - var result146 = []; - var result152 = this._parse_letter(context); - if (result152 !== null) { - var result148 = result152; + if (result140 !== null) { + var result141 = []; + var result147 = this._parse_letter(context); + if (result147 !== null) { + var result143 = result147; } else { - var result151 = this._parse_digit(context); - if (result151 !== null) { - var result148 = result151; + var result146 = this._parse_digit(context); + if (result146 !== null) { + var result143 = result146; } else { if (this._input.substr(this._pos, 1) === "_") { - var result150 = "_"; + var result145 = "_"; this._pos += 1; } else { - var result150 = null; + var result145 = null; if (context.reportMatchFailures) { this._matchFailed(new PEG.Parser.LiteralMatchFailure("_")); } } - if (result150 !== null) { - var result148 = result150; + if (result145 !== null) { + var result143 = result145; } else { if (this._input.substr(this._pos, 1) === "$") { - var result149 = "$"; + var result144 = "$"; this._pos += 1; } else { - var result149 = null; + var result144 = null; if (context.reportMatchFailures) { this._matchFailed(new PEG.Parser.LiteralMatchFailure("$")); } } - if (result149 !== null) { - var result148 = result149; + if (result144 !== null) { + var result143 = result144; } else { - var result148 = null;; + var result143 = null;; }; }; }; } - while (result148 !== null) { - result146.push(result148); - var result152 = this._parse_letter(context); - if (result152 !== null) { - var result148 = result152; + while (result143 !== null) { + result141.push(result143); + var result147 = this._parse_letter(context); + if (result147 !== null) { + var result143 = result147; } else { - var result151 = this._parse_digit(context); - if (result151 !== null) { - var result148 = result151; + var result146 = this._parse_digit(context); + if (result146 !== null) { + var result143 = result146; } else { if (this._input.substr(this._pos, 1) === "_") { - var result150 = "_"; + var result145 = "_"; this._pos += 1; } else { - var result150 = null; + var result145 = null; if (context.reportMatchFailures) { this._matchFailed(new PEG.Parser.LiteralMatchFailure("_")); } } - if (result150 !== null) { - var result148 = result150; + if (result145 !== null) { + var result143 = result145; } else { if (this._input.substr(this._pos, 1) === "$") { - var result149 = "$"; + var result144 = "$"; this._pos += 1; } else { - var result149 = null; + var result144 = null; if (context.reportMatchFailures) { this._matchFailed(new PEG.Parser.LiteralMatchFailure("$")); } } - if (result149 !== null) { - var result148 = result149; + if (result144 !== null) { + var result143 = result144; } else { - var result148 = null;; + var result143 = null;; }; }; }; } } - if (result146 !== null) { - var result147 = this._parse___(context); - if (result147 !== null) { - var result144 = [result145, result146, result147]; + if (result141 !== null) { + var result142 = this._parse___(context); + if (result142 !== null) { + var result139 = [result140, result141, result142]; } else { - var result144 = null; - this._pos = savedPos30; + var result139 = null; + this._pos = savedPos28; } } else { - var result144 = null; - this._pos = savedPos30; + var result139 = null; + this._pos = savedPos28; } } else { - var result144 = null; - this._pos = savedPos30; + var result139 = null; + this._pos = savedPos28; } - var result143 = result144 !== null + var result138 = result139 !== null ? (function() { return (arguments[0]) + (arguments[1]).join(""); - }).apply(this, result144) + }).apply(this, result139) : null; context.reportMatchFailures = savedReportMatchFailures; - if (context.reportMatchFailures && result143 === null) { + if (context.reportMatchFailures && result138 === null) { this._matchFailed(new PEG.Parser.NamedRuleMatchFailure("identifier")); } this._cache["identifier"][pos] = { nextPos: this._pos, - result: result143 + result: result138 }; - return result143; + return result138; }; result._parse_literal = function(context) { @@ -1492,43 +1443,43 @@ PEG.grammarParser = (function(){ var savedReportMatchFailures = context.reportMatchFailures; context.reportMatchFailures = false; - var savedPos31 = this._pos; - var result161 = this._parse_doubleQuotedLiteral(context); - if (result161 !== null) { - var result158 = result161; + var savedPos29 = this._pos; + var result156 = this._parse_doubleQuotedLiteral(context); + if (result156 !== null) { + var result153 = result156; } else { - var result160 = this._parse_singleQuotedLiteral(context); - if (result160 !== null) { - var result158 = result160; + var result155 = this._parse_singleQuotedLiteral(context); + if (result155 !== null) { + var result153 = result155; } else { - var result158 = null;; + var result153 = null;; }; } - if (result158 !== null) { - var result159 = this._parse___(context); - if (result159 !== null) { - var result157 = [result158, result159]; + if (result153 !== null) { + var result154 = this._parse___(context); + if (result154 !== null) { + var result152 = [result153, result154]; } else { - var result157 = null; - this._pos = savedPos31; + var result152 = null; + this._pos = savedPos29; } } else { - var result157 = null; - this._pos = savedPos31; + var result152 = null; + this._pos = savedPos29; } - var result156 = result157 !== null - ? (function() { return (arguments[0]); }).apply(this, result157) + var result151 = result152 !== null + ? (function() { return (arguments[0]); }).apply(this, result152) : null; context.reportMatchFailures = savedReportMatchFailures; - if (context.reportMatchFailures && result156 === null) { + if (context.reportMatchFailures && result151 === null) { this._matchFailed(new PEG.Parser.NamedRuleMatchFailure("literal")); } this._cache["literal"][pos] = { nextPos: this._pos, - result: result156 + result: result151 }; - return result156; + return result151; }; result._parse_doubleQuotedLiteral = function(context) { @@ -1542,58 +1493,58 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var savedPos32 = this._pos; + var savedPos30 = this._pos; if (this._input.substr(this._pos, 1) === "\"") { - var result164 = "\""; + var result159 = "\""; this._pos += 1; } else { - var result164 = null; + var result159 = null; if (context.reportMatchFailures) { this._matchFailed(new PEG.Parser.LiteralMatchFailure("\"")); } } - if (result164 !== null) { - var result165 = []; - var result167 = this._parse_doubleQuotedCharacter(context); - while (result167 !== null) { - result165.push(result167); - var result167 = this._parse_doubleQuotedCharacter(context); + if (result159 !== null) { + var result160 = []; + var result162 = this._parse_doubleQuotedCharacter(context); + while (result162 !== null) { + result160.push(result162); + var result162 = this._parse_doubleQuotedCharacter(context); } - if (result165 !== null) { + if (result160 !== null) { if (this._input.substr(this._pos, 1) === "\"") { - var result166 = "\""; + var result161 = "\""; this._pos += 1; } else { - var result166 = null; + var result161 = null; if (context.reportMatchFailures) { this._matchFailed(new PEG.Parser.LiteralMatchFailure("\"")); } } - if (result166 !== null) { - var result163 = [result164, result165, result166]; + if (result161 !== null) { + var result158 = [result159, result160, result161]; } else { - var result163 = null; - this._pos = savedPos32; + var result158 = null; + this._pos = savedPos30; } } else { - var result163 = null; - this._pos = savedPos32; + var result158 = null; + this._pos = savedPos30; } } else { - var result163 = null; - this._pos = savedPos32; + var result158 = null; + this._pos = savedPos30; } - var result162 = result163 !== null - ? (function() { return (arguments[1]).join(""); }).apply(this, result163) + var result157 = result158 !== null + ? (function() { return (arguments[1]).join(""); }).apply(this, result158) : null; this._cache["doubleQuotedLiteral"][pos] = { nextPos: this._pos, - result: result162 + result: result157 }; - return result162; + return result157; }; result._parse_doubleQuotedCharacter = function(context) { @@ -1607,31 +1558,31 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var result174 = this._parse_simpleDoubleQuotedCharacter(context); - if (result174 !== null) { - var result168 = result174; + var result169 = this._parse_simpleDoubleQuotedCharacter(context); + if (result169 !== null) { + var result163 = result169; } else { - var result173 = this._parse_simpleEscapeSequence(context); - if (result173 !== null) { - var result168 = result173; + var result168 = this._parse_simpleEscapeSequence(context); + if (result168 !== null) { + var result163 = result168; } else { - var result172 = this._parse_zeroEscapeSequence(context); - if (result172 !== null) { - var result168 = result172; + var result167 = this._parse_zeroEscapeSequence(context); + if (result167 !== null) { + var result163 = result167; } else { - var result171 = this._parse_hexEscapeSequence(context); - if (result171 !== null) { - var result168 = result171; + var result166 = this._parse_hexEscapeSequence(context); + if (result166 !== null) { + var result163 = result166; } else { - var result170 = this._parse_unicodeEscapeSequence(context); - if (result170 !== null) { - var result168 = result170; + var result165 = this._parse_unicodeEscapeSequence(context); + if (result165 !== null) { + var result163 = result165; } else { - var result169 = this._parse_eolEscapeSequence(context); - if (result169 !== null) { - var result168 = result169; + var result164 = this._parse_eolEscapeSequence(context); + if (result164 !== null) { + var result163 = result164; } else { - var result168 = null;; + var result163 = null;; }; }; }; @@ -1643,9 +1594,9 @@ PEG.grammarParser = (function(){ this._cache["doubleQuotedCharacter"][pos] = { nextPos: this._pos, - result: result168 + result: result163 }; - return result168; + return result163; }; result._parse_simpleDoubleQuotedCharacter = function(context) { @@ -1659,80 +1610,80 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var savedPos33 = this._pos; - var savedPos34 = this._pos; - var savedReportMatchFailuresVar2 = context.reportMatchFailures; + var savedPos31 = this._pos; + var savedPos32 = this._pos; + var savedReportMatchFailuresVar1 = context.reportMatchFailures; context.reportMatchFailures = false; if (this._input.substr(this._pos, 1) === "\"") { - var result182 = "\""; + var result177 = "\""; this._pos += 1; } else { - var result182 = null; + var result177 = null; if (context.reportMatchFailures) { this._matchFailed(new PEG.Parser.LiteralMatchFailure("\"")); } } - if (result182 !== null) { - var result179 = result182; + if (result177 !== null) { + var result174 = result177; } else { if (this._input.substr(this._pos, 1) === "\\") { - var result181 = "\\"; + var result176 = "\\"; this._pos += 1; } else { - var result181 = null; + var result176 = null; if (context.reportMatchFailures) { this._matchFailed(new PEG.Parser.LiteralMatchFailure("\\")); } } - if (result181 !== null) { - var result179 = result181; + if (result176 !== null) { + var result174 = result176; } else { - var result180 = this._parse_eolChar(context); - if (result180 !== null) { - var result179 = result180; + var result175 = this._parse_eolChar(context); + if (result175 !== null) { + var result174 = result175; } else { - var result179 = null;; + var result174 = null;; }; }; } - context.reportMatchFailures = savedReportMatchFailuresVar2; - if (result179 === null) { - var result177 = ''; + context.reportMatchFailures = savedReportMatchFailuresVar1; + if (result174 === null) { + var result172 = ''; } else { - var result177 = null; - this._pos = savedPos34; + var result172 = null; + this._pos = savedPos32; } - if (result177 !== null) { + if (result172 !== null) { if (this._input.length > this._pos) { - var result178 = this._input[this._pos]; + var result173 = this._input[this._pos]; this._pos++; } else { - var result178 = null; + var result173 = null; if (context.reportMatchFailures) { this._matchFailed(new PEG.Parser.AnyMatchFailure()); } } - if (result178 !== null) { - var result176 = [result177, result178]; + if (result173 !== null) { + var result171 = [result172, result173]; } else { - var result176 = null; - this._pos = savedPos33; + var result171 = null; + this._pos = savedPos31; } } else { - var result176 = null; - this._pos = savedPos33; + var result171 = null; + this._pos = savedPos31; } - var result175 = result176 !== null - ? (function() { return (arguments[1]); }).apply(this, result176) + var result170 = result171 !== null + ? (function() { return (arguments[1]); }).apply(this, result171) : null; this._cache["simpleDoubleQuotedCharacter"][pos] = { nextPos: this._pos, - result: result175 + result: result170 }; - return result175; + return result170; }; result._parse_singleQuotedLiteral = function(context) { @@ -1746,58 +1697,58 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var savedPos35 = this._pos; + var savedPos33 = this._pos; if (this._input.substr(this._pos, 1) === "'") { - var result185 = "'"; + var result180 = "'"; this._pos += 1; } else { - var result185 = null; + var result180 = null; if (context.reportMatchFailures) { this._matchFailed(new PEG.Parser.LiteralMatchFailure("'")); } } - if (result185 !== null) { - var result186 = []; - var result188 = this._parse_singleQuotedCharacter(context); - while (result188 !== null) { - result186.push(result188); - var result188 = this._parse_singleQuotedCharacter(context); + if (result180 !== null) { + var result181 = []; + var result183 = this._parse_singleQuotedCharacter(context); + while (result183 !== null) { + result181.push(result183); + var result183 = this._parse_singleQuotedCharacter(context); } - if (result186 !== null) { + if (result181 !== null) { if (this._input.substr(this._pos, 1) === "'") { - var result187 = "'"; + var result182 = "'"; this._pos += 1; } else { - var result187 = null; + var result182 = null; if (context.reportMatchFailures) { this._matchFailed(new PEG.Parser.LiteralMatchFailure("'")); } } - if (result187 !== null) { - var result184 = [result185, result186, result187]; + if (result182 !== null) { + var result179 = [result180, result181, result182]; } else { - var result184 = null; - this._pos = savedPos35; + var result179 = null; + this._pos = savedPos33; } } else { - var result184 = null; - this._pos = savedPos35; + var result179 = null; + this._pos = savedPos33; } } else { - var result184 = null; - this._pos = savedPos35; + var result179 = null; + this._pos = savedPos33; } - var result183 = result184 !== null - ? (function() { return (arguments[1]).join(""); }).apply(this, result184) + var result178 = result179 !== null + ? (function() { return (arguments[1]).join(""); }).apply(this, result179) : null; this._cache["singleQuotedLiteral"][pos] = { nextPos: this._pos, - result: result183 + result: result178 }; - return result183; + return result178; }; result._parse_singleQuotedCharacter = function(context) { @@ -1811,31 +1762,31 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var result195 = this._parse_simpleSingleQuotedCharacter(context); - if (result195 !== null) { - var result189 = result195; + var result190 = this._parse_simpleSingleQuotedCharacter(context); + if (result190 !== null) { + var result184 = result190; } else { - var result194 = this._parse_simpleEscapeSequence(context); - if (result194 !== null) { - var result189 = result194; + var result189 = this._parse_simpleEscapeSequence(context); + if (result189 !== null) { + var result184 = result189; } else { - var result193 = this._parse_zeroEscapeSequence(context); - if (result193 !== null) { - var result189 = result193; + var result188 = this._parse_zeroEscapeSequence(context); + if (result188 !== null) { + var result184 = result188; } else { - var result192 = this._parse_hexEscapeSequence(context); - if (result192 !== null) { - var result189 = result192; + var result187 = this._parse_hexEscapeSequence(context); + if (result187 !== null) { + var result184 = result187; } else { - var result191 = this._parse_unicodeEscapeSequence(context); - if (result191 !== null) { - var result189 = result191; + var result186 = this._parse_unicodeEscapeSequence(context); + if (result186 !== null) { + var result184 = result186; } else { - var result190 = this._parse_eolEscapeSequence(context); - if (result190 !== null) { - var result189 = result190; + var result185 = this._parse_eolEscapeSequence(context); + if (result185 !== null) { + var result184 = result185; } else { - var result189 = null;; + var result184 = null;; }; }; }; @@ -1847,9 +1798,9 @@ PEG.grammarParser = (function(){ this._cache["singleQuotedCharacter"][pos] = { nextPos: this._pos, - result: result189 + result: result184 }; - return result189; + return result184; }; result._parse_simpleSingleQuotedCharacter = function(context) { @@ -1863,80 +1814,80 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var savedPos36 = this._pos; - var savedPos37 = this._pos; - var savedReportMatchFailuresVar3 = context.reportMatchFailures; + var savedPos34 = this._pos; + var savedPos35 = this._pos; + var savedReportMatchFailuresVar2 = context.reportMatchFailures; context.reportMatchFailures = false; if (this._input.substr(this._pos, 1) === "'") { - var result203 = "'"; + var result198 = "'"; this._pos += 1; } else { - var result203 = null; + var result198 = null; if (context.reportMatchFailures) { this._matchFailed(new PEG.Parser.LiteralMatchFailure("'")); } } - if (result203 !== null) { - var result200 = result203; + if (result198 !== null) { + var result195 = result198; } else { if (this._input.substr(this._pos, 1) === "\\") { - var result202 = "\\"; + var result197 = "\\"; this._pos += 1; } else { - var result202 = null; + var result197 = null; if (context.reportMatchFailures) { this._matchFailed(new PEG.Parser.LiteralMatchFailure("\\")); } } - if (result202 !== null) { - var result200 = result202; + if (result197 !== null) { + var result195 = result197; } else { - var result201 = this._parse_eolChar(context); - if (result201 !== null) { - var result200 = result201; + var result196 = this._parse_eolChar(context); + if (result196 !== null) { + var result195 = result196; } else { - var result200 = null;; + var result195 = null;; }; }; } - context.reportMatchFailures = savedReportMatchFailuresVar3; - if (result200 === null) { - var result198 = ''; + context.reportMatchFailures = savedReportMatchFailuresVar2; + if (result195 === null) { + var result193 = ''; } else { - var result198 = null; - this._pos = savedPos37; + var result193 = null; + this._pos = savedPos35; } - if (result198 !== null) { + if (result193 !== null) { if (this._input.length > this._pos) { - var result199 = this._input[this._pos]; + var result194 = this._input[this._pos]; this._pos++; } else { - var result199 = null; + var result194 = null; if (context.reportMatchFailures) { this._matchFailed(new PEG.Parser.AnyMatchFailure()); } } - if (result199 !== null) { - var result197 = [result198, result199]; + if (result194 !== null) { + var result192 = [result193, result194]; } else { - var result197 = null; - this._pos = savedPos36; + var result192 = null; + this._pos = savedPos34; } } else { - var result197 = null; - this._pos = savedPos36; + var result192 = null; + this._pos = savedPos34; } - var result196 = result197 !== null - ? (function() { return (arguments[1]); }).apply(this, result197) + var result191 = result192 !== null + ? (function() { return (arguments[1]); }).apply(this, result192) : null; this._cache["simpleSingleQuotedCharacter"][pos] = { nextPos: this._pos, - result: result196 + result: result191 }; - return result196; + return result191; }; result._parse_class = function(context) { @@ -1951,88 +1902,120 @@ PEG.grammarParser = (function(){ var savedReportMatchFailures = context.reportMatchFailures; context.reportMatchFailures = false; - var savedPos38 = this._pos; + var savedPos36 = this._pos; if (this._input.substr(this._pos, 1) === "[") { - var result206 = "["; + var result201 = "["; this._pos += 1; } else { - var result206 = null; + var result201 = null; if (context.reportMatchFailures) { this._matchFailed(new PEG.Parser.LiteralMatchFailure("[")); } } - if (result206 !== null) { - var result207 = []; - var result212 = this._parse_classCharacterRange(context); - if (result212 !== null) { - var result210 = result212; + if (result201 !== null) { + if (this._input.substr(this._pos, 1) === "^") { + var result210 = "^"; + this._pos += 1; + } else { + var result210 = null; + if (context.reportMatchFailures) { + this._matchFailed(new PEG.Parser.LiteralMatchFailure("^")); + } + } + if (result210 !== null) { + var result202 = result210; } else { - var result211 = this._parse_classCharacter(context); - if (result211 !== null) { - var result210 = result211; + if (this._input.substr(this._pos, 0) === "") { + var result209 = ""; + this._pos += 0; + } else { + var result209 = null; + if (context.reportMatchFailures) { + this._matchFailed(new PEG.Parser.LiteralMatchFailure("")); + } + } + if (result209 !== null) { + var result202 = result209; } else { - var result210 = null;; + var result202 = null;; }; } - while (result210 !== null) { - result207.push(result210); - var result212 = this._parse_classCharacterRange(context); - if (result212 !== null) { - var result210 = result212; + if (result202 !== null) { + var result203 = []; + var result208 = this._parse_classCharacterRange(context); + if (result208 !== null) { + var result206 = result208; } else { - var result211 = this._parse_classCharacter(context); - if (result211 !== null) { - var result210 = result211; + var result207 = this._parse_classCharacter(context); + if (result207 !== null) { + var result206 = result207; } else { - var result210 = null;; + var result206 = null;; }; } - } - if (result207 !== null) { - if (this._input.substr(this._pos, 1) === "]") { - var result208 = "]"; - this._pos += 1; - } else { - var result208 = null; - if (context.reportMatchFailures) { - this._matchFailed(new PEG.Parser.LiteralMatchFailure("]")); + while (result206 !== null) { + result203.push(result206); + var result208 = this._parse_classCharacterRange(context); + if (result208 !== null) { + var result206 = result208; + } else { + var result207 = this._parse_classCharacter(context); + if (result207 !== null) { + var result206 = result207; + } else { + var result206 = null;; + }; } } - if (result208 !== null) { - var result209 = this._parse___(context); - if (result209 !== null) { - var result205 = [result206, result207, result208, result209]; + if (result203 !== null) { + if (this._input.substr(this._pos, 1) === "]") { + var result204 = "]"; + this._pos += 1; } else { - var result205 = null; - this._pos = savedPos38; + var result204 = null; + if (context.reportMatchFailures) { + this._matchFailed(new PEG.Parser.LiteralMatchFailure("]")); + } + } + if (result204 !== null) { + var result205 = this._parse___(context); + if (result205 !== null) { + var result200 = [result201, result202, result203, result204, result205]; + } else { + var result200 = null; + this._pos = savedPos36; + } + } else { + var result200 = null; + this._pos = savedPos36; } } else { - var result205 = null; - this._pos = savedPos38; + var result200 = null; + this._pos = savedPos36; } } else { - var result205 = null; - this._pos = savedPos38; + var result200 = null; + this._pos = savedPos36; } } else { - var result205 = null; - this._pos = savedPos38; + var result200 = null; + this._pos = savedPos36; } - var result204 = result205 !== null + var result199 = result200 !== null ? (function() { - return (arguments[1]).join(""); - }).apply(this, result205) + return (arguments[1]) + (arguments[2]).join(""); + }).apply(this, result200) : null; context.reportMatchFailures = savedReportMatchFailures; - if (context.reportMatchFailures && result204 === null) { + if (context.reportMatchFailures && result199 === null) { this._matchFailed(new PEG.Parser.NamedRuleMatchFailure("character class")); } this._cache["class"][pos] = { nextPos: this._pos, - result: result204 + result: result199 }; - return result204; + return result199; }; result._parse_classCharacterRange = function(context) { @@ -2046,35 +2029,35 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var savedPos39 = this._pos; - var result215 = this._parse_bracketDelimitedCharacter(context); - if (result215 !== null) { + var savedPos37 = this._pos; + var result213 = this._parse_bracketDelimitedCharacter(context); + if (result213 !== null) { if (this._input.substr(this._pos, 1) === "-") { - var result216 = "-"; + var result214 = "-"; this._pos += 1; } else { - var result216 = null; + var result214 = null; if (context.reportMatchFailures) { this._matchFailed(new PEG.Parser.LiteralMatchFailure("-")); } } - if (result216 !== null) { - var result217 = this._parse_bracketDelimitedCharacter(context); - if (result217 !== null) { - var result214 = [result215, result216, result217]; + if (result214 !== null) { + var result215 = this._parse_bracketDelimitedCharacter(context); + if (result215 !== null) { + var result212 = [result213, result214, result215]; } else { - var result214 = null; - this._pos = savedPos39; + var result212 = null; + this._pos = savedPos37; } } else { - var result214 = null; - this._pos = savedPos39; + var result212 = null; + this._pos = savedPos37; } } else { - var result214 = null; - this._pos = savedPos39; + var result212 = null; + this._pos = savedPos37; } - var result213 = result214 !== null + var result211 = result212 !== null ? (function() { if ((arguments[0]).charCodeAt(0) > (arguments[2]).charCodeAt(0)) { throw new PEG.Parser.SyntaxError( @@ -2089,16 +2072,16 @@ PEG.grammarParser = (function(){ return PEG.RegExpUtils.quoteForClass((arguments[0])) + "-" + PEG.RegExpUtils.quoteForClass((arguments[2])); - }).apply(this, result214) + }).apply(this, result212) : null; this._cache["classCharacterRange"][pos] = { nextPos: this._pos, - result: result213 + result: result211 }; - return result213; + return result211; }; result._parse_classCharacter = function(context) { @@ -2112,20 +2095,20 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var result219 = this._parse_bracketDelimitedCharacter(context); - var result218 = result219 !== null + var result217 = this._parse_bracketDelimitedCharacter(context); + var result216 = result217 !== null ? (function() { return PEG.RegExpUtils.quoteForClass((arguments[0])); - }).call(this, result219) + }).call(this, result217) : null; this._cache["classCharacter"][pos] = { nextPos: this._pos, - result: result218 + result: result216 }; - return result218; + return result216; }; result._parse_bracketDelimitedCharacter = function(context) { @@ -2139,31 +2122,31 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var result226 = this._parse_simpleBracketDelimitedCharacter(context); - if (result226 !== null) { - var result220 = result226; + var result224 = this._parse_simpleBracketDelimitedCharacter(context); + if (result224 !== null) { + var result218 = result224; } else { - var result225 = this._parse_simpleEscapeSequence(context); - if (result225 !== null) { - var result220 = result225; + var result223 = this._parse_simpleEscapeSequence(context); + if (result223 !== null) { + var result218 = result223; } else { - var result224 = this._parse_zeroEscapeSequence(context); - if (result224 !== null) { - var result220 = result224; + var result222 = this._parse_zeroEscapeSequence(context); + if (result222 !== null) { + var result218 = result222; } else { - var result223 = this._parse_hexEscapeSequence(context); - if (result223 !== null) { - var result220 = result223; + var result221 = this._parse_hexEscapeSequence(context); + if (result221 !== null) { + var result218 = result221; } else { - var result222 = this._parse_unicodeEscapeSequence(context); - if (result222 !== null) { - var result220 = result222; + var result220 = this._parse_unicodeEscapeSequence(context); + if (result220 !== null) { + var result218 = result220; } else { - var result221 = this._parse_eolEscapeSequence(context); - if (result221 !== null) { - var result220 = result221; + var result219 = this._parse_eolEscapeSequence(context); + if (result219 !== null) { + var result218 = result219; } else { - var result220 = null;; + var result218 = null;; }; }; }; @@ -2175,9 +2158,9 @@ PEG.grammarParser = (function(){ this._cache["bracketDelimitedCharacter"][pos] = { nextPos: this._pos, - result: result220 + result: result218 }; - return result220; + return result218; }; result._parse_simpleBracketDelimitedCharacter = function(context) { @@ -2191,80 +2174,80 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var savedPos40 = this._pos; - var savedPos41 = this._pos; - var savedReportMatchFailuresVar4 = context.reportMatchFailures; + var savedPos38 = this._pos; + var savedPos39 = this._pos; + var savedReportMatchFailuresVar3 = context.reportMatchFailures; context.reportMatchFailures = false; if (this._input.substr(this._pos, 1) === "]") { - var result234 = "]"; + var result232 = "]"; this._pos += 1; } else { - var result234 = null; + var result232 = null; if (context.reportMatchFailures) { this._matchFailed(new PEG.Parser.LiteralMatchFailure("]")); } } - if (result234 !== null) { - var result231 = result234; + if (result232 !== null) { + var result229 = result232; } else { if (this._input.substr(this._pos, 1) === "\\") { - var result233 = "\\"; + var result231 = "\\"; this._pos += 1; } else { - var result233 = null; + var result231 = null; if (context.reportMatchFailures) { this._matchFailed(new PEG.Parser.LiteralMatchFailure("\\")); } } - if (result233 !== null) { - var result231 = result233; + if (result231 !== null) { + var result229 = result231; } else { - var result232 = this._parse_eolChar(context); - if (result232 !== null) { - var result231 = result232; + var result230 = this._parse_eolChar(context); + if (result230 !== null) { + var result229 = result230; } else { - var result231 = null;; + var result229 = null;; }; }; } - context.reportMatchFailures = savedReportMatchFailuresVar4; - if (result231 === null) { - var result229 = ''; + context.reportMatchFailures = savedReportMatchFailuresVar3; + if (result229 === null) { + var result227 = ''; } else { - var result229 = null; - this._pos = savedPos41; + var result227 = null; + this._pos = savedPos39; } - if (result229 !== null) { + if (result227 !== null) { if (this._input.length > this._pos) { - var result230 = this._input[this._pos]; + var result228 = this._input[this._pos]; this._pos++; } else { - var result230 = null; + var result228 = null; if (context.reportMatchFailures) { this._matchFailed(new PEG.Parser.AnyMatchFailure()); } } - if (result230 !== null) { - var result228 = [result229, result230]; + if (result228 !== null) { + var result226 = [result227, result228]; } else { - var result228 = null; - this._pos = savedPos40; + var result226 = null; + this._pos = savedPos38; } } else { - var result228 = null; - this._pos = savedPos40; + var result226 = null; + this._pos = savedPos38; } - var result227 = result228 !== null - ? (function() { return (arguments[1]); }).apply(this, result228) + var result225 = result226 !== null + ? (function() { return (arguments[1]); }).apply(this, result226) : null; this._cache["simpleBracketDelimitedCharacter"][pos] = { nextPos: this._pos, - result: result227 + result: result225 }; - return result227; + return result225; }; result._parse_simpleEscapeSequence = function(context) { @@ -2278,89 +2261,89 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var savedPos42 = this._pos; + var savedPos40 = this._pos; if (this._input.substr(this._pos, 1) === "\\") { - var result237 = "\\"; + var result235 = "\\"; this._pos += 1; } else { - var result237 = null; + var result235 = null; if (context.reportMatchFailures) { this._matchFailed(new PEG.Parser.LiteralMatchFailure("\\")); } } - if (result237 !== null) { - var savedPos43 = this._pos; - var savedReportMatchFailuresVar5 = context.reportMatchFailures; + if (result235 !== null) { + var savedPos41 = this._pos; + var savedReportMatchFailuresVar4 = context.reportMatchFailures; context.reportMatchFailures = false; - var result244 = this._parse_digit(context); - if (result244 !== null) { - var result240 = result244; + var result242 = this._parse_digit(context); + if (result242 !== null) { + var result238 = result242; } else { if (this._input.substr(this._pos, 1) === "x") { - var result243 = "x"; + var result241 = "x"; this._pos += 1; } else { - var result243 = null; + var result241 = null; if (context.reportMatchFailures) { this._matchFailed(new PEG.Parser.LiteralMatchFailure("x")); } } - if (result243 !== null) { - var result240 = result243; + if (result241 !== null) { + var result238 = result241; } else { if (this._input.substr(this._pos, 1) === "u") { - var result242 = "u"; + var result240 = "u"; this._pos += 1; } else { - var result242 = null; + var result240 = null; if (context.reportMatchFailures) { this._matchFailed(new PEG.Parser.LiteralMatchFailure("u")); } } - if (result242 !== null) { - var result240 = result242; + if (result240 !== null) { + var result238 = result240; } else { - var result241 = this._parse_eolChar(context); - if (result241 !== null) { - var result240 = result241; + var result239 = this._parse_eolChar(context); + if (result239 !== null) { + var result238 = result239; } else { - var result240 = null;; + var result238 = null;; }; }; }; } - context.reportMatchFailures = savedReportMatchFailuresVar5; - if (result240 === null) { - var result238 = ''; + context.reportMatchFailures = savedReportMatchFailuresVar4; + if (result238 === null) { + var result236 = ''; } else { - var result238 = null; - this._pos = savedPos43; + var result236 = null; + this._pos = savedPos41; } - if (result238 !== null) { + if (result236 !== null) { if (this._input.length > this._pos) { - var result239 = this._input[this._pos]; + var result237 = this._input[this._pos]; this._pos++; } else { - var result239 = null; + var result237 = null; if (context.reportMatchFailures) { this._matchFailed(new PEG.Parser.AnyMatchFailure()); } } - if (result239 !== null) { - var result236 = [result237, result238, result239]; + if (result237 !== null) { + var result234 = [result235, result236, result237]; } else { - var result236 = null; - this._pos = savedPos42; + var result234 = null; + this._pos = savedPos40; } } else { - var result236 = null; - this._pos = savedPos42; + var result234 = null; + this._pos = savedPos40; } } else { - var result236 = null; - this._pos = savedPos42; + var result234 = null; + this._pos = savedPos40; } - var result235 = result236 !== null + var result233 = result234 !== null ? (function() { return (arguments[2]) .replace("b", "\b") @@ -2369,16 +2352,16 @@ PEG.grammarParser = (function(){ .replace("r", "\r") .replace("t", "\t") .replace("v", "\v") - }).apply(this, result236) + }).apply(this, result234) : null; this._cache["simpleEscapeSequence"][pos] = { nextPos: this._pos, - result: result235 + result: result233 }; - return result235; + return result233; }; result._parse_zeroEscapeSequence = function(context) { @@ -2392,49 +2375,49 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var savedPos44 = this._pos; + var savedPos42 = this._pos; if (this._input.substr(this._pos, 2) === "\\0") { - var result247 = "\\0"; + var result245 = "\\0"; this._pos += 2; } else { - var result247 = null; + var result245 = null; if (context.reportMatchFailures) { this._matchFailed(new PEG.Parser.LiteralMatchFailure("\\0")); } } - if (result247 !== null) { - var savedPos45 = this._pos; - var savedReportMatchFailuresVar6 = context.reportMatchFailures; + if (result245 !== null) { + var savedPos43 = this._pos; + var savedReportMatchFailuresVar5 = context.reportMatchFailures; context.reportMatchFailures = false; - var result249 = this._parse_digit(context); - context.reportMatchFailures = savedReportMatchFailuresVar6; - if (result249 === null) { - var result248 = ''; + var result247 = this._parse_digit(context); + context.reportMatchFailures = savedReportMatchFailuresVar5; + if (result247 === null) { + var result246 = ''; } else { - var result248 = null; - this._pos = savedPos45; + var result246 = null; + this._pos = savedPos43; } - if (result248 !== null) { - var result246 = [result247, result248]; + if (result246 !== null) { + var result244 = [result245, result246]; } else { - var result246 = null; - this._pos = savedPos44; + var result244 = null; + this._pos = savedPos42; } } else { - var result246 = null; - this._pos = savedPos44; + var result244 = null; + this._pos = savedPos42; } - var result245 = result246 !== null - ? (function() { return "\0"; }).apply(this, result246) + var result243 = result244 !== null + ? (function() { return "\0"; }).apply(this, result244) : null; this._cache["zeroEscapeSequence"][pos] = { nextPos: this._pos, - result: result245 + result: result243 }; - return result245; + return result243; }; result._parse_hexEscapeSequence = function(context) { @@ -2448,47 +2431,47 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var savedPos46 = this._pos; + var savedPos44 = this._pos; if (this._input.substr(this._pos, 2) === "\\x") { - var result252 = "\\x"; + var result250 = "\\x"; this._pos += 2; } else { - var result252 = null; + var result250 = null; if (context.reportMatchFailures) { this._matchFailed(new PEG.Parser.LiteralMatchFailure("\\x")); } } - if (result252 !== null) { - var result253 = this._parse_hexDigit(context); - if (result253 !== null) { - var result254 = this._parse_hexDigit(context); - if (result254 !== null) { - var result251 = [result252, result253, result254]; + 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]; } else { - var result251 = null; - this._pos = savedPos46; + var result249 = null; + this._pos = savedPos44; } } else { - var result251 = null; - this._pos = savedPos46; + var result249 = null; + this._pos = savedPos44; } } else { - var result251 = null; - this._pos = savedPos46; + var result249 = null; + this._pos = savedPos44; } - var result250 = result251 !== null + var result248 = result249 !== null ? (function() { return String.fromCharCode(parseInt("0x" + (arguments[1]) + (arguments[2]))); - }).apply(this, result251) + }).apply(this, result249) : null; this._cache["hexEscapeSequence"][pos] = { nextPos: this._pos, - result: result250 + result: result248 }; - return result250; + return result248; }; result._parse_unicodeEscapeSequence = function(context) { @@ -2502,59 +2485,59 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var savedPos47 = this._pos; + var savedPos45 = this._pos; if (this._input.substr(this._pos, 2) === "\\u") { - var result257 = "\\u"; + var result255 = "\\u"; this._pos += 2; } else { - var result257 = null; + var result255 = null; if (context.reportMatchFailures) { this._matchFailed(new PEG.Parser.LiteralMatchFailure("\\u")); } } - if (result257 !== null) { - var result258 = this._parse_hexDigit(context); - if (result258 !== null) { - var result259 = this._parse_hexDigit(context); - if (result259 !== null) { - var result260 = this._parse_hexDigit(context); - if (result260 !== null) { - var result261 = this._parse_hexDigit(context); - if (result261 !== null) { - var result256 = [result257, result258, result259, result260, result261]; + 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]; } else { - var result256 = null; - this._pos = savedPos47; + var result254 = null; + this._pos = savedPos45; } } else { - var result256 = null; - this._pos = savedPos47; + var result254 = null; + this._pos = savedPos45; } } else { - var result256 = null; - this._pos = savedPos47; + var result254 = null; + this._pos = savedPos45; } } else { - var result256 = null; - this._pos = savedPos47; + var result254 = null; + this._pos = savedPos45; } } else { - var result256 = null; - this._pos = savedPos47; + var result254 = null; + this._pos = savedPos45; } - var result255 = result256 !== null + var result253 = result254 !== null ? (function() { return String.fromCharCode(parseInt("0x" + (arguments[1]) + (arguments[2]) + (arguments[3]) + (arguments[4]))); - }).apply(this, result256) + }).apply(this, result254) : null; this._cache["unicodeEscapeSequence"][pos] = { nextPos: this._pos, - result: result255 + result: result253 }; - return result255; + return result253; }; result._parse_eolEscapeSequence = function(context) { @@ -2568,39 +2551,39 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var savedPos48 = this._pos; + var savedPos46 = this._pos; if (this._input.substr(this._pos, 1) === "\\") { - var result264 = "\\"; + var result262 = "\\"; this._pos += 1; } else { - var result264 = null; + var result262 = null; if (context.reportMatchFailures) { this._matchFailed(new PEG.Parser.LiteralMatchFailure("\\")); } } - if (result264 !== null) { - var result265 = this._parse_eol(context); - if (result265 !== null) { - var result263 = [result264, result265]; + if (result262 !== null) { + var result263 = this._parse_eol(context); + if (result263 !== null) { + var result261 = [result262, result263]; } else { - var result263 = null; - this._pos = savedPos48; + var result261 = null; + this._pos = savedPos46; } } else { - var result263 = null; - this._pos = savedPos48; + var result261 = null; + this._pos = savedPos46; } - var result262 = result263 !== null - ? (function() { return (arguments[1]); }).apply(this, result263) + var result260 = result261 !== null + ? (function() { return (arguments[1]); }).apply(this, result261) : null; this._cache["eolEscapeSequence"][pos] = { nextPos: this._pos, - result: result262 + result: result260 }; - return result262; + return result260; }; result._parse_digit = function(context) { @@ -2615,10 +2598,10 @@ PEG.grammarParser = (function(){ if (this._input.substr(this._pos).match(/^[0-9]/) !== null) { - var result266 = this._input[this._pos]; + var result264 = this._input[this._pos]; this._pos++; } else { - var result266 = null; + var result264 = null; if (context.reportMatchFailures) { this._matchFailed(new PEG.Parser.ClassMatchFailure("0-9")); } @@ -2628,9 +2611,9 @@ PEG.grammarParser = (function(){ this._cache["digit"][pos] = { nextPos: this._pos, - result: result266 + result: result264 }; - return result266; + return result264; }; result._parse_hexDigit = function(context) { @@ -2645,10 +2628,10 @@ PEG.grammarParser = (function(){ if (this._input.substr(this._pos).match(/^[0-9a-fA-F]/) !== null) { - var result267 = this._input[this._pos]; + var result265 = this._input[this._pos]; this._pos++; } else { - var result267 = null; + var result265 = null; if (context.reportMatchFailures) { this._matchFailed(new PEG.Parser.ClassMatchFailure("0-9a-fA-F")); } @@ -2658,9 +2641,9 @@ PEG.grammarParser = (function(){ this._cache["hexDigit"][pos] = { nextPos: this._pos, - result: result267 + result: result265 }; - return result267; + return result265; }; result._parse_letter = function(context) { @@ -2674,15 +2657,15 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var result270 = this._parse_lowerCaseLetter(context); - if (result270 !== null) { - var result268 = result270; + var result268 = this._parse_lowerCaseLetter(context); + if (result268 !== null) { + var result266 = result268; } else { - var result269 = this._parse_upperCaseLetter(context); - if (result269 !== null) { - var result268 = result269; + var result267 = this._parse_upperCaseLetter(context); + if (result267 !== null) { + var result266 = result267; } else { - var result268 = null;; + var result266 = null;; }; } @@ -2690,9 +2673,9 @@ PEG.grammarParser = (function(){ this._cache["letter"][pos] = { nextPos: this._pos, - result: result268 + result: result266 }; - return result268; + return result266; }; result._parse_lowerCaseLetter = function(context) { @@ -2707,10 +2690,10 @@ PEG.grammarParser = (function(){ if (this._input.substr(this._pos).match(/^[a-z]/) !== null) { - var result271 = this._input[this._pos]; + var result269 = this._input[this._pos]; this._pos++; } else { - var result271 = null; + var result269 = null; if (context.reportMatchFailures) { this._matchFailed(new PEG.Parser.ClassMatchFailure("a-z")); } @@ -2720,9 +2703,9 @@ PEG.grammarParser = (function(){ this._cache["lowerCaseLetter"][pos] = { nextPos: this._pos, - result: result271 + result: result269 }; - return result271; + return result269; }; result._parse_upperCaseLetter = function(context) { @@ -2737,10 +2720,10 @@ PEG.grammarParser = (function(){ if (this._input.substr(this._pos).match(/^[A-Z]/) !== null) { - var result272 = this._input[this._pos]; + var result270 = this._input[this._pos]; this._pos++; } else { - var result272 = null; + var result270 = null; if (context.reportMatchFailures) { this._matchFailed(new PEG.Parser.ClassMatchFailure("A-Z")); } @@ -2750,9 +2733,9 @@ PEG.grammarParser = (function(){ this._cache["upperCaseLetter"][pos] = { nextPos: this._pos, - result: result272 + result: result270 }; - return result272; + return result270; }; result._parse___ = function(context) { @@ -2766,38 +2749,38 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var result273 = []; - var result277 = this._parse_whitespace(context); - if (result277 !== null) { - var result274 = result277; + var result271 = []; + var result275 = this._parse_whitespace(context); + if (result275 !== null) { + var result272 = result275; } else { - var result276 = this._parse_eol(context); - if (result276 !== null) { - var result274 = result276; + var result274 = this._parse_eol(context); + if (result274 !== null) { + var result272 = result274; } else { - var result275 = this._parse_comment(context); - if (result275 !== null) { - var result274 = result275; + var result273 = this._parse_comment(context); + if (result273 !== null) { + var result272 = result273; } else { - var result274 = null;; + var result272 = null;; }; }; } - while (result274 !== null) { - result273.push(result274); - var result277 = this._parse_whitespace(context); - if (result277 !== null) { - var result274 = result277; + while (result272 !== null) { + result271.push(result272); + var result275 = this._parse_whitespace(context); + if (result275 !== null) { + var result272 = result275; } else { - var result276 = this._parse_eol(context); - if (result276 !== null) { - var result274 = result276; + var result274 = this._parse_eol(context); + if (result274 !== null) { + var result272 = result274; } else { - var result275 = this._parse_comment(context); - if (result275 !== null) { - var result274 = result275; + var result273 = this._parse_comment(context); + if (result273 !== null) { + var result272 = result273; } else { - var result274 = null;; + var result272 = null;; }; }; } @@ -2807,9 +2790,9 @@ PEG.grammarParser = (function(){ this._cache["__"][pos] = { nextPos: this._pos, - result: result273 + result: result271 }; - return result273; + return result271; }; result._parse_comment = function(context) { @@ -2824,27 +2807,27 @@ PEG.grammarParser = (function(){ var savedReportMatchFailures = context.reportMatchFailures; context.reportMatchFailures = false; - var result280 = this._parse_singleLineComment(context); - if (result280 !== null) { - var result278 = result280; + var result278 = this._parse_singleLineComment(context); + if (result278 !== null) { + var result276 = result278; } else { - var result279 = this._parse_multiLineComment(context); - if (result279 !== null) { - var result278 = result279; + var result277 = this._parse_multiLineComment(context); + if (result277 !== null) { + var result276 = result277; } else { - var result278 = null;; + var result276 = null;; }; } context.reportMatchFailures = savedReportMatchFailures; - if (context.reportMatchFailures && result278 === null) { + if (context.reportMatchFailures && result276 === null) { this._matchFailed(new PEG.Parser.NamedRuleMatchFailure("comment")); } this._cache["comment"][pos] = { nextPos: this._pos, - result: result278 + result: result276 }; - return result278; + return result276; }; result._parse_singleLineComment = function(context) { @@ -2858,103 +2841,103 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var savedPos49 = this._pos; + var savedPos47 = this._pos; if (this._input.substr(this._pos, 2) === "//") { - var result282 = "//"; + var result280 = "//"; this._pos += 2; } else { - var result282 = null; + var result280 = null; if (context.reportMatchFailures) { this._matchFailed(new PEG.Parser.LiteralMatchFailure("//")); } } - if (result282 !== null) { - var result283 = []; - var savedPos50 = this._pos; - var savedPos51 = this._pos; - var savedReportMatchFailuresVar7 = context.reportMatchFailures; + if (result280 !== null) { + var result281 = []; + var savedPos48 = this._pos; + var savedPos49 = this._pos; + var savedReportMatchFailuresVar6 = context.reportMatchFailures; context.reportMatchFailures = false; - var result287 = this._parse_eolChar(context); - context.reportMatchFailures = savedReportMatchFailuresVar7; - if (result287 === null) { - var result285 = ''; + var result285 = this._parse_eolChar(context); + context.reportMatchFailures = savedReportMatchFailuresVar6; + if (result285 === null) { + var result283 = ''; } else { - var result285 = null; - this._pos = savedPos51; + var result283 = null; + this._pos = savedPos49; } - if (result285 !== null) { + if (result283 !== null) { if (this._input.length > this._pos) { - var result286 = this._input[this._pos]; + var result284 = this._input[this._pos]; this._pos++; } else { - var result286 = null; + var result284 = null; if (context.reportMatchFailures) { this._matchFailed(new PEG.Parser.AnyMatchFailure()); } } - if (result286 !== null) { - var result284 = [result285, result286]; + if (result284 !== null) { + var result282 = [result283, result284]; } else { - var result284 = null; - this._pos = savedPos50; + var result282 = null; + this._pos = savedPos48; } } else { - var result284 = null; - this._pos = savedPos50; + var result282 = null; + this._pos = savedPos48; } - while (result284 !== null) { - result283.push(result284); - var savedPos50 = this._pos; - var savedPos51 = this._pos; - var savedReportMatchFailuresVar7 = context.reportMatchFailures; + while (result282 !== null) { + result281.push(result282); + var savedPos48 = this._pos; + var savedPos49 = this._pos; + var savedReportMatchFailuresVar6 = context.reportMatchFailures; context.reportMatchFailures = false; - var result287 = this._parse_eolChar(context); - context.reportMatchFailures = savedReportMatchFailuresVar7; - if (result287 === null) { - var result285 = ''; + var result285 = this._parse_eolChar(context); + context.reportMatchFailures = savedReportMatchFailuresVar6; + if (result285 === null) { + var result283 = ''; } else { - var result285 = null; - this._pos = savedPos51; + var result283 = null; + this._pos = savedPos49; } - if (result285 !== null) { + if (result283 !== null) { if (this._input.length > this._pos) { - var result286 = this._input[this._pos]; + var result284 = this._input[this._pos]; this._pos++; } else { - var result286 = null; + var result284 = null; if (context.reportMatchFailures) { this._matchFailed(new PEG.Parser.AnyMatchFailure()); } } - if (result286 !== null) { - var result284 = [result285, result286]; + if (result284 !== null) { + var result282 = [result283, result284]; } else { - var result284 = null; - this._pos = savedPos50; + var result282 = null; + this._pos = savedPos48; } } else { - var result284 = null; - this._pos = savedPos50; + var result282 = null; + this._pos = savedPos48; } } - if (result283 !== null) { - var result281 = [result282, result283]; + if (result281 !== null) { + var result279 = [result280, result281]; } else { - var result281 = null; - this._pos = savedPos49; + var result279 = null; + this._pos = savedPos47; } } else { - var result281 = null; - this._pos = savedPos49; + var result279 = null; + this._pos = savedPos47; } this._cache["singleLineComment"][pos] = { nextPos: this._pos, - result: result281 + result: result279 }; - return result281; + return result279; }; result._parse_multiLineComment = function(context) { @@ -2968,133 +2951,133 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var savedPos52 = this._pos; + var savedPos50 = this._pos; if (this._input.substr(this._pos, 2) === "/*") { - var result289 = "/*"; + var result287 = "/*"; this._pos += 2; } else { - var result289 = null; + var result287 = null; if (context.reportMatchFailures) { this._matchFailed(new PEG.Parser.LiteralMatchFailure("/*")); } } - if (result289 !== null) { - var result290 = []; - var savedPos53 = this._pos; - var savedPos54 = this._pos; - var savedReportMatchFailuresVar8 = context.reportMatchFailures; + if (result287 !== null) { + var result288 = []; + var savedPos51 = this._pos; + var savedPos52 = this._pos; + var savedReportMatchFailuresVar7 = context.reportMatchFailures; context.reportMatchFailures = false; if (this._input.substr(this._pos, 2) === "*/") { - var result295 = "*/"; + var result293 = "*/"; this._pos += 2; } else { - var result295 = null; + var result293 = null; if (context.reportMatchFailures) { this._matchFailed(new PEG.Parser.LiteralMatchFailure("*/")); } } - context.reportMatchFailures = savedReportMatchFailuresVar8; - if (result295 === null) { - var result293 = ''; + context.reportMatchFailures = savedReportMatchFailuresVar7; + if (result293 === null) { + var result291 = ''; } else { - var result293 = null; - this._pos = savedPos54; + var result291 = null; + this._pos = savedPos52; } - if (result293 !== null) { + if (result291 !== null) { if (this._input.length > this._pos) { - var result294 = this._input[this._pos]; + var result292 = this._input[this._pos]; this._pos++; } else { - var result294 = null; + var result292 = null; if (context.reportMatchFailures) { this._matchFailed(new PEG.Parser.AnyMatchFailure()); } } - if (result294 !== null) { - var result292 = [result293, result294]; + if (result292 !== null) { + var result290 = [result291, result292]; } else { - var result292 = null; - this._pos = savedPos53; + var result290 = null; + this._pos = savedPos51; } } else { - var result292 = null; - this._pos = savedPos53; + var result290 = null; + this._pos = savedPos51; } - while (result292 !== null) { - result290.push(result292); - var savedPos53 = this._pos; - var savedPos54 = this._pos; - var savedReportMatchFailuresVar8 = context.reportMatchFailures; + while (result290 !== null) { + result288.push(result290); + var savedPos51 = this._pos; + var savedPos52 = this._pos; + var savedReportMatchFailuresVar7 = context.reportMatchFailures; context.reportMatchFailures = false; if (this._input.substr(this._pos, 2) === "*/") { - var result295 = "*/"; + var result293 = "*/"; this._pos += 2; } else { - var result295 = null; + var result293 = null; if (context.reportMatchFailures) { this._matchFailed(new PEG.Parser.LiteralMatchFailure("*/")); } } - context.reportMatchFailures = savedReportMatchFailuresVar8; - if (result295 === null) { - var result293 = ''; + context.reportMatchFailures = savedReportMatchFailuresVar7; + if (result293 === null) { + var result291 = ''; } else { - var result293 = null; - this._pos = savedPos54; + var result291 = null; + this._pos = savedPos52; } - if (result293 !== null) { + if (result291 !== null) { if (this._input.length > this._pos) { - var result294 = this._input[this._pos]; + var result292 = this._input[this._pos]; this._pos++; } else { - var result294 = null; + var result292 = null; if (context.reportMatchFailures) { this._matchFailed(new PEG.Parser.AnyMatchFailure()); } } - if (result294 !== null) { - var result292 = [result293, result294]; + if (result292 !== null) { + var result290 = [result291, result292]; } else { - var result292 = null; - this._pos = savedPos53; + var result290 = null; + this._pos = savedPos51; } } else { - var result292 = null; - this._pos = savedPos53; + var result290 = null; + this._pos = savedPos51; } } - if (result290 !== null) { + if (result288 !== null) { if (this._input.substr(this._pos, 2) === "*/") { - var result291 = "*/"; + var result289 = "*/"; this._pos += 2; } else { - var result291 = null; + var result289 = null; if (context.reportMatchFailures) { this._matchFailed(new PEG.Parser.LiteralMatchFailure("*/")); } } - if (result291 !== null) { - var result288 = [result289, result290, result291]; + if (result289 !== null) { + var result286 = [result287, result288, result289]; } else { - var result288 = null; - this._pos = savedPos52; + var result286 = null; + this._pos = savedPos50; } } else { - var result288 = null; - this._pos = savedPos52; + var result286 = null; + this._pos = savedPos50; } } else { - var result288 = null; - this._pos = savedPos52; + var result286 = null; + this._pos = savedPos50; } this._cache["multiLineComment"][pos] = { nextPos: this._pos, - result: result288 + result: result286 }; - return result288; + return result286; }; result._parse_eol = function(context) { @@ -3110,81 +3093,81 @@ PEG.grammarParser = (function(){ var savedReportMatchFailures = context.reportMatchFailures; context.reportMatchFailures = false; if (this._input.substr(this._pos, 1) === "\n") { - var result301 = "\n"; + var result299 = "\n"; this._pos += 1; } else { - var result301 = null; + var result299 = null; if (context.reportMatchFailures) { this._matchFailed(new PEG.Parser.LiteralMatchFailure("\n")); } } - if (result301 !== null) { - var result296 = result301; + if (result299 !== null) { + var result294 = result299; } else { if (this._input.substr(this._pos, 2) === "\r\n") { - var result300 = "\r\n"; + var result298 = "\r\n"; this._pos += 2; } else { - var result300 = null; + var result298 = null; if (context.reportMatchFailures) { this._matchFailed(new PEG.Parser.LiteralMatchFailure("\r\n")); } } - if (result300 !== null) { - var result296 = result300; + if (result298 !== null) { + var result294 = result298; } else { if (this._input.substr(this._pos, 1) === "\r") { - var result299 = "\r"; + var result297 = "\r"; this._pos += 1; } else { - var result299 = null; + var result297 = null; if (context.reportMatchFailures) { this._matchFailed(new PEG.Parser.LiteralMatchFailure("\r")); } } - if (result299 !== null) { - var result296 = result299; + if (result297 !== null) { + var result294 = result297; } else { if (this._input.substr(this._pos, 1) === "\u2028") { - var result298 = "\u2028"; + var result296 = "\u2028"; this._pos += 1; } else { - var result298 = null; + var result296 = null; if (context.reportMatchFailures) { this._matchFailed(new PEG.Parser.LiteralMatchFailure("\u2028")); } } - if (result298 !== null) { - var result296 = result298; + if (result296 !== null) { + var result294 = result296; } else { if (this._input.substr(this._pos, 1) === "\u2029") { - var result297 = "\u2029"; + var result295 = "\u2029"; this._pos += 1; } else { - var result297 = null; + var result295 = null; if (context.reportMatchFailures) { this._matchFailed(new PEG.Parser.LiteralMatchFailure("\u2029")); } } - if (result297 !== null) { - var result296 = result297; + if (result295 !== null) { + var result294 = result295; } else { - var result296 = null;; + var result294 = null;; }; }; }; }; } context.reportMatchFailures = savedReportMatchFailures; - if (context.reportMatchFailures && result296 === null) { + if (context.reportMatchFailures && result294 === null) { this._matchFailed(new PEG.Parser.NamedRuleMatchFailure("end of line")); } this._cache["eol"][pos] = { nextPos: this._pos, - result: result296 + result: result294 }; - return result296; + return result294; }; result._parse_eolChar = function(context) { @@ -3199,10 +3182,10 @@ PEG.grammarParser = (function(){ if (this._input.substr(this._pos).match(/^[\n\r\u2028\u2029]/) !== null) { - var result302 = this._input[this._pos]; + var result300 = this._input[this._pos]; this._pos++; } else { - var result302 = null; + var result300 = null; if (context.reportMatchFailures) { this._matchFailed(new PEG.Parser.ClassMatchFailure("\\n\\r\\u2028\\u2029")); } @@ -3212,9 +3195,9 @@ PEG.grammarParser = (function(){ this._cache["eolChar"][pos] = { nextPos: this._pos, - result: result302 + result: result300 }; - return result302; + return result300; }; result._parse_whitespace = function(context) { @@ -3230,24 +3213,24 @@ PEG.grammarParser = (function(){ var savedReportMatchFailures = context.reportMatchFailures; context.reportMatchFailures = false; if (this._input.substr(this._pos).match(/^[   ᠎ -    ]/) !== null) { - var result303 = this._input[this._pos]; + var result301 = this._input[this._pos]; this._pos++; } else { - var result303 = null; + var result301 = null; if (context.reportMatchFailures) { this._matchFailed(new PEG.Parser.ClassMatchFailure("   ᠎ -    ")); } } context.reportMatchFailures = savedReportMatchFailures; - if (context.reportMatchFailures && result303 === null) { + if (context.reportMatchFailures && result301 === null) { this._matchFailed(new PEG.Parser.NamedRuleMatchFailure("whitespace")); } this._cache["whitespace"][pos] = { nextPos: this._pos, - result: result303 + result: result301 }; - return result303; + return result301; }; return result; diff --git a/lib/metagrammar.pegjs b/lib/metagrammar.pegjs index c39a388..0200c77 100644 --- a/lib/metagrammar.pegjs +++ b/lib/metagrammar.pegjs @@ -63,7 +63,7 @@ braced: "{" (braced / nonBraceCharacter)* "}" { return $1 + $2.join("") + $3; } nonBraceCharacters: nonBraceCharacter+ { return $1.join(""); } -nonBraceCharacter: !("{" / "}") . { return $2; } +nonBraceCharacter: [^{}] { return $1; } colon: ":" __ { return $1; } slash: "/" __ { return $1; } @@ -125,8 +125,8 @@ singleQuotedCharacter simpleSingleQuotedCharacter: !("'" / "\\" / eolChar) . { return $2; } -class "character class": "[" (classCharacterRange / classCharacter)* "]" __ { - return $2.join(""); +class "character class": "[" "^"? (classCharacterRange / classCharacter)* "]" __ { + return $2 + $3.join(""); } classCharacterRange: bracketDelimitedCharacter "-" bracketDelimitedCharacter { diff --git a/test/compiler-test.js b/test/compiler-test.js index 990443a..cb03d2c 100644 --- a/test/compiler-test.js +++ b/test/compiler-test.js @@ -205,6 +205,19 @@ test("classes", function() { doesNotParse(nonEmptyClassParser, ""); doesNotParse(nonEmptyClassParser, "ab"); + var invertedEmptyClassParser = PEG.buildParser('start: []'); + doesNotParse(invertedEmptyClassParser, ""); + doesNotParse(invertedEmptyClassParser, "a"); + doesNotParse(invertedEmptyClassParser, "ab"); + + var invertedNonEmptyClassParser = PEG.buildParser('start: [^ab-d]'); + doesNotParse(invertedNonEmptyClassParser, "a", "a"); + doesNotParse(invertedNonEmptyClassParser, "b", "b"); + doesNotParse(invertedNonEmptyClassParser, "c", "c"); + doesNotParse(invertedNonEmptyClassParser, "d", "d"); + doesNotParse(invertedNonEmptyClassParser, ""); + doesNotParse(invertedNonEmptyClassParser, "ab"); + /* * Test that the parsing position moves forward after successful parsing of * a class. diff --git a/test/metagrammar-test.js b/test/metagrammar-test.js index bb13a28..423ee6d 100644 --- a/test/metagrammar-test.js +++ b/test/metagrammar-test.js @@ -276,6 +276,7 @@ with (PEG.Grammar) { test("parses class", function() { grammarParserParses("start: []", classGrammar("")); grammarParserParses("start: [a-d]", classGrammar("a-d")); + grammarParserParses("start: [^a-d]", classGrammar("^a-d")); grammarParserParses("start: [a]", classGrammar("a")); grammarParserParses("start: [a-de-hi-l]", classGrammar("a-de-hi-l"));