From 570658756a4dcf233be143c09f134834d59303c9 Mon Sep 17 00:00:00 2001 From: David Majda Date: Mon, 31 May 2010 12:48:43 +0200 Subject: [PATCH] Remove useless action from the metagrammar --- lib/metagrammar.js | 1409 ++++++++++++++++++++--------------------- lib/metagrammar.pegjs | 2 +- 2 files changed, 704 insertions(+), 707 deletions(-) diff --git a/lib/metagrammar.js b/lib/metagrammar.js index f1566c3..bc2817f 100644 --- a/lib/metagrammar.js +++ b/lib/metagrammar.js @@ -801,17 +801,14 @@ PEG.grammarParser = (function(){ if (this._input.substr(this._pos).match(/^[^{}]/) !== null) { - var result89 = this._input.charAt(this._pos); + var result88 = this._input.charAt(this._pos); this._pos++; } else { - var result89 = null; + var result88 = null; if (context.reportMatchFailures) { this._matchFailed("[^{}]"); } } - var result88 = result89 !== null - ? (function($1) { return $1; })(result89) - : null; @@ -835,37 +832,37 @@ PEG.grammarParser = (function(){ var savedPos16 = this._pos; if (this._input.substr(this._pos, 1) === ":") { - var result92 = ":"; + var result91 = ":"; this._pos += 1; } else { - var result92 = null; + var result91 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString(":")); } } - if (result92 !== null) { - var result93 = this._parse___(context); - if (result93 !== null) { - var result91 = [result92, result93]; + if (result91 !== null) { + var result92 = this._parse___(context); + if (result92 !== null) { + var result90 = [result91, result92]; } else { - var result91 = null; + var result90 = null; this._pos = savedPos16; } } else { - var result91 = null; + var result90 = null; this._pos = savedPos16; } - var result90 = result91 !== null - ? (function($1, $2) { return $1; }).apply(null, result91) + var result89 = result90 !== null + ? (function($1, $2) { return $1; }).apply(null, result90) : null; this._cache[cacheKey] = { nextPos: this._pos, - result: result90 + result: result89 }; - return result90; + return result89; }, _parse_slash: function(context) { @@ -881,37 +878,37 @@ PEG.grammarParser = (function(){ var savedPos17 = this._pos; if (this._input.substr(this._pos, 1) === "/") { - var result96 = "/"; + var result95 = "/"; this._pos += 1; } else { - var result96 = null; + var result95 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("/")); } } - if (result96 !== null) { - var result97 = this._parse___(context); - if (result97 !== null) { - var result95 = [result96, result97]; + if (result95 !== null) { + var result96 = this._parse___(context); + if (result96 !== null) { + var result94 = [result95, result96]; } else { - var result95 = null; + var result94 = null; this._pos = savedPos17; } } else { - var result95 = null; + var result94 = null; this._pos = savedPos17; } - var result94 = result95 !== null - ? (function($1, $2) { return $1; }).apply(null, result95) + var result93 = result94 !== null + ? (function($1, $2) { return $1; }).apply(null, result94) : null; this._cache[cacheKey] = { nextPos: this._pos, - result: result94 + result: result93 }; - return result94; + return result93; }, _parse_and: function(context) { @@ -927,37 +924,37 @@ PEG.grammarParser = (function(){ var savedPos18 = this._pos; if (this._input.substr(this._pos, 1) === "&") { - var result100 = "&"; + var result99 = "&"; this._pos += 1; } else { - var result100 = null; + var result99 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("&")); } } - if (result100 !== null) { - var result101 = this._parse___(context); - if (result101 !== null) { - var result99 = [result100, result101]; + if (result99 !== null) { + var result100 = this._parse___(context); + if (result100 !== null) { + var result98 = [result99, result100]; } else { - var result99 = null; + var result98 = null; this._pos = savedPos18; } } else { - var result99 = null; + var result98 = null; this._pos = savedPos18; } - var result98 = result99 !== null - ? (function($1, $2) { return $1; }).apply(null, result99) + var result97 = result98 !== null + ? (function($1, $2) { return $1; }).apply(null, result98) : null; this._cache[cacheKey] = { nextPos: this._pos, - result: result98 + result: result97 }; - return result98; + return result97; }, _parse_not: function(context) { @@ -973,37 +970,37 @@ PEG.grammarParser = (function(){ var savedPos19 = this._pos; if (this._input.substr(this._pos, 1) === "!") { - var result104 = "!"; + var result103 = "!"; this._pos += 1; } else { - var result104 = null; + var result103 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("!")); } } - if (result104 !== null) { - var result105 = this._parse___(context); - if (result105 !== null) { - var result103 = [result104, result105]; + if (result103 !== null) { + var result104 = this._parse___(context); + if (result104 !== null) { + var result102 = [result103, result104]; } else { - var result103 = null; + var result102 = null; this._pos = savedPos19; } } else { - var result103 = null; + var result102 = null; this._pos = savedPos19; } - var result102 = result103 !== null - ? (function($1, $2) { return $1; }).apply(null, result103) + var result101 = result102 !== null + ? (function($1, $2) { return $1; }).apply(null, result102) : null; this._cache[cacheKey] = { nextPos: this._pos, - result: result102 + result: result101 }; - return result102; + return result101; }, _parse_question: function(context) { @@ -1019,37 +1016,37 @@ PEG.grammarParser = (function(){ var savedPos20 = this._pos; if (this._input.substr(this._pos, 1) === "?") { - var result108 = "?"; + var result107 = "?"; this._pos += 1; } else { - var result108 = null; + var result107 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("?")); } } - if (result108 !== null) { - var result109 = this._parse___(context); - if (result109 !== null) { - var result107 = [result108, result109]; + if (result107 !== null) { + var result108 = this._parse___(context); + if (result108 !== null) { + var result106 = [result107, result108]; } else { - var result107 = null; + var result106 = null; this._pos = savedPos20; } } else { - var result107 = null; + var result106 = null; this._pos = savedPos20; } - var result106 = result107 !== null - ? (function($1, $2) { return $1; }).apply(null, result107) + var result105 = result106 !== null + ? (function($1, $2) { return $1; }).apply(null, result106) : null; this._cache[cacheKey] = { nextPos: this._pos, - result: result106 + result: result105 }; - return result106; + return result105; }, _parse_star: function(context) { @@ -1065,37 +1062,37 @@ PEG.grammarParser = (function(){ var savedPos21 = this._pos; if (this._input.substr(this._pos, 1) === "*") { - var result112 = "*"; + var result111 = "*"; this._pos += 1; } else { - var result112 = null; + var result111 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("*")); } } - if (result112 !== null) { - var result113 = this._parse___(context); - if (result113 !== null) { - var result111 = [result112, result113]; + if (result111 !== null) { + var result112 = this._parse___(context); + if (result112 !== null) { + var result110 = [result111, result112]; } else { - var result111 = null; + var result110 = null; this._pos = savedPos21; } } else { - var result111 = null; + var result110 = null; this._pos = savedPos21; } - var result110 = result111 !== null - ? (function($1, $2) { return $1; }).apply(null, result111) + var result109 = result110 !== null + ? (function($1, $2) { return $1; }).apply(null, result110) : null; this._cache[cacheKey] = { nextPos: this._pos, - result: result110 + result: result109 }; - return result110; + return result109; }, _parse_plus: function(context) { @@ -1111,37 +1108,37 @@ PEG.grammarParser = (function(){ var savedPos22 = this._pos; if (this._input.substr(this._pos, 1) === "+") { - var result116 = "+"; + var result115 = "+"; this._pos += 1; } else { - var result116 = null; + var result115 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("+")); } } - if (result116 !== null) { - var result117 = this._parse___(context); - if (result117 !== null) { - var result115 = [result116, result117]; + if (result115 !== null) { + var result116 = this._parse___(context); + if (result116 !== null) { + var result114 = [result115, result116]; } else { - var result115 = null; + var result114 = null; this._pos = savedPos22; } } else { - var result115 = null; + var result114 = null; this._pos = savedPos22; } - var result114 = result115 !== null - ? (function($1, $2) { return $1; }).apply(null, result115) + var result113 = result114 !== null + ? (function($1, $2) { return $1; }).apply(null, result114) : null; this._cache[cacheKey] = { nextPos: this._pos, - result: result114 + result: result113 }; - return result114; + return result113; }, _parse_lparen: function(context) { @@ -1157,37 +1154,37 @@ PEG.grammarParser = (function(){ var savedPos23 = this._pos; if (this._input.substr(this._pos, 1) === "(") { - var result120 = "("; + var result119 = "("; this._pos += 1; } else { - var result120 = null; + var result119 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("(")); } } - if (result120 !== null) { - var result121 = this._parse___(context); - if (result121 !== null) { - var result119 = [result120, result121]; + if (result119 !== null) { + var result120 = this._parse___(context); + if (result120 !== null) { + var result118 = [result119, result120]; } else { - var result119 = null; + var result118 = null; this._pos = savedPos23; } } else { - var result119 = null; + var result118 = null; this._pos = savedPos23; } - var result118 = result119 !== null - ? (function($1, $2) { return $1; }).apply(null, result119) + var result117 = result118 !== null + ? (function($1, $2) { return $1; }).apply(null, result118) : null; this._cache[cacheKey] = { nextPos: this._pos, - result: result118 + result: result117 }; - return result118; + return result117; }, _parse_rparen: function(context) { @@ -1203,37 +1200,37 @@ PEG.grammarParser = (function(){ var savedPos24 = this._pos; if (this._input.substr(this._pos, 1) === ")") { - var result124 = ")"; + var result123 = ")"; this._pos += 1; } else { - var result124 = null; + var result123 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString(")")); } } - if (result124 !== null) { - var result125 = this._parse___(context); - if (result125 !== null) { - var result123 = [result124, result125]; + if (result123 !== null) { + var result124 = this._parse___(context); + if (result124 !== null) { + var result122 = [result123, result124]; } else { - var result123 = null; + var result122 = null; this._pos = savedPos24; } } else { - var result123 = null; + var result122 = null; this._pos = savedPos24; } - var result122 = result123 !== null - ? (function($1, $2) { return $1; }).apply(null, result123) + var result121 = result122 !== null + ? (function($1, $2) { return $1; }).apply(null, result122) : null; this._cache[cacheKey] = { nextPos: this._pos, - result: result122 + result: result121 }; - return result122; + return result121; }, _parse_dot: function(context) { @@ -1249,37 +1246,37 @@ PEG.grammarParser = (function(){ var savedPos25 = this._pos; if (this._input.substr(this._pos, 1) === ".") { - var result128 = "."; + var result127 = "."; this._pos += 1; } else { - var result128 = null; + var result127 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString(".")); } } - if (result128 !== null) { - var result129 = this._parse___(context); - if (result129 !== null) { - var result127 = [result128, result129]; + if (result127 !== null) { + var result128 = this._parse___(context); + if (result128 !== null) { + var result126 = [result127, result128]; } else { - var result127 = null; + var result126 = null; this._pos = savedPos25; } } else { - var result127 = null; + var result126 = null; this._pos = savedPos25; } - var result126 = result127 !== null - ? (function($1, $2) { return $1; }).apply(null, result127) + var result125 = result126 !== null + ? (function($1, $2) { return $1; }).apply(null, result126) : null; this._cache[cacheKey] = { nextPos: this._pos, - result: result126 + result: result125 }; - return result126; + return result125; }, _parse_identifier: function(context) { @@ -1295,148 +1292,148 @@ PEG.grammarParser = (function(){ var savedReportMatchFailures = context.reportMatchFailures; context.reportMatchFailures = false; var savedPos26 = this._pos; - var result142 = this._parse_letter(context); - if (result142 !== null) { - var result132 = result142; + var result141 = this._parse_letter(context); + if (result141 !== null) { + var result131 = result141; } else { if (this._input.substr(this._pos, 1) === "_") { - var result141 = "_"; + var result140 = "_"; this._pos += 1; } else { - var result141 = null; + var result140 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("_")); } } - if (result141 !== null) { - var result132 = result141; + if (result140 !== null) { + var result131 = result140; } else { if (this._input.substr(this._pos, 1) === "$") { - var result140 = "$"; + var result139 = "$"; this._pos += 1; } else { - var result140 = null; + var result139 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("$")); } } - if (result140 !== null) { - var result132 = result140; + if (result139 !== null) { + var result131 = result139; } else { - var result132 = null;; + var result131 = null;; }; }; } - if (result132 !== null) { - var result133 = []; - var result139 = this._parse_letter(context); - if (result139 !== null) { - var result135 = result139; + if (result131 !== null) { + var result132 = []; + var result138 = this._parse_letter(context); + if (result138 !== null) { + var result134 = result138; } else { - var result138 = this._parse_digit(context); - if (result138 !== null) { - var result135 = result138; + var result137 = this._parse_digit(context); + if (result137 !== null) { + var result134 = result137; } else { if (this._input.substr(this._pos, 1) === "_") { - var result137 = "_"; + var result136 = "_"; this._pos += 1; } else { - var result137 = null; + var result136 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("_")); } } - if (result137 !== null) { - var result135 = result137; + if (result136 !== null) { + var result134 = result136; } else { if (this._input.substr(this._pos, 1) === "$") { - var result136 = "$"; + var result135 = "$"; this._pos += 1; } else { - var result136 = null; + var result135 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("$")); } } - if (result136 !== null) { - var result135 = result136; + if (result135 !== null) { + var result134 = result135; } else { - var result135 = null;; + var result134 = null;; }; }; }; } - while (result135 !== null) { - result133.push(result135); - var result139 = this._parse_letter(context); - if (result139 !== null) { - var result135 = result139; + while (result134 !== null) { + result132.push(result134); + var result138 = this._parse_letter(context); + if (result138 !== null) { + var result134 = result138; } else { - var result138 = this._parse_digit(context); - if (result138 !== null) { - var result135 = result138; + var result137 = this._parse_digit(context); + if (result137 !== null) { + var result134 = result137; } else { if (this._input.substr(this._pos, 1) === "_") { - var result137 = "_"; + var result136 = "_"; this._pos += 1; } else { - var result137 = null; + var result136 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("_")); } } - if (result137 !== null) { - var result135 = result137; + if (result136 !== null) { + var result134 = result136; } else { if (this._input.substr(this._pos, 1) === "$") { - var result136 = "$"; + var result135 = "$"; this._pos += 1; } else { - var result136 = null; + var result135 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("$")); } } - if (result136 !== null) { - var result135 = result136; + if (result135 !== null) { + var result134 = result135; } else { - var result135 = null;; + var result134 = null;; }; }; }; } } - if (result133 !== null) { - var result134 = this._parse___(context); - if (result134 !== null) { - var result131 = [result132, result133, result134]; + if (result132 !== null) { + var result133 = this._parse___(context); + if (result133 !== null) { + var result130 = [result131, result132, result133]; } else { - var result131 = null; + var result130 = null; this._pos = savedPos26; } } else { - var result131 = null; + var result130 = null; this._pos = savedPos26; } } else { - var result131 = null; + var result130 = null; this._pos = savedPos26; } - var result130 = result131 !== null + var result129 = result130 !== null ? (function($1, $2, $3) { return $1 + $2.join(""); - }).apply(null, result131) + }).apply(null, result130) : null; context.reportMatchFailures = savedReportMatchFailures; - if (context.reportMatchFailures && result130 === null) { + if (context.reportMatchFailures && result129 === null) { this._matchFailed("identifier"); } this._cache[cacheKey] = { nextPos: this._pos, - result: result130 + result: result129 }; - return result130; + return result129; }, _parse_literal: function(context) { @@ -1452,42 +1449,42 @@ PEG.grammarParser = (function(){ var savedReportMatchFailures = context.reportMatchFailures; context.reportMatchFailures = false; var savedPos27 = this._pos; - var result148 = this._parse_doubleQuotedLiteral(context); - if (result148 !== null) { - var result145 = result148; + var result147 = this._parse_doubleQuotedLiteral(context); + if (result147 !== null) { + var result144 = result147; } else { - var result147 = this._parse_singleQuotedLiteral(context); - if (result147 !== null) { - var result145 = result147; + var result146 = this._parse_singleQuotedLiteral(context); + if (result146 !== null) { + var result144 = result146; } else { - var result145 = null;; + var result144 = null;; }; } - if (result145 !== null) { - var result146 = this._parse___(context); - if (result146 !== null) { - var result144 = [result145, result146]; + if (result144 !== null) { + var result145 = this._parse___(context); + if (result145 !== null) { + var result143 = [result144, result145]; } else { - var result144 = null; + var result143 = null; this._pos = savedPos27; } } else { - var result144 = null; + var result143 = null; this._pos = savedPos27; } - var result143 = result144 !== null - ? (function($1, $2) { return $1; }).apply(null, result144) + var result142 = result143 !== null + ? (function($1, $2) { return $1; }).apply(null, result143) : null; context.reportMatchFailures = savedReportMatchFailures; - if (context.reportMatchFailures && result143 === null) { + if (context.reportMatchFailures && result142 === null) { this._matchFailed("literal"); } this._cache[cacheKey] = { nextPos: this._pos, - result: result143 + result: result142 }; - return result143; + return result142; }, _parse_doubleQuotedLiteral: function(context) { @@ -1503,56 +1500,56 @@ PEG.grammarParser = (function(){ var savedPos28 = this._pos; if (this._input.substr(this._pos, 1) === "\"") { - var result151 = "\""; + var result150 = "\""; this._pos += 1; } else { - var result151 = null; + var result150 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("\"")); } } - if (result151 !== null) { - var result152 = []; - var result154 = this._parse_doubleQuotedCharacter(context); - while (result154 !== null) { - result152.push(result154); - var result154 = this._parse_doubleQuotedCharacter(context); + if (result150 !== null) { + var result151 = []; + var result153 = this._parse_doubleQuotedCharacter(context); + while (result153 !== null) { + result151.push(result153); + var result153 = this._parse_doubleQuotedCharacter(context); } - if (result152 !== null) { + if (result151 !== null) { if (this._input.substr(this._pos, 1) === "\"") { - var result153 = "\""; + var result152 = "\""; this._pos += 1; } else { - var result153 = null; + var result152 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("\"")); } } - if (result153 !== null) { - var result150 = [result151, result152, result153]; + if (result152 !== null) { + var result149 = [result150, result151, result152]; } else { - var result150 = null; + var result149 = null; this._pos = savedPos28; } } else { - var result150 = null; + var result149 = null; this._pos = savedPos28; } } else { - var result150 = null; + var result149 = null; this._pos = savedPos28; } - var result149 = result150 !== null - ? (function($1, $2, $3) { return $2.join(""); }).apply(null, result150) + var result148 = result149 !== null + ? (function($1, $2, $3) { return $2.join(""); }).apply(null, result149) : null; this._cache[cacheKey] = { nextPos: this._pos, - result: result149 + result: result148 }; - return result149; + return result148; }, _parse_doubleQuotedCharacter: function(context) { @@ -1566,31 +1563,31 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var result161 = this._parse_simpleDoubleQuotedCharacter(context); - if (result161 !== null) { - var result155 = result161; + var result160 = this._parse_simpleDoubleQuotedCharacter(context); + if (result160 !== null) { + var result154 = result160; } else { - var result160 = this._parse_simpleEscapeSequence(context); - if (result160 !== null) { - var result155 = result160; + var result159 = this._parse_simpleEscapeSequence(context); + if (result159 !== null) { + var result154 = result159; } else { - var result159 = this._parse_zeroEscapeSequence(context); - if (result159 !== null) { - var result155 = result159; + var result158 = this._parse_zeroEscapeSequence(context); + if (result158 !== null) { + var result154 = result158; } else { - var result158 = this._parse_hexEscapeSequence(context); - if (result158 !== null) { - var result155 = result158; + var result157 = this._parse_hexEscapeSequence(context); + if (result157 !== null) { + var result154 = result157; } else { - var result157 = this._parse_unicodeEscapeSequence(context); - if (result157 !== null) { - var result155 = result157; + var result156 = this._parse_unicodeEscapeSequence(context); + if (result156 !== null) { + var result154 = result156; } else { - var result156 = this._parse_eolEscapeSequence(context); - if (result156 !== null) { - var result155 = result156; + var result155 = this._parse_eolEscapeSequence(context); + if (result155 !== null) { + var result154 = result155; } else { - var result155 = null;; + var result154 = null;; }; }; }; @@ -1602,9 +1599,9 @@ PEG.grammarParser = (function(){ this._cache[cacheKey] = { nextPos: this._pos, - result: result155 + result: result154 }; - return result155; + return result154; }, _parse_simpleDoubleQuotedCharacter: function(context) { @@ -1623,75 +1620,75 @@ PEG.grammarParser = (function(){ var savedReportMatchFailuresVar1 = context.reportMatchFailures; context.reportMatchFailures = false; if (this._input.substr(this._pos, 1) === "\"") { - var result169 = "\""; + var result168 = "\""; this._pos += 1; } else { - var result169 = null; + var result168 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("\"")); } } - if (result169 !== null) { - var result166 = result169; + if (result168 !== null) { + var result165 = result168; } else { if (this._input.substr(this._pos, 1) === "\\") { - var result168 = "\\"; + var result167 = "\\"; this._pos += 1; } else { - var result168 = null; + var result167 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("\\")); } } - if (result168 !== null) { - var result166 = result168; + if (result167 !== null) { + var result165 = result167; } else { - var result167 = this._parse_eolChar(context); - if (result167 !== null) { - var result166 = result167; + var result166 = this._parse_eolChar(context); + if (result166 !== null) { + var result165 = result166; } else { - var result166 = null;; + var result165 = null;; }; }; } context.reportMatchFailures = savedReportMatchFailuresVar1; - if (result166 === null) { - var result164 = ''; + if (result165 === null) { + var result163 = ''; } else { - var result164 = null; + var result163 = null; this._pos = savedPos30; } - if (result164 !== null) { + if (result163 !== null) { if (this._input.length > this._pos) { - var result165 = this._input.charAt(this._pos); + var result164 = this._input.charAt(this._pos); this._pos++; } else { - var result165 = null; + var result164 = null; if (context.reportMatchFailures) { this._matchFailed('any character'); } } - if (result165 !== null) { - var result163 = [result164, result165]; + if (result164 !== null) { + var result162 = [result163, result164]; } else { - var result163 = null; + var result162 = null; this._pos = savedPos29; } } else { - var result163 = null; + var result162 = null; this._pos = savedPos29; } - var result162 = result163 !== null - ? (function($1, $2) { return $2; }).apply(null, result163) + var result161 = result162 !== null + ? (function($1, $2) { return $2; }).apply(null, result162) : null; this._cache[cacheKey] = { nextPos: this._pos, - result: result162 + result: result161 }; - return result162; + return result161; }, _parse_singleQuotedLiteral: function(context) { @@ -1707,56 +1704,56 @@ PEG.grammarParser = (function(){ var savedPos31 = this._pos; if (this._input.substr(this._pos, 1) === "'") { - var result172 = "'"; + var result171 = "'"; this._pos += 1; } else { - var result172 = null; + var result171 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("'")); } } - if (result172 !== null) { - var result173 = []; - var result175 = this._parse_singleQuotedCharacter(context); - while (result175 !== null) { - result173.push(result175); - var result175 = this._parse_singleQuotedCharacter(context); + if (result171 !== null) { + var result172 = []; + var result174 = this._parse_singleQuotedCharacter(context); + while (result174 !== null) { + result172.push(result174); + var result174 = this._parse_singleQuotedCharacter(context); } - if (result173 !== null) { + if (result172 !== null) { if (this._input.substr(this._pos, 1) === "'") { - var result174 = "'"; + var result173 = "'"; this._pos += 1; } else { - var result174 = null; + var result173 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("'")); } } - if (result174 !== null) { - var result171 = [result172, result173, result174]; + if (result173 !== null) { + var result170 = [result171, result172, result173]; } else { - var result171 = null; + var result170 = null; this._pos = savedPos31; } } else { - var result171 = null; + var result170 = null; this._pos = savedPos31; } } else { - var result171 = null; + var result170 = null; this._pos = savedPos31; } - var result170 = result171 !== null - ? (function($1, $2, $3) { return $2.join(""); }).apply(null, result171) + var result169 = result170 !== null + ? (function($1, $2, $3) { return $2.join(""); }).apply(null, result170) : null; this._cache[cacheKey] = { nextPos: this._pos, - result: result170 + result: result169 }; - return result170; + return result169; }, _parse_singleQuotedCharacter: function(context) { @@ -1770,31 +1767,31 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var result182 = this._parse_simpleSingleQuotedCharacter(context); - if (result182 !== null) { - var result176 = result182; + var result181 = this._parse_simpleSingleQuotedCharacter(context); + if (result181 !== null) { + var result175 = result181; } else { - var result181 = this._parse_simpleEscapeSequence(context); - if (result181 !== null) { - var result176 = result181; + var result180 = this._parse_simpleEscapeSequence(context); + if (result180 !== null) { + var result175 = result180; } else { - var result180 = this._parse_zeroEscapeSequence(context); - if (result180 !== null) { - var result176 = result180; + var result179 = this._parse_zeroEscapeSequence(context); + if (result179 !== null) { + var result175 = result179; } else { - var result179 = this._parse_hexEscapeSequence(context); - if (result179 !== null) { - var result176 = result179; + var result178 = this._parse_hexEscapeSequence(context); + if (result178 !== null) { + var result175 = result178; } else { - var result178 = this._parse_unicodeEscapeSequence(context); - if (result178 !== null) { - var result176 = result178; + var result177 = this._parse_unicodeEscapeSequence(context); + if (result177 !== null) { + var result175 = result177; } else { - var result177 = this._parse_eolEscapeSequence(context); - if (result177 !== null) { - var result176 = result177; + var result176 = this._parse_eolEscapeSequence(context); + if (result176 !== null) { + var result175 = result176; } else { - var result176 = null;; + var result175 = null;; }; }; }; @@ -1806,9 +1803,9 @@ PEG.grammarParser = (function(){ this._cache[cacheKey] = { nextPos: this._pos, - result: result176 + result: result175 }; - return result176; + return result175; }, _parse_simpleSingleQuotedCharacter: function(context) { @@ -1827,75 +1824,75 @@ PEG.grammarParser = (function(){ var savedReportMatchFailuresVar2 = context.reportMatchFailures; context.reportMatchFailures = false; if (this._input.substr(this._pos, 1) === "'") { - var result190 = "'"; + var result189 = "'"; this._pos += 1; } else { - var result190 = null; + var result189 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("'")); } } - if (result190 !== null) { - var result187 = result190; + if (result189 !== null) { + var result186 = result189; } else { if (this._input.substr(this._pos, 1) === "\\") { - var result189 = "\\"; + var result188 = "\\"; this._pos += 1; } else { - var result189 = null; + var result188 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("\\")); } } - if (result189 !== null) { - var result187 = result189; + if (result188 !== null) { + var result186 = result188; } else { - var result188 = this._parse_eolChar(context); - if (result188 !== null) { - var result187 = result188; + var result187 = this._parse_eolChar(context); + if (result187 !== null) { + var result186 = result187; } else { - var result187 = null;; + var result186 = null;; }; }; } context.reportMatchFailures = savedReportMatchFailuresVar2; - if (result187 === null) { - var result185 = ''; + if (result186 === null) { + var result184 = ''; } else { - var result185 = null; + var result184 = null; this._pos = savedPos33; } - if (result185 !== null) { + if (result184 !== null) { if (this._input.length > this._pos) { - var result186 = this._input.charAt(this._pos); + var result185 = this._input.charAt(this._pos); this._pos++; } else { - var result186 = null; + var result185 = null; if (context.reportMatchFailures) { this._matchFailed('any character'); } } - if (result186 !== null) { - var result184 = [result185, result186]; + if (result185 !== null) { + var result183 = [result184, result185]; } else { - var result184 = null; + var result183 = null; this._pos = savedPos32; } } else { - var result184 = null; + var result183 = null; this._pos = savedPos32; } - var result183 = result184 !== null - ? (function($1, $2) { return $2; }).apply(null, result184) + var result182 = result183 !== null + ? (function($1, $2) { return $2; }).apply(null, result183) : null; this._cache[cacheKey] = { nextPos: this._pos, - result: result183 + result: result182 }; - return result183; + return result182; }, _parse_class: function(context) { @@ -1912,87 +1909,87 @@ PEG.grammarParser = (function(){ context.reportMatchFailures = false; var savedPos34 = this._pos; if (this._input.substr(this._pos, 1) === "[") { - var result193 = "["; + var result192 = "["; this._pos += 1; } else { - var result193 = null; + var result192 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("[")); } } - if (result193 !== null) { + if (result192 !== null) { if (this._input.substr(this._pos, 1) === "^") { - var result201 = "^"; + var result200 = "^"; this._pos += 1; } else { - var result201 = null; + var result200 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("^")); } } - var result194 = result201 !== null ? result201 : ''; - if (result194 !== null) { - var result195 = []; - var result200 = this._parse_classCharacterRange(context); - if (result200 !== null) { - var result198 = result200; + var result193 = result200 !== null ? result200 : ''; + if (result193 !== null) { + var result194 = []; + var result199 = this._parse_classCharacterRange(context); + if (result199 !== null) { + var result197 = result199; } else { - var result199 = this._parse_classCharacter(context); - if (result199 !== null) { - var result198 = result199; + var result198 = this._parse_classCharacter(context); + if (result198 !== null) { + var result197 = result198; } else { - var result198 = null;; + var result197 = null;; }; } - while (result198 !== null) { - result195.push(result198); - var result200 = this._parse_classCharacterRange(context); - if (result200 !== null) { - var result198 = result200; + while (result197 !== null) { + result194.push(result197); + var result199 = this._parse_classCharacterRange(context); + if (result199 !== null) { + var result197 = result199; } else { - var result199 = this._parse_classCharacter(context); - if (result199 !== null) { - var result198 = result199; + var result198 = this._parse_classCharacter(context); + if (result198 !== null) { + var result197 = result198; } else { - var result198 = null;; + var result197 = null;; }; } } - if (result195 !== null) { + if (result194 !== null) { if (this._input.substr(this._pos, 1) === "]") { - var result196 = "]"; + var result195 = "]"; this._pos += 1; } else { - var result196 = null; + var result195 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("]")); } } - if (result196 !== null) { - var result197 = this._parse___(context); - if (result197 !== null) { - var result192 = [result193, result194, result195, result196, result197]; + if (result195 !== null) { + var result196 = this._parse___(context); + if (result196 !== null) { + var result191 = [result192, result193, result194, result195, result196]; } else { - var result192 = null; + var result191 = null; this._pos = savedPos34; } } else { - var result192 = null; + var result191 = null; this._pos = savedPos34; } } else { - var result192 = null; + var result191 = null; this._pos = savedPos34; } } else { - var result192 = null; + var result191 = null; this._pos = savedPos34; } } else { - var result192 = null; + var result191 = null; this._pos = savedPos34; } - var result191 = result192 !== null + var result190 = result191 !== null ? (function($1, $2, $3, $4, $5) { parts = PEG.ArrayUtils.map($3, function(part) { return part.data; }); rawText = "[" @@ -2007,18 +2004,18 @@ PEG.grammarParser = (function(){ // FIXME: Get the raw text from the input directly. rawText: rawText }; - }).apply(null, result192) + }).apply(null, result191) : null; context.reportMatchFailures = savedReportMatchFailures; - if (context.reportMatchFailures && result191 === null) { + if (context.reportMatchFailures && result190 === null) { this._matchFailed("character class"); } this._cache[cacheKey] = { nextPos: this._pos, - result: result191 + result: result190 }; - return result191; + return result190; }, _parse_classCharacterRange: function(context) { @@ -2033,34 +2030,34 @@ PEG.grammarParser = (function(){ var savedPos35 = this._pos; - var result204 = this._parse_classCharacter(context); - if (result204 !== null) { + var result203 = this._parse_classCharacter(context); + if (result203 !== null) { if (this._input.substr(this._pos, 1) === "-") { - var result205 = "-"; + var result204 = "-"; this._pos += 1; } else { - var result205 = null; + var result204 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("-")); } } - if (result205 !== null) { - var result206 = this._parse_classCharacter(context); - if (result206 !== null) { - var result203 = [result204, result205, result206]; + if (result204 !== null) { + var result205 = this._parse_classCharacter(context); + if (result205 !== null) { + var result202 = [result203, result204, result205]; } else { - var result203 = null; + var result202 = null; this._pos = savedPos35; } } else { - var result203 = null; + var result202 = null; this._pos = savedPos35; } } else { - var result203 = null; + var result202 = null; this._pos = savedPos35; } - var result202 = result203 !== null + var result201 = result202 !== null ? (function($1, $2, $3) { if ($1.data.charCodeAt(0) > $3.data.charCodeAt(0)) { throw new this.SyntaxError( @@ -2073,16 +2070,16 @@ PEG.grammarParser = (function(){ // FIXME: Get the raw text from the input directly. rawText: $1.rawText + "-" + $3.rawText } - }).apply(null, result203) + }).apply(null, result202) : null; this._cache[cacheKey] = { nextPos: this._pos, - result: result202 + result: result201 }; - return result202; + return result201; }, _parse_classCharacter: function(context) { @@ -2096,24 +2093,24 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var result208 = this._parse_bracketDelimitedCharacter(context); - var result207 = result208 !== null + var result207 = this._parse_bracketDelimitedCharacter(context); + var result206 = result207 !== null ? (function($1) { return { data: $1, // FIXME: Get the raw text from the input directly. rawText: PEG.RegExpUtils.quoteForClass($1) }; - })(result208) + })(result207) : null; this._cache[cacheKey] = { nextPos: this._pos, - result: result207 + result: result206 }; - return result207; + return result206; }, _parse_bracketDelimitedCharacter: function(context) { @@ -2127,31 +2124,31 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var result215 = this._parse_simpleBracketDelimitedCharacter(context); - if (result215 !== null) { - var result209 = result215; + var result214 = this._parse_simpleBracketDelimitedCharacter(context); + if (result214 !== null) { + var result208 = result214; } else { - var result214 = this._parse_simpleEscapeSequence(context); - if (result214 !== null) { - var result209 = result214; + var result213 = this._parse_simpleEscapeSequence(context); + if (result213 !== null) { + var result208 = result213; } else { - var result213 = this._parse_zeroEscapeSequence(context); - if (result213 !== null) { - var result209 = result213; + var result212 = this._parse_zeroEscapeSequence(context); + if (result212 !== null) { + var result208 = result212; } else { - var result212 = this._parse_hexEscapeSequence(context); - if (result212 !== null) { - var result209 = result212; + var result211 = this._parse_hexEscapeSequence(context); + if (result211 !== null) { + var result208 = result211; } else { - var result211 = this._parse_unicodeEscapeSequence(context); - if (result211 !== null) { - var result209 = result211; + var result210 = this._parse_unicodeEscapeSequence(context); + if (result210 !== null) { + var result208 = result210; } else { - var result210 = this._parse_eolEscapeSequence(context); - if (result210 !== null) { - var result209 = result210; + var result209 = this._parse_eolEscapeSequence(context); + if (result209 !== null) { + var result208 = result209; } else { - var result209 = null;; + var result208 = null;; }; }; }; @@ -2163,9 +2160,9 @@ PEG.grammarParser = (function(){ this._cache[cacheKey] = { nextPos: this._pos, - result: result209 + result: result208 }; - return result209; + return result208; }, _parse_simpleBracketDelimitedCharacter: function(context) { @@ -2184,75 +2181,75 @@ PEG.grammarParser = (function(){ var savedReportMatchFailuresVar3 = context.reportMatchFailures; context.reportMatchFailures = false; if (this._input.substr(this._pos, 1) === "]") { - var result223 = "]"; + var result222 = "]"; this._pos += 1; } else { - var result223 = null; + var result222 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("]")); } } - if (result223 !== null) { - var result220 = result223; + if (result222 !== null) { + var result219 = result222; } else { if (this._input.substr(this._pos, 1) === "\\") { - var result222 = "\\"; + var result221 = "\\"; this._pos += 1; } else { - var result222 = null; + var result221 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("\\")); } } - if (result222 !== null) { - var result220 = result222; + if (result221 !== null) { + var result219 = result221; } else { - var result221 = this._parse_eolChar(context); - if (result221 !== null) { - var result220 = result221; + var result220 = this._parse_eolChar(context); + if (result220 !== null) { + var result219 = result220; } else { - var result220 = null;; + var result219 = null;; }; }; } context.reportMatchFailures = savedReportMatchFailuresVar3; - if (result220 === null) { - var result218 = ''; + if (result219 === null) { + var result217 = ''; } else { - var result218 = null; + var result217 = null; this._pos = savedPos37; } - if (result218 !== null) { + if (result217 !== null) { if (this._input.length > this._pos) { - var result219 = this._input.charAt(this._pos); + var result218 = this._input.charAt(this._pos); this._pos++; } else { - var result219 = null; + var result218 = null; if (context.reportMatchFailures) { this._matchFailed('any character'); } } - if (result219 !== null) { - var result217 = [result218, result219]; + if (result218 !== null) { + var result216 = [result217, result218]; } else { - var result217 = null; + var result216 = null; this._pos = savedPos36; } } else { - var result217 = null; + var result216 = null; this._pos = savedPos36; } - var result216 = result217 !== null - ? (function($1, $2) { return $2; }).apply(null, result217) + var result215 = result216 !== null + ? (function($1, $2) { return $2; }).apply(null, result216) : null; this._cache[cacheKey] = { nextPos: this._pos, - result: result216 + result: result215 }; - return result216; + return result215; }, _parse_simpleEscapeSequence: function(context) { @@ -2268,87 +2265,87 @@ PEG.grammarParser = (function(){ var savedPos38 = this._pos; if (this._input.substr(this._pos, 1) === "\\") { - var result226 = "\\"; + var result225 = "\\"; this._pos += 1; } else { - var result226 = null; + var result225 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("\\")); } } - if (result226 !== null) { + if (result225 !== null) { var savedPos39 = this._pos; var savedReportMatchFailuresVar4 = context.reportMatchFailures; context.reportMatchFailures = false; - var result233 = this._parse_digit(context); - if (result233 !== null) { - var result229 = result233; + var result232 = this._parse_digit(context); + if (result232 !== null) { + var result228 = result232; } else { if (this._input.substr(this._pos, 1) === "x") { - var result232 = "x"; + var result231 = "x"; this._pos += 1; } else { - var result232 = null; + var result231 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("x")); } } - if (result232 !== null) { - var result229 = result232; + if (result231 !== null) { + var result228 = result231; } else { if (this._input.substr(this._pos, 1) === "u") { - var result231 = "u"; + var result230 = "u"; this._pos += 1; } else { - var result231 = null; + var result230 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("u")); } } - if (result231 !== null) { - var result229 = result231; + if (result230 !== null) { + var result228 = result230; } else { - var result230 = this._parse_eolChar(context); - if (result230 !== null) { - var result229 = result230; + var result229 = this._parse_eolChar(context); + if (result229 !== null) { + var result228 = result229; } else { - var result229 = null;; + var result228 = null;; }; }; }; } context.reportMatchFailures = savedReportMatchFailuresVar4; - if (result229 === null) { - var result227 = ''; + if (result228 === null) { + var result226 = ''; } else { - var result227 = null; + var result226 = null; this._pos = savedPos39; } - if (result227 !== null) { + if (result226 !== null) { if (this._input.length > this._pos) { - var result228 = this._input.charAt(this._pos); + var result227 = this._input.charAt(this._pos); this._pos++; } else { - var result228 = null; + var result227 = null; if (context.reportMatchFailures) { this._matchFailed('any character'); } } - if (result228 !== null) { - var result225 = [result226, result227, result228]; + if (result227 !== null) { + var result224 = [result225, result226, result227]; } else { - var result225 = null; + var result224 = null; this._pos = savedPos38; } } else { - var result225 = null; + var result224 = null; this._pos = savedPos38; } } else { - var result225 = null; + var result224 = null; this._pos = savedPos38; } - var result224 = result225 !== null + var result223 = result224 !== null ? (function($1, $2, $3) { return $3 .replace("b", "\b") @@ -2357,16 +2354,16 @@ PEG.grammarParser = (function(){ .replace("r", "\r") .replace("t", "\t") .replace("v", "\x0B") // IE does not recognize "\v". - }).apply(null, result225) + }).apply(null, result224) : null; this._cache[cacheKey] = { nextPos: this._pos, - result: result224 + result: result223 }; - return result224; + return result223; }, _parse_zeroEscapeSequence: function(context) { @@ -2382,47 +2379,47 @@ PEG.grammarParser = (function(){ var savedPos40 = this._pos; if (this._input.substr(this._pos, 2) === "\\0") { - var result236 = "\\0"; + var result235 = "\\0"; this._pos += 2; } else { - var result236 = null; + var result235 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("\\0")); } } - if (result236 !== null) { + if (result235 !== null) { var savedPos41 = this._pos; var savedReportMatchFailuresVar5 = context.reportMatchFailures; context.reportMatchFailures = false; - var result238 = this._parse_digit(context); + var result237 = this._parse_digit(context); context.reportMatchFailures = savedReportMatchFailuresVar5; - if (result238 === null) { - var result237 = ''; + if (result237 === null) { + var result236 = ''; } else { - var result237 = null; + var result236 = null; this._pos = savedPos41; } - if (result237 !== null) { - var result235 = [result236, result237]; + if (result236 !== null) { + var result234 = [result235, result236]; } else { - var result235 = null; + var result234 = null; this._pos = savedPos40; } } else { - var result235 = null; + var result234 = null; this._pos = savedPos40; } - var result234 = result235 !== null - ? (function($1, $2) { return "\0"; }).apply(null, result235) + var result233 = result234 !== null + ? (function($1, $2) { return "\0"; }).apply(null, result234) : null; this._cache[cacheKey] = { nextPos: this._pos, - result: result234 + result: result233 }; - return result234; + return result233; }, _parse_hexEscapeSequence: function(context) { @@ -2438,45 +2435,45 @@ PEG.grammarParser = (function(){ var savedPos42 = this._pos; if (this._input.substr(this._pos, 2) === "\\x") { - var result241 = "\\x"; + var result240 = "\\x"; this._pos += 2; } else { - var result241 = null; + var result240 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("\\x")); } } - if (result241 !== null) { - var result242 = this._parse_hexDigit(context); - if (result242 !== null) { - var result243 = this._parse_hexDigit(context); - if (result243 !== null) { - var result240 = [result241, result242, result243]; + if (result240 !== null) { + var result241 = this._parse_hexDigit(context); + if (result241 !== null) { + var result242 = this._parse_hexDigit(context); + if (result242 !== null) { + var result239 = [result240, result241, result242]; } else { - var result240 = null; + var result239 = null; this._pos = savedPos42; } } else { - var result240 = null; + var result239 = null; this._pos = savedPos42; } } else { - var result240 = null; + var result239 = null; this._pos = savedPos42; } - var result239 = result240 !== null + var result238 = result239 !== null ? (function($1, $2, $3) { return String.fromCharCode(parseInt("0x" + $2 + $3)); - }).apply(null, result240) + }).apply(null, result239) : null; this._cache[cacheKey] = { nextPos: this._pos, - result: result239 + result: result238 }; - return result239; + return result238; }, _parse_unicodeEscapeSequence: function(context) { @@ -2492,57 +2489,57 @@ PEG.grammarParser = (function(){ var savedPos43 = this._pos; if (this._input.substr(this._pos, 2) === "\\u") { - var result246 = "\\u"; + var result245 = "\\u"; this._pos += 2; } else { - var result246 = null; + var result245 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("\\u")); } } - if (result246 !== null) { - var result247 = this._parse_hexDigit(context); - if (result247 !== null) { - var result248 = this._parse_hexDigit(context); - if (result248 !== null) { - var result249 = this._parse_hexDigit(context); - if (result249 !== null) { - var result250 = this._parse_hexDigit(context); - if (result250 !== null) { - var result245 = [result246, result247, result248, result249, result250]; + if (result245 !== null) { + var result246 = this._parse_hexDigit(context); + if (result246 !== null) { + var result247 = this._parse_hexDigit(context); + if (result247 !== null) { + var result248 = this._parse_hexDigit(context); + if (result248 !== null) { + var result249 = this._parse_hexDigit(context); + if (result249 !== null) { + var result244 = [result245, result246, result247, result248, result249]; } else { - var result245 = null; + var result244 = null; this._pos = savedPos43; } } else { - var result245 = null; + var result244 = null; this._pos = savedPos43; } } else { - var result245 = null; + var result244 = null; this._pos = savedPos43; } } else { - var result245 = null; + var result244 = null; this._pos = savedPos43; } } else { - var result245 = null; + var result244 = null; this._pos = savedPos43; } - var result244 = result245 !== null + var result243 = result244 !== null ? (function($1, $2, $3, $4, $5) { return String.fromCharCode(parseInt("0x" + $2 + $3 + $4 + $5)); - }).apply(null, result245) + }).apply(null, result244) : null; this._cache[cacheKey] = { nextPos: this._pos, - result: result244 + result: result243 }; - return result244; + return result243; }, _parse_eolEscapeSequence: function(context) { @@ -2558,37 +2555,37 @@ PEG.grammarParser = (function(){ var savedPos44 = this._pos; if (this._input.substr(this._pos, 1) === "\\") { - var result253 = "\\"; + var result252 = "\\"; this._pos += 1; } else { - var result253 = null; + var result252 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("\\")); } } - if (result253 !== null) { - var result254 = this._parse_eol(context); - if (result254 !== null) { - var result252 = [result253, result254]; + if (result252 !== null) { + var result253 = this._parse_eol(context); + if (result253 !== null) { + var result251 = [result252, result253]; } else { - var result252 = null; + var result251 = null; this._pos = savedPos44; } } else { - var result252 = null; + var result251 = null; this._pos = savedPos44; } - var result251 = result252 !== null - ? (function($1, $2) { return $2; }).apply(null, result252) + var result250 = result251 !== null + ? (function($1, $2) { return $2; }).apply(null, result251) : null; this._cache[cacheKey] = { nextPos: this._pos, - result: result251 + result: result250 }; - return result251; + return result250; }, _parse_digit: function(context) { @@ -2603,10 +2600,10 @@ PEG.grammarParser = (function(){ if (this._input.substr(this._pos).match(/^[0-9]/) !== null) { - var result255 = this._input.charAt(this._pos); + var result254 = this._input.charAt(this._pos); this._pos++; } else { - var result255 = null; + var result254 = null; if (context.reportMatchFailures) { this._matchFailed("[0-9]"); } @@ -2616,9 +2613,9 @@ PEG.grammarParser = (function(){ this._cache[cacheKey] = { nextPos: this._pos, - result: result255 + result: result254 }; - return result255; + return result254; }, _parse_hexDigit: function(context) { @@ -2633,10 +2630,10 @@ PEG.grammarParser = (function(){ if (this._input.substr(this._pos).match(/^[0-9a-fA-F]/) !== null) { - var result256 = this._input.charAt(this._pos); + var result255 = this._input.charAt(this._pos); this._pos++; } else { - var result256 = null; + var result255 = null; if (context.reportMatchFailures) { this._matchFailed("[0-9a-fA-F]"); } @@ -2646,9 +2643,9 @@ PEG.grammarParser = (function(){ this._cache[cacheKey] = { nextPos: this._pos, - result: result256 + result: result255 }; - return result256; + return result255; }, _parse_letter: function(context) { @@ -2662,15 +2659,15 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var result259 = this._parse_lowerCaseLetter(context); - if (result259 !== null) { - var result257 = result259; + var result258 = this._parse_lowerCaseLetter(context); + if (result258 !== null) { + var result256 = result258; } else { - var result258 = this._parse_upperCaseLetter(context); - if (result258 !== null) { - var result257 = result258; + var result257 = this._parse_upperCaseLetter(context); + if (result257 !== null) { + var result256 = result257; } else { - var result257 = null;; + var result256 = null;; }; } @@ -2678,9 +2675,9 @@ PEG.grammarParser = (function(){ this._cache[cacheKey] = { nextPos: this._pos, - result: result257 + result: result256 }; - return result257; + return result256; }, _parse_lowerCaseLetter: function(context) { @@ -2695,10 +2692,10 @@ PEG.grammarParser = (function(){ if (this._input.substr(this._pos).match(/^[a-z]/) !== null) { - var result260 = this._input.charAt(this._pos); + var result259 = this._input.charAt(this._pos); this._pos++; } else { - var result260 = null; + var result259 = null; if (context.reportMatchFailures) { this._matchFailed("[a-z]"); } @@ -2708,9 +2705,9 @@ PEG.grammarParser = (function(){ this._cache[cacheKey] = { nextPos: this._pos, - result: result260 + result: result259 }; - return result260; + return result259; }, _parse_upperCaseLetter: function(context) { @@ -2725,10 +2722,10 @@ PEG.grammarParser = (function(){ if (this._input.substr(this._pos).match(/^[A-Z]/) !== null) { - var result261 = this._input.charAt(this._pos); + var result260 = this._input.charAt(this._pos); this._pos++; } else { - var result261 = null; + var result260 = null; if (context.reportMatchFailures) { this._matchFailed("[A-Z]"); } @@ -2738,9 +2735,9 @@ PEG.grammarParser = (function(){ this._cache[cacheKey] = { nextPos: this._pos, - result: result261 + result: result260 }; - return result261; + return result260; }, _parse___: function(context) { @@ -2754,38 +2751,38 @@ PEG.grammarParser = (function(){ var pos = this._pos; - var result262 = []; - var result266 = this._parse_whitespace(context); - if (result266 !== null) { - var result263 = result266; + var result261 = []; + var result265 = this._parse_whitespace(context); + if (result265 !== null) { + var result262 = result265; } else { - var result265 = this._parse_eol(context); - if (result265 !== null) { - var result263 = result265; + var result264 = this._parse_eol(context); + if (result264 !== null) { + var result262 = result264; } else { - var result264 = this._parse_comment(context); - if (result264 !== null) { - var result263 = result264; + var result263 = this._parse_comment(context); + if (result263 !== null) { + var result262 = result263; } else { - var result263 = null;; + var result262 = null;; }; }; } - while (result263 !== null) { - result262.push(result263); - var result266 = this._parse_whitespace(context); - if (result266 !== null) { - var result263 = result266; + while (result262 !== null) { + result261.push(result262); + var result265 = this._parse_whitespace(context); + if (result265 !== null) { + var result262 = result265; } else { - var result265 = this._parse_eol(context); - if (result265 !== null) { - var result263 = result265; + var result264 = this._parse_eol(context); + if (result264 !== null) { + var result262 = result264; } else { - var result264 = this._parse_comment(context); - if (result264 !== null) { - var result263 = result264; + var result263 = this._parse_comment(context); + if (result263 !== null) { + var result262 = result263; } else { - var result263 = null;; + var result262 = null;; }; }; } @@ -2795,9 +2792,9 @@ PEG.grammarParser = (function(){ this._cache[cacheKey] = { nextPos: this._pos, - result: result262 + result: result261 }; - return result262; + return result261; }, _parse_comment: function(context) { @@ -2812,27 +2809,27 @@ PEG.grammarParser = (function(){ var savedReportMatchFailures = context.reportMatchFailures; context.reportMatchFailures = false; - var result269 = this._parse_singleLineComment(context); - if (result269 !== null) { - var result267 = result269; + var result268 = this._parse_singleLineComment(context); + if (result268 !== null) { + var result266 = result268; } else { - var result268 = this._parse_multiLineComment(context); - if (result268 !== null) { - var result267 = result268; + var result267 = this._parse_multiLineComment(context); + if (result267 !== null) { + var result266 = result267; } else { - var result267 = null;; + var result266 = null;; }; } context.reportMatchFailures = savedReportMatchFailures; - if (context.reportMatchFailures && result267 === null) { + if (context.reportMatchFailures && result266 === null) { this._matchFailed("comment"); } this._cache[cacheKey] = { nextPos: this._pos, - result: result267 + result: result266 }; - return result267; + return result266; }, _parse_singleLineComment: function(context) { @@ -2848,91 +2845,91 @@ PEG.grammarParser = (function(){ var savedPos45 = this._pos; if (this._input.substr(this._pos, 2) === "//") { - var result271 = "//"; + var result270 = "//"; this._pos += 2; } else { - var result271 = null; + var result270 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("//")); } } - if (result271 !== null) { - var result272 = []; + if (result270 !== null) { + var result271 = []; var savedPos46 = this._pos; var savedPos47 = this._pos; var savedReportMatchFailuresVar6 = context.reportMatchFailures; context.reportMatchFailures = false; - var result276 = this._parse_eolChar(context); + var result275 = this._parse_eolChar(context); context.reportMatchFailures = savedReportMatchFailuresVar6; - if (result276 === null) { - var result274 = ''; + if (result275 === null) { + var result273 = ''; } else { - var result274 = null; + var result273 = null; this._pos = savedPos47; } - if (result274 !== null) { + if (result273 !== null) { if (this._input.length > this._pos) { - var result275 = this._input.charAt(this._pos); + var result274 = this._input.charAt(this._pos); this._pos++; } else { - var result275 = null; + var result274 = null; if (context.reportMatchFailures) { this._matchFailed('any character'); } } - if (result275 !== null) { - var result273 = [result274, result275]; + if (result274 !== null) { + var result272 = [result273, result274]; } else { - var result273 = null; + var result272 = null; this._pos = savedPos46; } } else { - var result273 = null; + var result272 = null; this._pos = savedPos46; } - while (result273 !== null) { - result272.push(result273); + while (result272 !== null) { + result271.push(result272); var savedPos46 = this._pos; var savedPos47 = this._pos; var savedReportMatchFailuresVar6 = context.reportMatchFailures; context.reportMatchFailures = false; - var result276 = this._parse_eolChar(context); + var result275 = this._parse_eolChar(context); context.reportMatchFailures = savedReportMatchFailuresVar6; - if (result276 === null) { - var result274 = ''; + if (result275 === null) { + var result273 = ''; } else { - var result274 = null; + var result273 = null; this._pos = savedPos47; } - if (result274 !== null) { + if (result273 !== null) { if (this._input.length > this._pos) { - var result275 = this._input.charAt(this._pos); + var result274 = this._input.charAt(this._pos); this._pos++; } else { - var result275 = null; + var result274 = null; if (context.reportMatchFailures) { this._matchFailed('any character'); } } - if (result275 !== null) { - var result273 = [result274, result275]; + if (result274 !== null) { + var result272 = [result273, result274]; } else { - var result273 = null; + var result272 = null; this._pos = savedPos46; } } else { - var result273 = null; + var result272 = null; this._pos = savedPos46; } } - if (result272 !== null) { - var result270 = [result271, result272]; + if (result271 !== null) { + var result269 = [result270, result271]; } else { - var result270 = null; + var result269 = null; this._pos = savedPos45; } } else { - var result270 = null; + var result269 = null; this._pos = savedPos45; } @@ -2940,9 +2937,9 @@ PEG.grammarParser = (function(){ this._cache[cacheKey] = { nextPos: this._pos, - result: result270 + result: result269 }; - return result270; + return result269; }, _parse_multiLineComment: function(context) { @@ -2958,121 +2955,121 @@ PEG.grammarParser = (function(){ var savedPos48 = this._pos; if (this._input.substr(this._pos, 2) === "/*") { - var result278 = "/*"; + var result277 = "/*"; this._pos += 2; } else { - var result278 = null; + var result277 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("/*")); } } - if (result278 !== null) { - var result279 = []; + if (result277 !== null) { + var result278 = []; var savedPos49 = this._pos; var savedPos50 = this._pos; var savedReportMatchFailuresVar7 = context.reportMatchFailures; context.reportMatchFailures = false; if (this._input.substr(this._pos, 2) === "*/") { - var result284 = "*/"; + var result283 = "*/"; this._pos += 2; } else { - var result284 = null; + var result283 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("*/")); } } context.reportMatchFailures = savedReportMatchFailuresVar7; - if (result284 === null) { - var result282 = ''; + if (result283 === null) { + var result281 = ''; } else { - var result282 = null; + var result281 = null; this._pos = savedPos50; } - if (result282 !== null) { + if (result281 !== null) { if (this._input.length > this._pos) { - var result283 = this._input.charAt(this._pos); + var result282 = this._input.charAt(this._pos); this._pos++; } else { - var result283 = null; + var result282 = null; if (context.reportMatchFailures) { this._matchFailed('any character'); } } - if (result283 !== null) { - var result281 = [result282, result283]; + if (result282 !== null) { + var result280 = [result281, result282]; } else { - var result281 = null; + var result280 = null; this._pos = savedPos49; } } else { - var result281 = null; + var result280 = null; this._pos = savedPos49; } - while (result281 !== null) { - result279.push(result281); + while (result280 !== null) { + result278.push(result280); var savedPos49 = this._pos; var savedPos50 = this._pos; var savedReportMatchFailuresVar7 = context.reportMatchFailures; context.reportMatchFailures = false; if (this._input.substr(this._pos, 2) === "*/") { - var result284 = "*/"; + var result283 = "*/"; this._pos += 2; } else { - var result284 = null; + var result283 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("*/")); } } context.reportMatchFailures = savedReportMatchFailuresVar7; - if (result284 === null) { - var result282 = ''; + if (result283 === null) { + var result281 = ''; } else { - var result282 = null; + var result281 = null; this._pos = savedPos50; } - if (result282 !== null) { + if (result281 !== null) { if (this._input.length > this._pos) { - var result283 = this._input.charAt(this._pos); + var result282 = this._input.charAt(this._pos); this._pos++; } else { - var result283 = null; + var result282 = null; if (context.reportMatchFailures) { this._matchFailed('any character'); } } - if (result283 !== null) { - var result281 = [result282, result283]; + if (result282 !== null) { + var result280 = [result281, result282]; } else { - var result281 = null; + var result280 = null; this._pos = savedPos49; } } else { - var result281 = null; + var result280 = null; this._pos = savedPos49; } } - if (result279 !== null) { + if (result278 !== null) { if (this._input.substr(this._pos, 2) === "*/") { - var result280 = "*/"; + var result279 = "*/"; this._pos += 2; } else { - var result280 = null; + var result279 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("*/")); } } - if (result280 !== null) { - var result277 = [result278, result279, result280]; + if (result279 !== null) { + var result276 = [result277, result278, result279]; } else { - var result277 = null; + var result276 = null; this._pos = savedPos48; } } else { - var result277 = null; + var result276 = null; this._pos = savedPos48; } } else { - var result277 = null; + var result276 = null; this._pos = savedPos48; } @@ -3080,9 +3077,9 @@ PEG.grammarParser = (function(){ this._cache[cacheKey] = { nextPos: this._pos, - result: result277 + result: result276 }; - return result277; + return result276; }, _parse_eol: function(context) { @@ -3098,81 +3095,81 @@ PEG.grammarParser = (function(){ var savedReportMatchFailures = context.reportMatchFailures; context.reportMatchFailures = false; if (this._input.substr(this._pos, 1) === "\n") { - var result290 = "\n"; + var result289 = "\n"; this._pos += 1; } else { - var result290 = null; + var result289 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("\n")); } } - if (result290 !== null) { - var result285 = result290; + if (result289 !== null) { + var result284 = result289; } else { if (this._input.substr(this._pos, 2) === "\r\n") { - var result289 = "\r\n"; + var result288 = "\r\n"; this._pos += 2; } else { - var result289 = null; + var result288 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("\r\n")); } } - if (result289 !== null) { - var result285 = result289; + if (result288 !== null) { + var result284 = result288; } else { if (this._input.substr(this._pos, 1) === "\r") { - var result288 = "\r"; + var result287 = "\r"; this._pos += 1; } else { - var result288 = null; + var result287 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("\r")); } } - if (result288 !== null) { - var result285 = result288; + if (result287 !== null) { + var result284 = result287; } else { if (this._input.substr(this._pos, 1) === "\u2028") { - var result287 = "\u2028"; + var result286 = "\u2028"; this._pos += 1; } else { - var result287 = null; + var result286 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("\u2028")); } } - if (result287 !== null) { - var result285 = result287; + if (result286 !== null) { + var result284 = result286; } else { if (this._input.substr(this._pos, 1) === "\u2029") { - var result286 = "\u2029"; + var result285 = "\u2029"; this._pos += 1; } else { - var result286 = null; + var result285 = null; if (context.reportMatchFailures) { this._matchFailed(this._quoteString("\u2029")); } } - if (result286 !== null) { - var result285 = result286; + if (result285 !== null) { + var result284 = result285; } else { - var result285 = null;; + var result284 = null;; }; }; }; }; } context.reportMatchFailures = savedReportMatchFailures; - if (context.reportMatchFailures && result285 === null) { + if (context.reportMatchFailures && result284 === null) { this._matchFailed("end of line"); } this._cache[cacheKey] = { nextPos: this._pos, - result: result285 + result: result284 }; - return result285; + return result284; }, _parse_eolChar: function(context) { @@ -3187,10 +3184,10 @@ PEG.grammarParser = (function(){ if (this._input.substr(this._pos).match(/^[\n\r\u2028\u2029]/) !== null) { - var result291 = this._input.charAt(this._pos); + var result290 = this._input.charAt(this._pos); this._pos++; } else { - var result291 = null; + var result290 = null; if (context.reportMatchFailures) { this._matchFailed("[\\n\\r\\u2028\\u2029]"); } @@ -3200,9 +3197,9 @@ PEG.grammarParser = (function(){ this._cache[cacheKey] = { nextPos: this._pos, - result: result291 + result: result290 }; - return result291; + return result290; }, _parse_whitespace: function(context) { @@ -3218,24 +3215,24 @@ PEG.grammarParser = (function(){ var savedReportMatchFailures = context.reportMatchFailures; context.reportMatchFailures = false; if (this._input.substr(this._pos).match(/^[   ᠎ -    ]/) !== null) { - var result292 = this._input.charAt(this._pos); + var result291 = this._input.charAt(this._pos); this._pos++; } else { - var result292 = null; + var result291 = null; if (context.reportMatchFailures) { this._matchFailed("[   ᠎ -    ]"); } } context.reportMatchFailures = savedReportMatchFailures; - if (context.reportMatchFailures && result292 === null) { + if (context.reportMatchFailures && result291 === null) { this._matchFailed("whitespace"); } this._cache[cacheKey] = { nextPos: this._pos, - result: result292 + result: result291 }; - return result292; + return result291; }, /* diff --git a/lib/metagrammar.pegjs b/lib/metagrammar.pegjs index 35d438b..2379372 100644 --- a/lib/metagrammar.pegjs +++ b/lib/metagrammar.pegjs @@ -79,7 +79,7 @@ braced: "{" (braced / nonBraceCharacter)* "}" { return $1 + $2.join("") + $3; } nonBraceCharacters: nonBraceCharacter+ { return $1.join(""); } -nonBraceCharacter: [^{}] { return $1; } +nonBraceCharacter: [^{}] colon: ":" __ { return $1; } slash: "/" __ { return $1; }