diff --git a/lib/parser.js b/lib/parser.js index 160e21f..45d0e70 100644 --- a/lib/parser.js +++ b/lib/parser.js @@ -205,50 +205,42 @@ module.exports = (function() { peg$c79 = { type: "literal", value: "*/", description: "\"*/\"" }, peg$c80 = "//", peg$c81 = { type: "literal", value: "//", description: "\"//\"" }, - peg$c82 = { type: "other", description: "action" }, - peg$c83 = function(braced) { return braced.substr(1, braced.length - 2); }, - peg$c84 = "{", - peg$c85 = { type: "literal", value: "{", description: "\"{\"" }, - peg$c86 = "}", - peg$c87 = { type: "literal", value: "}", description: "\"}\"" }, - peg$c88 = /^[^{}]/, - peg$c89 = { type: "class", value: "[^{}]", description: "[^{}]" }, - peg$c90 = function(name) { return name; }, - peg$c91 = function(name) { + peg$c82 = function(name) { return name; }, + peg$c83 = function(name) { error("Reserved word \"" + name + "\" can't be used as an identifier."); }, - peg$c92 = { type: "other", description: "identifier" }, - peg$c93 = function(first, rest) { return first + rest.join(""); }, - peg$c94 = "_", - peg$c95 = { type: "literal", value: "_", description: "\"_\"" }, - peg$c96 = "\\", - peg$c97 = { type: "literal", value: "\\", description: "\"\\\\\"" }, - peg$c98 = function(sequence) { return sequence; }, - peg$c99 = "\u200C", - peg$c100 = { type: "literal", value: "\u200C", description: "\"\\u200C\"" }, - peg$c101 = "\u200D", - peg$c102 = { type: "literal", value: "\u200D", description: "\"\\u200D\"" }, - peg$c103 = { type: "other", description: "literal" }, - peg$c104 = "i", - peg$c105 = { type: "literal", value: "i", description: "\"i\"" }, - peg$c106 = function(value, ignoreCase) { + peg$c84 = { type: "other", description: "identifier" }, + peg$c85 = function(first, rest) { return first + rest.join(""); }, + peg$c86 = "_", + peg$c87 = { type: "literal", value: "_", description: "\"_\"" }, + peg$c88 = "\\", + peg$c89 = { type: "literal", value: "\\", description: "\"\\\\\"" }, + peg$c90 = function(sequence) { return sequence; }, + peg$c91 = "\u200C", + peg$c92 = { type: "literal", value: "\u200C", description: "\"\\u200C\"" }, + peg$c93 = "\u200D", + peg$c94 = { type: "literal", value: "\u200D", description: "\"\\u200D\"" }, + peg$c95 = { type: "other", description: "literal" }, + peg$c96 = "i", + peg$c97 = { type: "literal", value: "i", description: "\"i\"" }, + peg$c98 = function(value, ignoreCase) { return { type: "literal", value: value, ignoreCase: ignoreCase !== null }; }, - peg$c107 = { type: "other", description: "string" }, - peg$c108 = "\"", - peg$c109 = { type: "literal", value: "\"", description: "\"\\\"\"" }, - peg$c110 = function(chars) { return chars.join(""); }, - peg$c111 = "'", - peg$c112 = { type: "literal", value: "'", description: "\"'\"" }, - peg$c113 = function() { return text(); }, - peg$c114 = { type: "other", description: "character class" }, - peg$c115 = "[", - peg$c116 = { type: "literal", value: "[", description: "\"[\"" }, - peg$c117 = "^", - peg$c118 = { type: "literal", value: "^", description: "\"^\"" }, - peg$c119 = "]", - peg$c120 = { type: "literal", value: "]", description: "\"]\"" }, - peg$c121 = function(inverted, parts, ignoreCase) { + peg$c99 = { type: "other", description: "string" }, + peg$c100 = "\"", + peg$c101 = { type: "literal", value: "\"", description: "\"\\\"\"" }, + peg$c102 = function(chars) { return chars.join(""); }, + peg$c103 = "'", + peg$c104 = { type: "literal", value: "'", description: "\"'\"" }, + peg$c105 = function() { return text(); }, + peg$c106 = { type: "other", description: "character class" }, + peg$c107 = "[", + peg$c108 = { type: "literal", value: "[", description: "\"[\"" }, + peg$c109 = "^", + peg$c110 = { type: "literal", value: "^", description: "\"^\"" }, + peg$c111 = "]", + peg$c112 = { type: "literal", value: "]", description: "\"]\"" }, + peg$c113 = function(inverted, parts, ignoreCase) { return { type: "class", parts: parts, @@ -257,9 +249,9 @@ module.exports = (function() { rawText: text() }; }, - peg$c122 = "-", - peg$c123 = { type: "literal", value: "-", description: "\"-\"" }, - peg$c124 = function(begin, end) { + peg$c114 = "-", + peg$c115 = { type: "literal", value: "-", description: "\"-\"" }, + peg$c116 = function(begin, end) { if (begin.charCodeAt(0) > end.charCodeAt(0)) { error( "Invalid character range: " + text() + "." @@ -268,39 +260,47 @@ module.exports = (function() { return [begin, end]; }, - peg$c125 = function() { return ""; }, - peg$c126 = "0", - peg$c127 = { type: "literal", value: "0", description: "\"0\"" }, - peg$c128 = function() { return "\0"; }, - peg$c129 = "b", - peg$c130 = { type: "literal", value: "b", description: "\"b\"" }, - peg$c131 = function() { return "\b"; }, - peg$c132 = "f", - peg$c133 = { type: "literal", value: "f", description: "\"f\"" }, - peg$c134 = function() { return "\f"; }, - peg$c135 = "n", - peg$c136 = { type: "literal", value: "n", description: "\"n\"" }, - peg$c137 = function() { return "\n"; }, - peg$c138 = "r", - peg$c139 = { type: "literal", value: "r", description: "\"r\"" }, - peg$c140 = function() { return "\r"; }, - peg$c141 = "t", - peg$c142 = { type: "literal", value: "t", description: "\"t\"" }, - peg$c143 = function() { return "\t"; }, - peg$c144 = "v", - peg$c145 = { type: "literal", value: "v", description: "\"v\"" }, - peg$c146 = function() { return "\x0B"; }, - peg$c147 = "x", - peg$c148 = { type: "literal", value: "x", description: "\"x\"" }, - peg$c149 = "u", - peg$c150 = { type: "literal", value: "u", description: "\"u\"" }, - peg$c151 = function(digits) { + peg$c117 = function() { return ""; }, + peg$c118 = "0", + peg$c119 = { type: "literal", value: "0", description: "\"0\"" }, + peg$c120 = function() { return "\0"; }, + peg$c121 = "b", + peg$c122 = { type: "literal", value: "b", description: "\"b\"" }, + peg$c123 = function() { return "\b"; }, + peg$c124 = "f", + peg$c125 = { type: "literal", value: "f", description: "\"f\"" }, + peg$c126 = function() { return "\f"; }, + peg$c127 = "n", + peg$c128 = { type: "literal", value: "n", description: "\"n\"" }, + peg$c129 = function() { return "\n"; }, + peg$c130 = "r", + peg$c131 = { type: "literal", value: "r", description: "\"r\"" }, + peg$c132 = function() { return "\r"; }, + peg$c133 = "t", + peg$c134 = { type: "literal", value: "t", description: "\"t\"" }, + peg$c135 = function() { return "\t"; }, + peg$c136 = "v", + peg$c137 = { type: "literal", value: "v", description: "\"v\"" }, + peg$c138 = function() { return "\x0B"; }, + peg$c139 = "x", + peg$c140 = { type: "literal", value: "x", description: "\"x\"" }, + peg$c141 = "u", + peg$c142 = { type: "literal", value: "u", description: "\"u\"" }, + peg$c143 = function(digits) { return String.fromCharCode(parseInt(digits, 16)); }, - peg$c152 = /^[0-9]/, - peg$c153 = { type: "class", value: "[0-9]", description: "[0-9]" }, - peg$c154 = /^[0-9a-f]/i, - peg$c155 = { type: "class", value: "[0-9a-f]i", description: "[0-9a-f]i" }, + peg$c144 = /^[0-9]/, + peg$c145 = { type: "class", value: "[0-9]", description: "[0-9]" }, + peg$c146 = /^[0-9a-f]/i, + peg$c147 = { type: "class", value: "[0-9a-f]i", description: "[0-9a-f]i" }, + peg$c148 = { type: "other", description: "code block" }, + peg$c149 = "{", + peg$c150 = { type: "literal", value: "{", description: "\"{\"" }, + peg$c151 = "}", + peg$c152 = { type: "literal", value: "}", description: "\"}\"" }, + peg$c153 = function(code) { return code; }, + peg$c154 = /^[^{}]/, + peg$c155 = { type: "class", value: "[^{}]", description: "[^{}]" }, peg$c156 = /^[a-z\xB5\xDF-\xF6\xF8-\xFF\u0101\u0103\u0105\u0107\u0109\u010B\u010D\u010F\u0111\u0113\u0115\u0117\u0119\u011B\u011D\u011F\u0121\u0123\u0125\u0127\u0129\u012B\u012D\u012F\u0131\u0133\u0135\u0137-\u0138\u013A\u013C\u013E\u0140\u0142\u0144\u0146\u0148-\u0149\u014B\u014D\u014F\u0151\u0153\u0155\u0157\u0159\u015B\u015D\u015F\u0161\u0163\u0165\u0167\u0169\u016B\u016D\u016F\u0171\u0173\u0175\u0177\u017A\u017C\u017E-\u0180\u0183\u0185\u0188\u018C-\u018D\u0192\u0195\u0199-\u019B\u019E\u01A1\u01A3\u01A5\u01A8\u01AA-\u01AB\u01AD\u01B0\u01B4\u01B6\u01B9-\u01BA\u01BD-\u01BF\u01C6\u01C9\u01CC\u01CE\u01D0\u01D2\u01D4\u01D6\u01D8\u01DA\u01DC-\u01DD\u01DF\u01E1\u01E3\u01E5\u01E7\u01E9\u01EB\u01ED\u01EF-\u01F0\u01F3\u01F5\u01F9\u01FB\u01FD\u01FF\u0201\u0203\u0205\u0207\u0209\u020B\u020D\u020F\u0211\u0213\u0215\u0217\u0219\u021B\u021D\u021F\u0221\u0223\u0225\u0227\u0229\u022B\u022D\u022F\u0231\u0233-\u0239\u023C\u023F-\u0240\u0242\u0247\u0249\u024B\u024D\u024F-\u0293\u0295-\u02AF\u0371\u0373\u0377\u037B-\u037D\u0390\u03AC-\u03CE\u03D0-\u03D1\u03D5-\u03D7\u03D9\u03DB\u03DD\u03DF\u03E1\u03E3\u03E5\u03E7\u03E9\u03EB\u03ED\u03EF-\u03F3\u03F5\u03F8\u03FB-\u03FC\u0430-\u045F\u0461\u0463\u0465\u0467\u0469\u046B\u046D\u046F\u0471\u0473\u0475\u0477\u0479\u047B\u047D\u047F\u0481\u048B\u048D\u048F\u0491\u0493\u0495\u0497\u0499\u049B\u049D\u049F\u04A1\u04A3\u04A5\u04A7\u04A9\u04AB\u04AD\u04AF\u04B1\u04B3\u04B5\u04B7\u04B9\u04BB\u04BD\u04BF\u04C2\u04C4\u04C6\u04C8\u04CA\u04CC\u04CE-\u04CF\u04D1\u04D3\u04D5\u04D7\u04D9\u04DB\u04DD\u04DF\u04E1\u04E3\u04E5\u04E7\u04E9\u04EB\u04ED\u04EF\u04F1\u04F3\u04F5\u04F7\u04F9\u04FB\u04FD\u04FF\u0501\u0503\u0505\u0507\u0509\u050B\u050D\u050F\u0511\u0513\u0515\u0517\u0519\u051B\u051D\u051F\u0521\u0523\u0525\u0527\u0561-\u0587\u1D00-\u1D2B\u1D6B-\u1D77\u1D79-\u1D9A\u1E01\u1E03\u1E05\u1E07\u1E09\u1E0B\u1E0D\u1E0F\u1E11\u1E13\u1E15\u1E17\u1E19\u1E1B\u1E1D\u1E1F\u1E21\u1E23\u1E25\u1E27\u1E29\u1E2B\u1E2D\u1E2F\u1E31\u1E33\u1E35\u1E37\u1E39\u1E3B\u1E3D\u1E3F\u1E41\u1E43\u1E45\u1E47\u1E49\u1E4B\u1E4D\u1E4F\u1E51\u1E53\u1E55\u1E57\u1E59\u1E5B\u1E5D\u1E5F\u1E61\u1E63\u1E65\u1E67\u1E69\u1E6B\u1E6D\u1E6F\u1E71\u1E73\u1E75\u1E77\u1E79\u1E7B\u1E7D\u1E7F\u1E81\u1E83\u1E85\u1E87\u1E89\u1E8B\u1E8D\u1E8F\u1E91\u1E93\u1E95-\u1E9D\u1E9F\u1EA1\u1EA3\u1EA5\u1EA7\u1EA9\u1EAB\u1EAD\u1EAF\u1EB1\u1EB3\u1EB5\u1EB7\u1EB9\u1EBB\u1EBD\u1EBF\u1EC1\u1EC3\u1EC5\u1EC7\u1EC9\u1ECB\u1ECD\u1ECF\u1ED1\u1ED3\u1ED5\u1ED7\u1ED9\u1EDB\u1EDD\u1EDF\u1EE1\u1EE3\u1EE5\u1EE7\u1EE9\u1EEB\u1EED\u1EEF\u1EF1\u1EF3\u1EF5\u1EF7\u1EF9\u1EFB\u1EFD\u1EFF-\u1F07\u1F10-\u1F15\u1F20-\u1F27\u1F30-\u1F37\u1F40-\u1F45\u1F50-\u1F57\u1F60-\u1F67\u1F70-\u1F7D\u1F80-\u1F87\u1F90-\u1F97\u1FA0-\u1FA7\u1FB0-\u1FB4\u1FB6-\u1FB7\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FC7\u1FD0-\u1FD3\u1FD6-\u1FD7\u1FE0-\u1FE7\u1FF2-\u1FF4\u1FF6-\u1FF7\u210A\u210E-\u210F\u2113\u212F\u2134\u2139\u213C-\u213D\u2146-\u2149\u214E\u2184\u2C30-\u2C5E\u2C61\u2C65-\u2C66\u2C68\u2C6A\u2C6C\u2C71\u2C73-\u2C74\u2C76-\u2C7B\u2C81\u2C83\u2C85\u2C87\u2C89\u2C8B\u2C8D\u2C8F\u2C91\u2C93\u2C95\u2C97\u2C99\u2C9B\u2C9D\u2C9F\u2CA1\u2CA3\u2CA5\u2CA7\u2CA9\u2CAB\u2CAD\u2CAF\u2CB1\u2CB3\u2CB5\u2CB7\u2CB9\u2CBB\u2CBD\u2CBF\u2CC1\u2CC3\u2CC5\u2CC7\u2CC9\u2CCB\u2CCD\u2CCF\u2CD1\u2CD3\u2CD5\u2CD7\u2CD9\u2CDB\u2CDD\u2CDF\u2CE1\u2CE3-\u2CE4\u2CEC\u2CEE\u2CF3\u2D00-\u2D25\u2D27\u2D2D\uA641\uA643\uA645\uA647\uA649\uA64B\uA64D\uA64F\uA651\uA653\uA655\uA657\uA659\uA65B\uA65D\uA65F\uA661\uA663\uA665\uA667\uA669\uA66B\uA66D\uA681\uA683\uA685\uA687\uA689\uA68B\uA68D\uA68F\uA691\uA693\uA695\uA697\uA723\uA725\uA727\uA729\uA72B\uA72D\uA72F-\uA731\uA733\uA735\uA737\uA739\uA73B\uA73D\uA73F\uA741\uA743\uA745\uA747\uA749\uA74B\uA74D\uA74F\uA751\uA753\uA755\uA757\uA759\uA75B\uA75D\uA75F\uA761\uA763\uA765\uA767\uA769\uA76B\uA76D\uA76F\uA771-\uA778\uA77A\uA77C\uA77F\uA781\uA783\uA785\uA787\uA78C\uA78E\uA791\uA793\uA7A1\uA7A3\uA7A5\uA7A7\uA7A9\uA7FA\uFB00-\uFB06\uFB13-\uFB17\uFF41-\uFF5A]/, peg$c157 = { type: "class", value: "[\\u0061-\\u007A\\u00B5\\u00DF-\\u00F6\\u00F8-\\u00FF\\u0101\\u0103\\u0105\\u0107\\u0109\\u010B\\u010D\\u010F\\u0111\\u0113\\u0115\\u0117\\u0119\\u011B\\u011D\\u011F\\u0121\\u0123\\u0125\\u0127\\u0129\\u012B\\u012D\\u012F\\u0131\\u0133\\u0135\\u0137-\\u0138\\u013A\\u013C\\u013E\\u0140\\u0142\\u0144\\u0146\\u0148-\\u0149\\u014B\\u014D\\u014F\\u0151\\u0153\\u0155\\u0157\\u0159\\u015B\\u015D\\u015F\\u0161\\u0163\\u0165\\u0167\\u0169\\u016B\\u016D\\u016F\\u0171\\u0173\\u0175\\u0177\\u017A\\u017C\\u017E-\\u0180\\u0183\\u0185\\u0188\\u018C-\\u018D\\u0192\\u0195\\u0199-\\u019B\\u019E\\u01A1\\u01A3\\u01A5\\u01A8\\u01AA-\\u01AB\\u01AD\\u01B0\\u01B4\\u01B6\\u01B9-\\u01BA\\u01BD-\\u01BF\\u01C6\\u01C9\\u01CC\\u01CE\\u01D0\\u01D2\\u01D4\\u01D6\\u01D8\\u01DA\\u01DC-\\u01DD\\u01DF\\u01E1\\u01E3\\u01E5\\u01E7\\u01E9\\u01EB\\u01ED\\u01EF-\\u01F0\\u01F3\\u01F5\\u01F9\\u01FB\\u01FD\\u01FF\\u0201\\u0203\\u0205\\u0207\\u0209\\u020B\\u020D\\u020F\\u0211\\u0213\\u0215\\u0217\\u0219\\u021B\\u021D\\u021F\\u0221\\u0223\\u0225\\u0227\\u0229\\u022B\\u022D\\u022F\\u0231\\u0233-\\u0239\\u023C\\u023F-\\u0240\\u0242\\u0247\\u0249\\u024B\\u024D\\u024F-\\u0293\\u0295-\\u02AF\\u0371\\u0373\\u0377\\u037B-\\u037D\\u0390\\u03AC-\\u03CE\\u03D0-\\u03D1\\u03D5-\\u03D7\\u03D9\\u03DB\\u03DD\\u03DF\\u03E1\\u03E3\\u03E5\\u03E7\\u03E9\\u03EB\\u03ED\\u03EF-\\u03F3\\u03F5\\u03F8\\u03FB-\\u03FC\\u0430-\\u045F\\u0461\\u0463\\u0465\\u0467\\u0469\\u046B\\u046D\\u046F\\u0471\\u0473\\u0475\\u0477\\u0479\\u047B\\u047D\\u047F\\u0481\\u048B\\u048D\\u048F\\u0491\\u0493\\u0495\\u0497\\u0499\\u049B\\u049D\\u049F\\u04A1\\u04A3\\u04A5\\u04A7\\u04A9\\u04AB\\u04AD\\u04AF\\u04B1\\u04B3\\u04B5\\u04B7\\u04B9\\u04BB\\u04BD\\u04BF\\u04C2\\u04C4\\u04C6\\u04C8\\u04CA\\u04CC\\u04CE-\\u04CF\\u04D1\\u04D3\\u04D5\\u04D7\\u04D9\\u04DB\\u04DD\\u04DF\\u04E1\\u04E3\\u04E5\\u04E7\\u04E9\\u04EB\\u04ED\\u04EF\\u04F1\\u04F3\\u04F5\\u04F7\\u04F9\\u04FB\\u04FD\\u04FF\\u0501\\u0503\\u0505\\u0507\\u0509\\u050B\\u050D\\u050F\\u0511\\u0513\\u0515\\u0517\\u0519\\u051B\\u051D\\u051F\\u0521\\u0523\\u0525\\u0527\\u0561-\\u0587\\u1D00-\\u1D2B\\u1D6B-\\u1D77\\u1D79-\\u1D9A\\u1E01\\u1E03\\u1E05\\u1E07\\u1E09\\u1E0B\\u1E0D\\u1E0F\\u1E11\\u1E13\\u1E15\\u1E17\\u1E19\\u1E1B\\u1E1D\\u1E1F\\u1E21\\u1E23\\u1E25\\u1E27\\u1E29\\u1E2B\\u1E2D\\u1E2F\\u1E31\\u1E33\\u1E35\\u1E37\\u1E39\\u1E3B\\u1E3D\\u1E3F\\u1E41\\u1E43\\u1E45\\u1E47\\u1E49\\u1E4B\\u1E4D\\u1E4F\\u1E51\\u1E53\\u1E55\\u1E57\\u1E59\\u1E5B\\u1E5D\\u1E5F\\u1E61\\u1E63\\u1E65\\u1E67\\u1E69\\u1E6B\\u1E6D\\u1E6F\\u1E71\\u1E73\\u1E75\\u1E77\\u1E79\\u1E7B\\u1E7D\\u1E7F\\u1E81\\u1E83\\u1E85\\u1E87\\u1E89\\u1E8B\\u1E8D\\u1E8F\\u1E91\\u1E93\\u1E95-\\u1E9D\\u1E9F\\u1EA1\\u1EA3\\u1EA5\\u1EA7\\u1EA9\\u1EAB\\u1EAD\\u1EAF\\u1EB1\\u1EB3\\u1EB5\\u1EB7\\u1EB9\\u1EBB\\u1EBD\\u1EBF\\u1EC1\\u1EC3\\u1EC5\\u1EC7\\u1EC9\\u1ECB\\u1ECD\\u1ECF\\u1ED1\\u1ED3\\u1ED5\\u1ED7\\u1ED9\\u1EDB\\u1EDD\\u1EDF\\u1EE1\\u1EE3\\u1EE5\\u1EE7\\u1EE9\\u1EEB\\u1EED\\u1EEF\\u1EF1\\u1EF3\\u1EF5\\u1EF7\\u1EF9\\u1EFB\\u1EFD\\u1EFF-\\u1F07\\u1F10-\\u1F15\\u1F20-\\u1F27\\u1F30-\\u1F37\\u1F40-\\u1F45\\u1F50-\\u1F57\\u1F60-\\u1F67\\u1F70-\\u1F7D\\u1F80-\\u1F87\\u1F90-\\u1F97\\u1FA0-\\u1FA7\\u1FB0-\\u1FB4\\u1FB6-\\u1FB7\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FC7\\u1FD0-\\u1FD3\\u1FD6-\\u1FD7\\u1FE0-\\u1FE7\\u1FF2-\\u1FF4\\u1FF6-\\u1FF7\\u210A\\u210E-\\u210F\\u2113\\u212F\\u2134\\u2139\\u213C-\\u213D\\u2146-\\u2149\\u214E\\u2184\\u2C30-\\u2C5E\\u2C61\\u2C65-\\u2C66\\u2C68\\u2C6A\\u2C6C\\u2C71\\u2C73-\\u2C74\\u2C76-\\u2C7B\\u2C81\\u2C83\\u2C85\\u2C87\\u2C89\\u2C8B\\u2C8D\\u2C8F\\u2C91\\u2C93\\u2C95\\u2C97\\u2C99\\u2C9B\\u2C9D\\u2C9F\\u2CA1\\u2CA3\\u2CA5\\u2CA7\\u2CA9\\u2CAB\\u2CAD\\u2CAF\\u2CB1\\u2CB3\\u2CB5\\u2CB7\\u2CB9\\u2CBB\\u2CBD\\u2CBF\\u2CC1\\u2CC3\\u2CC5\\u2CC7\\u2CC9\\u2CCB\\u2CCD\\u2CCF\\u2CD1\\u2CD3\\u2CD5\\u2CD7\\u2CD9\\u2CDB\\u2CDD\\u2CDF\\u2CE1\\u2CE3-\\u2CE4\\u2CEC\\u2CEE\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\uA641\\uA643\\uA645\\uA647\\uA649\\uA64B\\uA64D\\uA64F\\uA651\\uA653\\uA655\\uA657\\uA659\\uA65B\\uA65D\\uA65F\\uA661\\uA663\\uA665\\uA667\\uA669\\uA66B\\uA66D\\uA681\\uA683\\uA685\\uA687\\uA689\\uA68B\\uA68D\\uA68F\\uA691\\uA693\\uA695\\uA697\\uA723\\uA725\\uA727\\uA729\\uA72B\\uA72D\\uA72F-\\uA731\\uA733\\uA735\\uA737\\uA739\\uA73B\\uA73D\\uA73F\\uA741\\uA743\\uA745\\uA747\\uA749\\uA74B\\uA74D\\uA74F\\uA751\\uA753\\uA755\\uA757\\uA759\\uA75B\\uA75D\\uA75F\\uA761\\uA763\\uA765\\uA767\\uA769\\uA76B\\uA76D\\uA76F\\uA771-\\uA778\\uA77A\\uA77C\\uA77F\\uA781\\uA783\\uA785\\uA787\\uA78C\\uA78E\\uA791\\uA793\\uA7A1\\uA7A3\\uA7A5\\uA7A7\\uA7A9\\uA7FA\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFF41-\\uFF5A]", description: "[\\u0061-\\u007A\\u00B5\\u00DF-\\u00F6\\u00F8-\\u00FF\\u0101\\u0103\\u0105\\u0107\\u0109\\u010B\\u010D\\u010F\\u0111\\u0113\\u0115\\u0117\\u0119\\u011B\\u011D\\u011F\\u0121\\u0123\\u0125\\u0127\\u0129\\u012B\\u012D\\u012F\\u0131\\u0133\\u0135\\u0137-\\u0138\\u013A\\u013C\\u013E\\u0140\\u0142\\u0144\\u0146\\u0148-\\u0149\\u014B\\u014D\\u014F\\u0151\\u0153\\u0155\\u0157\\u0159\\u015B\\u015D\\u015F\\u0161\\u0163\\u0165\\u0167\\u0169\\u016B\\u016D\\u016F\\u0171\\u0173\\u0175\\u0177\\u017A\\u017C\\u017E-\\u0180\\u0183\\u0185\\u0188\\u018C-\\u018D\\u0192\\u0195\\u0199-\\u019B\\u019E\\u01A1\\u01A3\\u01A5\\u01A8\\u01AA-\\u01AB\\u01AD\\u01B0\\u01B4\\u01B6\\u01B9-\\u01BA\\u01BD-\\u01BF\\u01C6\\u01C9\\u01CC\\u01CE\\u01D0\\u01D2\\u01D4\\u01D6\\u01D8\\u01DA\\u01DC-\\u01DD\\u01DF\\u01E1\\u01E3\\u01E5\\u01E7\\u01E9\\u01EB\\u01ED\\u01EF-\\u01F0\\u01F3\\u01F5\\u01F9\\u01FB\\u01FD\\u01FF\\u0201\\u0203\\u0205\\u0207\\u0209\\u020B\\u020D\\u020F\\u0211\\u0213\\u0215\\u0217\\u0219\\u021B\\u021D\\u021F\\u0221\\u0223\\u0225\\u0227\\u0229\\u022B\\u022D\\u022F\\u0231\\u0233-\\u0239\\u023C\\u023F-\\u0240\\u0242\\u0247\\u0249\\u024B\\u024D\\u024F-\\u0293\\u0295-\\u02AF\\u0371\\u0373\\u0377\\u037B-\\u037D\\u0390\\u03AC-\\u03CE\\u03D0-\\u03D1\\u03D5-\\u03D7\\u03D9\\u03DB\\u03DD\\u03DF\\u03E1\\u03E3\\u03E5\\u03E7\\u03E9\\u03EB\\u03ED\\u03EF-\\u03F3\\u03F5\\u03F8\\u03FB-\\u03FC\\u0430-\\u045F\\u0461\\u0463\\u0465\\u0467\\u0469\\u046B\\u046D\\u046F\\u0471\\u0473\\u0475\\u0477\\u0479\\u047B\\u047D\\u047F\\u0481\\u048B\\u048D\\u048F\\u0491\\u0493\\u0495\\u0497\\u0499\\u049B\\u049D\\u049F\\u04A1\\u04A3\\u04A5\\u04A7\\u04A9\\u04AB\\u04AD\\u04AF\\u04B1\\u04B3\\u04B5\\u04B7\\u04B9\\u04BB\\u04BD\\u04BF\\u04C2\\u04C4\\u04C6\\u04C8\\u04CA\\u04CC\\u04CE-\\u04CF\\u04D1\\u04D3\\u04D5\\u04D7\\u04D9\\u04DB\\u04DD\\u04DF\\u04E1\\u04E3\\u04E5\\u04E7\\u04E9\\u04EB\\u04ED\\u04EF\\u04F1\\u04F3\\u04F5\\u04F7\\u04F9\\u04FB\\u04FD\\u04FF\\u0501\\u0503\\u0505\\u0507\\u0509\\u050B\\u050D\\u050F\\u0511\\u0513\\u0515\\u0517\\u0519\\u051B\\u051D\\u051F\\u0521\\u0523\\u0525\\u0527\\u0561-\\u0587\\u1D00-\\u1D2B\\u1D6B-\\u1D77\\u1D79-\\u1D9A\\u1E01\\u1E03\\u1E05\\u1E07\\u1E09\\u1E0B\\u1E0D\\u1E0F\\u1E11\\u1E13\\u1E15\\u1E17\\u1E19\\u1E1B\\u1E1D\\u1E1F\\u1E21\\u1E23\\u1E25\\u1E27\\u1E29\\u1E2B\\u1E2D\\u1E2F\\u1E31\\u1E33\\u1E35\\u1E37\\u1E39\\u1E3B\\u1E3D\\u1E3F\\u1E41\\u1E43\\u1E45\\u1E47\\u1E49\\u1E4B\\u1E4D\\u1E4F\\u1E51\\u1E53\\u1E55\\u1E57\\u1E59\\u1E5B\\u1E5D\\u1E5F\\u1E61\\u1E63\\u1E65\\u1E67\\u1E69\\u1E6B\\u1E6D\\u1E6F\\u1E71\\u1E73\\u1E75\\u1E77\\u1E79\\u1E7B\\u1E7D\\u1E7F\\u1E81\\u1E83\\u1E85\\u1E87\\u1E89\\u1E8B\\u1E8D\\u1E8F\\u1E91\\u1E93\\u1E95-\\u1E9D\\u1E9F\\u1EA1\\u1EA3\\u1EA5\\u1EA7\\u1EA9\\u1EAB\\u1EAD\\u1EAF\\u1EB1\\u1EB3\\u1EB5\\u1EB7\\u1EB9\\u1EBB\\u1EBD\\u1EBF\\u1EC1\\u1EC3\\u1EC5\\u1EC7\\u1EC9\\u1ECB\\u1ECD\\u1ECF\\u1ED1\\u1ED3\\u1ED5\\u1ED7\\u1ED9\\u1EDB\\u1EDD\\u1EDF\\u1EE1\\u1EE3\\u1EE5\\u1EE7\\u1EE9\\u1EEB\\u1EED\\u1EEF\\u1EF1\\u1EF3\\u1EF5\\u1EF7\\u1EF9\\u1EFB\\u1EFD\\u1EFF-\\u1F07\\u1F10-\\u1F15\\u1F20-\\u1F27\\u1F30-\\u1F37\\u1F40-\\u1F45\\u1F50-\\u1F57\\u1F60-\\u1F67\\u1F70-\\u1F7D\\u1F80-\\u1F87\\u1F90-\\u1F97\\u1FA0-\\u1FA7\\u1FB0-\\u1FB4\\u1FB6-\\u1FB7\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FC7\\u1FD0-\\u1FD3\\u1FD6-\\u1FD7\\u1FE0-\\u1FE7\\u1FF2-\\u1FF4\\u1FF6-\\u1FF7\\u210A\\u210E-\\u210F\\u2113\\u212F\\u2134\\u2139\\u213C-\\u213D\\u2146-\\u2149\\u214E\\u2184\\u2C30-\\u2C5E\\u2C61\\u2C65-\\u2C66\\u2C68\\u2C6A\\u2C6C\\u2C71\\u2C73-\\u2C74\\u2C76-\\u2C7B\\u2C81\\u2C83\\u2C85\\u2C87\\u2C89\\u2C8B\\u2C8D\\u2C8F\\u2C91\\u2C93\\u2C95\\u2C97\\u2C99\\u2C9B\\u2C9D\\u2C9F\\u2CA1\\u2CA3\\u2CA5\\u2CA7\\u2CA9\\u2CAB\\u2CAD\\u2CAF\\u2CB1\\u2CB3\\u2CB5\\u2CB7\\u2CB9\\u2CBB\\u2CBD\\u2CBF\\u2CC1\\u2CC3\\u2CC5\\u2CC7\\u2CC9\\u2CCB\\u2CCD\\u2CCF\\u2CD1\\u2CD3\\u2CD5\\u2CD7\\u2CD9\\u2CDB\\u2CDD\\u2CDF\\u2CE1\\u2CE3-\\u2CE4\\u2CEC\\u2CEE\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\uA641\\uA643\\uA645\\uA647\\uA649\\uA64B\\uA64D\\uA64F\\uA651\\uA653\\uA655\\uA657\\uA659\\uA65B\\uA65D\\uA65F\\uA661\\uA663\\uA665\\uA667\\uA669\\uA66B\\uA66D\\uA681\\uA683\\uA685\\uA687\\uA689\\uA68B\\uA68D\\uA68F\\uA691\\uA693\\uA695\\uA697\\uA723\\uA725\\uA727\\uA729\\uA72B\\uA72D\\uA72F-\\uA731\\uA733\\uA735\\uA737\\uA739\\uA73B\\uA73D\\uA73F\\uA741\\uA743\\uA745\\uA747\\uA749\\uA74B\\uA74D\\uA74F\\uA751\\uA753\\uA755\\uA757\\uA759\\uA75B\\uA75D\\uA75F\\uA761\\uA763\\uA765\\uA767\\uA769\\uA76B\\uA76D\\uA76F\\uA771-\\uA778\\uA77A\\uA77C\\uA77F\\uA781\\uA783\\uA785\\uA787\\uA78C\\uA78E\\uA791\\uA793\\uA7A1\\uA7A3\\uA7A5\\uA7A7\\uA7A9\\uA7FA\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFF41-\\uFF5A]" }, peg$c158 = /^[\u02B0-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0374\u037A\u0559\u0640\u06E5-\u06E6\u07F4-\u07F5\u07FA\u081A\u0824\u0828\u0971\u0E46\u0EC6\u10FC\u17D7\u1843\u1AA7\u1C78-\u1C7D\u1D2C-\u1D6A\u1D78\u1D9B-\u1DBF\u2071\u207F\u2090-\u209C\u2C7C-\u2C7D\u2D6F\u2E2F\u3005\u3031-\u3035\u303B\u309D-\u309E\u30FC-\u30FE\uA015\uA4F8-\uA4FD\uA60C\uA67F\uA717-\uA71F\uA770\uA788\uA7F8-\uA7F9\uA9CF\uAA70\uAADD\uAAF3-\uAAF4\uFF70\uFF9E-\uFF9F]/, @@ -649,7 +649,7 @@ module.exports = (function() { var s0, s1, s2, s3, s4; s0 = peg$currPos; - s1 = peg$parseAction(); + s1 = peg$parseCodeBlock(); if (s1 !== peg$FAILED) { s2 = peg$currPos; s3 = peg$parse__(); @@ -925,7 +925,7 @@ module.exports = (function() { if (s2 !== peg$FAILED) { s3 = peg$parse__(); if (s3 !== peg$FAILED) { - s4 = peg$parseAction(); + s4 = peg$parseCodeBlock(); if (s4 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c13(s1, s2, s4); @@ -1094,7 +1094,7 @@ module.exports = (function() { if (s1 !== peg$FAILED) { s2 = peg$parse__(); if (s2 !== peg$FAILED) { - s3 = peg$parseAction(); + s3 = peg$parseCodeBlock(); if (s3 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c23(s3); @@ -1152,7 +1152,7 @@ module.exports = (function() { if (s1 !== peg$FAILED) { s2 = peg$parse__(); if (s2 !== peg$FAILED) { - s3 = peg$parseAction(); + s3 = peg$parseCodeBlock(); if (s3 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c27(s3); @@ -1802,122 +1802,6 @@ module.exports = (function() { return s0; } - function peg$parseAction() { - var s0, s1, s2; - - peg$silentFails++; - s0 = peg$currPos; - s1 = peg$parseBraced(); - if (s1 !== peg$FAILED) { - s2 = peg$parse__(); - if (s2 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c83(s1); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c0; - } - } else { - peg$currPos = s0; - s0 = peg$c0; - } - peg$silentFails--; - if (s0 === peg$FAILED) { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c82); } - } - - return s0; - } - - function peg$parseBraced() { - var s0, s1, s2, s3, s4; - - s0 = peg$currPos; - s1 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 123) { - s2 = peg$c84; - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c85); } - } - if (s2 !== peg$FAILED) { - s3 = []; - s4 = peg$parseBraced(); - if (s4 === peg$FAILED) { - s4 = peg$parseNonBraceCharacters(); - } - while (s4 !== peg$FAILED) { - s3.push(s4); - s4 = peg$parseBraced(); - if (s4 === peg$FAILED) { - s4 = peg$parseNonBraceCharacters(); - } - } - if (s3 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 125) { - s4 = peg$c86; - peg$currPos++; - } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c87); } - } - if (s4 !== peg$FAILED) { - s2 = [s2, s3, s4]; - s1 = s2; - } else { - peg$currPos = s1; - s1 = peg$c0; - } - } else { - peg$currPos = s1; - s1 = peg$c0; - } - } else { - peg$currPos = s1; - s1 = peg$c0; - } - if (s1 !== peg$FAILED) { - s1 = input.substring(s0, peg$currPos); - } - s0 = s1; - - return s0; - } - - function peg$parseNonBraceCharacters() { - var s0, s1; - - s0 = []; - s1 = peg$parseNonBraceCharacter(); - if (s1 !== peg$FAILED) { - while (s1 !== peg$FAILED) { - s0.push(s1); - s1 = peg$parseNonBraceCharacter(); - } - } else { - s0 = peg$c0; - } - - return s0; - } - - function peg$parseNonBraceCharacter() { - var s0; - - if (peg$c88.test(input.charAt(peg$currPos))) { - s0 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c89); } - } - - return s0; - } - function peg$parseIdentifier() { var s0, s1, s2; @@ -1936,7 +1820,7 @@ module.exports = (function() { s2 = peg$parseIdentifierName(); if (s2 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c90(s2); + s1 = peg$c82(s2); s0 = s1; } else { peg$currPos = s0; @@ -1951,7 +1835,7 @@ module.exports = (function() { s1 = peg$parseIdentifierName(); if (s1 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c91(s1); + s1 = peg$c83(s1); } s0 = s1; } @@ -1974,7 +1858,7 @@ module.exports = (function() { } if (s2 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c93(s1, s2); + s1 = peg$c85(s1, s2); s0 = s1; } else { peg$currPos = s0; @@ -1987,7 +1871,7 @@ module.exports = (function() { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c92); } + if (peg$silentFails === 0) { peg$fail(peg$c84); } } return s0; @@ -2007,26 +1891,26 @@ module.exports = (function() { } if (s0 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 95) { - s0 = peg$c94; + s0 = peg$c86; peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c95); } + if (peg$silentFails === 0) { peg$fail(peg$c87); } } if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 92) { - s1 = peg$c96; + s1 = peg$c88; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c97); } + if (peg$silentFails === 0) { peg$fail(peg$c89); } } if (s1 !== peg$FAILED) { s2 = peg$parseUnicodeEscapeSequence(); if (s2 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c98(s2); + s1 = peg$c90(s2); s0 = s1; } else { peg$currPos = s0; @@ -2055,19 +1939,19 @@ module.exports = (function() { s0 = peg$parsePc(); if (s0 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 8204) { - s0 = peg$c99; + s0 = peg$c91; peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c100); } + if (peg$silentFails === 0) { peg$fail(peg$c92); } } if (s0 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 8205) { - s0 = peg$c101; + s0 = peg$c93; peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c102); } + if (peg$silentFails === 0) { peg$fail(peg$c94); } } } } @@ -2257,18 +2141,18 @@ module.exports = (function() { s1 = peg$parseStringLiteral(); if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 105) { - s2 = peg$c104; + s2 = peg$c96; peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c105); } + if (peg$silentFails === 0) { peg$fail(peg$c97); } } if (s2 === peg$FAILED) { s2 = peg$c1; } if (s2 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c106(s1, s2); + s1 = peg$c98(s1, s2); s0 = s1; } else { peg$currPos = s0; @@ -2281,7 +2165,7 @@ module.exports = (function() { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c103); } + if (peg$silentFails === 0) { peg$fail(peg$c95); } } return s0; @@ -2293,11 +2177,11 @@ module.exports = (function() { peg$silentFails++; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 34) { - s1 = peg$c108; + s1 = peg$c100; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c109); } + if (peg$silentFails === 0) { peg$fail(peg$c101); } } if (s1 !== peg$FAILED) { s2 = []; @@ -2308,15 +2192,15 @@ module.exports = (function() { } if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 34) { - s3 = peg$c108; + s3 = peg$c100; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c109); } + if (peg$silentFails === 0) { peg$fail(peg$c101); } } if (s3 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c110(s2); + s1 = peg$c102(s2); s0 = s1; } else { peg$currPos = s0; @@ -2333,11 +2217,11 @@ module.exports = (function() { if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 39) { - s1 = peg$c111; + s1 = peg$c103; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c112); } + if (peg$silentFails === 0) { peg$fail(peg$c104); } } if (s1 !== peg$FAILED) { s2 = []; @@ -2348,15 +2232,15 @@ module.exports = (function() { } if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 39) { - s3 = peg$c111; + s3 = peg$c103; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c112); } + if (peg$silentFails === 0) { peg$fail(peg$c104); } } if (s3 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c110(s2); + s1 = peg$c102(s2); s0 = s1; } else { peg$currPos = s0; @@ -2374,7 +2258,7 @@ module.exports = (function() { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c107); } + if (peg$silentFails === 0) { peg$fail(peg$c99); } } return s0; @@ -2387,19 +2271,19 @@ module.exports = (function() { s1 = peg$currPos; peg$silentFails++; if (input.charCodeAt(peg$currPos) === 34) { - s2 = peg$c108; + s2 = peg$c100; peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c109); } + if (peg$silentFails === 0) { peg$fail(peg$c101); } } if (s2 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 92) { - s2 = peg$c96; + s2 = peg$c88; peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c97); } + if (peg$silentFails === 0) { peg$fail(peg$c89); } } if (s2 === peg$FAILED) { s2 = peg$parseLineTerminator(); @@ -2416,7 +2300,7 @@ module.exports = (function() { s2 = peg$parseSourceCharacter(); if (s2 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c113(); + s1 = peg$c105(); s0 = s1; } else { peg$currPos = s0; @@ -2429,17 +2313,17 @@ module.exports = (function() { if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 92) { - s1 = peg$c96; + s1 = peg$c88; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c97); } + if (peg$silentFails === 0) { peg$fail(peg$c89); } } if (s1 !== peg$FAILED) { s2 = peg$parseEscapeSequence(); if (s2 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c98(s2); + s1 = peg$c90(s2); s0 = s1; } else { peg$currPos = s0; @@ -2464,19 +2348,19 @@ module.exports = (function() { s1 = peg$currPos; peg$silentFails++; if (input.charCodeAt(peg$currPos) === 39) { - s2 = peg$c111; + s2 = peg$c103; peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c112); } + if (peg$silentFails === 0) { peg$fail(peg$c104); } } if (s2 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 92) { - s2 = peg$c96; + s2 = peg$c88; peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c97); } + if (peg$silentFails === 0) { peg$fail(peg$c89); } } if (s2 === peg$FAILED) { s2 = peg$parseLineTerminator(); @@ -2493,7 +2377,7 @@ module.exports = (function() { s2 = peg$parseSourceCharacter(); if (s2 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c113(); + s1 = peg$c105(); s0 = s1; } else { peg$currPos = s0; @@ -2506,17 +2390,17 @@ module.exports = (function() { if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 92) { - s1 = peg$c96; + s1 = peg$c88; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c97); } + if (peg$silentFails === 0) { peg$fail(peg$c89); } } if (s1 !== peg$FAILED) { s2 = peg$parseEscapeSequence(); if (s2 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c98(s2); + s1 = peg$c90(s2); s0 = s1; } else { peg$currPos = s0; @@ -2540,19 +2424,19 @@ module.exports = (function() { peg$silentFails++; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 91) { - s1 = peg$c115; + s1 = peg$c107; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c116); } + if (peg$silentFails === 0) { peg$fail(peg$c108); } } if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 94) { - s2 = peg$c117; + s2 = peg$c109; peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c118); } + if (peg$silentFails === 0) { peg$fail(peg$c110); } } if (s2 === peg$FAILED) { s2 = peg$c1; @@ -2572,26 +2456,26 @@ module.exports = (function() { } if (s3 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 93) { - s4 = peg$c119; + s4 = peg$c111; peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c120); } + if (peg$silentFails === 0) { peg$fail(peg$c112); } } if (s4 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 105) { - s5 = peg$c104; + s5 = peg$c96; peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c105); } + if (peg$silentFails === 0) { peg$fail(peg$c97); } } if (s5 === peg$FAILED) { s5 = peg$c1; } if (s5 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c121(s2, s3, s5); + s1 = peg$c113(s2, s3, s5); s0 = s1; } else { peg$currPos = s0; @@ -2616,7 +2500,7 @@ module.exports = (function() { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c114); } + if (peg$silentFails === 0) { peg$fail(peg$c106); } } return s0; @@ -2629,17 +2513,17 @@ module.exports = (function() { s1 = peg$parseClassCharacter(); if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 45) { - s2 = peg$c122; + s2 = peg$c114; peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c123); } + if (peg$silentFails === 0) { peg$fail(peg$c115); } } if (s2 !== peg$FAILED) { s3 = peg$parseClassCharacter(); if (s3 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c124(s1, s3); + s1 = peg$c116(s1, s3); s0 = s1; } else { peg$currPos = s0; @@ -2664,19 +2548,19 @@ module.exports = (function() { s1 = peg$currPos; peg$silentFails++; if (input.charCodeAt(peg$currPos) === 93) { - s2 = peg$c119; + s2 = peg$c111; peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c120); } + if (peg$silentFails === 0) { peg$fail(peg$c112); } } if (s2 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 92) { - s2 = peg$c96; + s2 = peg$c88; peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c97); } + if (peg$silentFails === 0) { peg$fail(peg$c89); } } if (s2 === peg$FAILED) { s2 = peg$parseLineTerminator(); @@ -2693,7 +2577,7 @@ module.exports = (function() { s2 = peg$parseSourceCharacter(); if (s2 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c113(); + s1 = peg$c105(); s0 = s1; } else { peg$currPos = s0; @@ -2706,17 +2590,17 @@ module.exports = (function() { if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 92) { - s1 = peg$c96; + s1 = peg$c88; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c97); } + if (peg$silentFails === 0) { peg$fail(peg$c89); } } if (s1 !== peg$FAILED) { s2 = peg$parseEscapeSequence(); if (s2 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c98(s2); + s1 = peg$c90(s2); s0 = s1; } else { peg$currPos = s0; @@ -2739,17 +2623,17 @@ module.exports = (function() { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 92) { - s1 = peg$c96; + s1 = peg$c88; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c97); } + if (peg$silentFails === 0) { peg$fail(peg$c89); } } if (s1 !== peg$FAILED) { s2 = peg$parseLineTerminatorSequence(); if (s2 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c125(); + s1 = peg$c117(); s0 = s1; } else { peg$currPos = s0; @@ -2770,11 +2654,11 @@ module.exports = (function() { if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 48) { - s1 = peg$c126; + s1 = peg$c118; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c127); } + if (peg$silentFails === 0) { peg$fail(peg$c119); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -2789,7 +2673,7 @@ module.exports = (function() { } if (s2 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c128(); + s1 = peg$c120(); s0 = s1; } else { peg$currPos = s0; @@ -2825,110 +2709,110 @@ module.exports = (function() { var s0, s1; if (input.charCodeAt(peg$currPos) === 39) { - s0 = peg$c111; + s0 = peg$c103; peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c112); } + if (peg$silentFails === 0) { peg$fail(peg$c104); } } if (s0 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 34) { - s0 = peg$c108; + s0 = peg$c100; peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c109); } + if (peg$silentFails === 0) { peg$fail(peg$c101); } } if (s0 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 92) { - s0 = peg$c96; + s0 = peg$c88; peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c97); } + if (peg$silentFails === 0) { peg$fail(peg$c89); } } if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 98) { - s1 = peg$c129; + s1 = peg$c121; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c130); } + if (peg$silentFails === 0) { peg$fail(peg$c122); } } if (s1 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c131(); + s1 = peg$c123(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 102) { - s1 = peg$c132; + s1 = peg$c124; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c133); } + if (peg$silentFails === 0) { peg$fail(peg$c125); } } if (s1 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c134(); + s1 = peg$c126(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 110) { - s1 = peg$c135; + s1 = peg$c127; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c136); } + if (peg$silentFails === 0) { peg$fail(peg$c128); } } if (s1 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c137(); + s1 = peg$c129(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 114) { - s1 = peg$c138; + s1 = peg$c130; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c139); } + if (peg$silentFails === 0) { peg$fail(peg$c131); } } if (s1 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c140(); + s1 = peg$c132(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 116) { - s1 = peg$c141; + s1 = peg$c133; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c142); } + if (peg$silentFails === 0) { peg$fail(peg$c134); } } if (s1 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c143(); + s1 = peg$c135(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 118) { - s1 = peg$c144; + s1 = peg$c136; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c145); } + if (peg$silentFails === 0) { peg$fail(peg$c137); } } if (s1 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c146(); + s1 = peg$c138(); } s0 = s1; } @@ -2964,7 +2848,7 @@ module.exports = (function() { s2 = peg$parseSourceCharacter(); if (s2 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c113(); + s1 = peg$c105(); s0 = s1; } else { peg$currPos = s0; @@ -2986,19 +2870,19 @@ module.exports = (function() { s0 = peg$parseDecimalDigit(); if (s0 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 120) { - s0 = peg$c147; + s0 = peg$c139; peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c148); } + if (peg$silentFails === 0) { peg$fail(peg$c140); } } if (s0 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 117) { - s0 = peg$c149; + s0 = peg$c141; peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c150); } + if (peg$silentFails === 0) { peg$fail(peg$c142); } } } } @@ -3012,11 +2896,11 @@ module.exports = (function() { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 120) { - s1 = peg$c147; + s1 = peg$c139; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c148); } + if (peg$silentFails === 0) { peg$fail(peg$c140); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -3041,7 +2925,7 @@ module.exports = (function() { s2 = s3; if (s2 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c151(s2); + s1 = peg$c143(s2); s0 = s1; } else { peg$currPos = s0; @@ -3060,11 +2944,11 @@ module.exports = (function() { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 117) { - s1 = peg$c149; + s1 = peg$c141; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c150); } + if (peg$silentFails === 0) { peg$fail(peg$c142); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -3101,7 +2985,7 @@ module.exports = (function() { s2 = s3; if (s2 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c151(s2); + s1 = peg$c143(s2); s0 = s1; } else { peg$currPos = s0; @@ -3118,12 +3002,12 @@ module.exports = (function() { function peg$parseDecimalDigit() { var s0; - if (peg$c152.test(input.charAt(peg$currPos))) { + if (peg$c144.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c153); } + if (peg$silentFails === 0) { peg$fail(peg$c145); } } return s0; @@ -3132,13 +3016,160 @@ module.exports = (function() { function peg$parseHexDigit() { var s0; - if (peg$c154.test(input.charAt(peg$currPos))) { + if (peg$c146.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c147); } + } + + return s0; + } + + function peg$parseCodeBlock() { + var s0, s1, s2, s3; + + peg$silentFails++; + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 123) { + s1 = peg$c149; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c150); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parseCode(); + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 125) { + s3 = peg$c151; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c152); } + } + if (s3 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c153(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c148); } + } + + return s0; + } + + function peg$parseCode() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + s1 = []; + if (peg$c154.test(input.charAt(peg$currPos))) { + s2 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c155); } } + if (s2 === peg$FAILED) { + s2 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 123) { + s3 = peg$c149; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c150); } + } + if (s3 !== peg$FAILED) { + s4 = peg$parseCode(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 125) { + s5 = peg$c151; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c152); } + } + if (s5 !== peg$FAILED) { + s3 = [s3, s4, s5]; + s2 = s3; + } else { + peg$currPos = s2; + s2 = peg$c0; + } + } else { + peg$currPos = s2; + s2 = peg$c0; + } + } else { + peg$currPos = s2; + s2 = peg$c0; + } + } + while (s2 !== peg$FAILED) { + s1.push(s2); + if (peg$c154.test(input.charAt(peg$currPos))) { + s2 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c155); } + } + if (s2 === peg$FAILED) { + s2 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 123) { + s3 = peg$c149; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c150); } + } + if (s3 !== peg$FAILED) { + s4 = peg$parseCode(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 125) { + s5 = peg$c151; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c152); } + } + if (s5 !== peg$FAILED) { + s3 = [s3, s4, s5]; + s2 = s3; + } else { + peg$currPos = s2; + s2 = peg$c0; + } + } else { + peg$currPos = s2; + s2 = peg$c0; + } + } else { + peg$currPos = s2; + s2 = peg$c0; + } + } + } + if (s1 !== peg$FAILED) { + s1 = input.substring(s0, peg$currPos); + } + s0 = s1; return s0; } diff --git a/spec/parser.spec.js b/spec/parser.spec.js index 99fd538..2a20b2a 100644 --- a/spec/parser.spec.js +++ b/spec/parser.spec.js @@ -389,35 +389,6 @@ describe("PEG.js grammar parser", function() { expect('start =//aaa\n"abcd"').toParseAs(trivialGrammar); }); - /* Canonical Action is "{ code }". */ - it("parses Action", function() { - expect('start = "abcd" { code }').toParseAs(actionGrammar(" code ")); - - expect('start = "abcd" { code }\n').toParseAs(actionGrammar(" code ")); - }); - - /* Canonical Braced is "{ code }". */ - it("parses Braced", function() { - expect('start = "abcd" {}' ).toParseAs(actionGrammar("")); - expect('start = "abcd" {{a}}' ).toParseAs(actionGrammar("{a}")); - expect('start = "abcd" {abcd}' ).toParseAs(actionGrammar("abcd")); - expect('start = "abcd" {{a}{b}{c}}').toParseAs(actionGrammar("{a}{b}{c}")); - }); - - /* Canonical NonBraceCharacters is "abcd". */ - it("parses NonBraceCharacters", function() { - expect('start = "abcd" {a}' ).toParseAs(actionGrammar("a")); - expect('start = "abcd" {abc}').toParseAs(actionGrammar("abc")); - }); - - /* Canonical NonBraceCharacter is "a". */ - it("parses NonBraceCharacter", function() { - expect('start = "abcd" {a}').toParseAs(actionGrammar("a")); - - expect('start = "abcd" {{}').toFailToParse(); - expect('start = "abcd" {}}').toFailToParse(); - }); - /* Canonical Identifier is "a". */ it("parses Identifier", function() { expect('start = a:"abcd"').toParseAs(oneRuleGrammar(labeledAbcd)); @@ -590,6 +561,21 @@ describe("PEG.js grammar parser", function() { /* Digit rules are not tested. */ + /* Canonical CodeBlock is "{ code }". */ + it("parses CodeBlock", function() { + expect('start = "abcd" { code }').toParseAs(actionGrammar(" code ")); + }); + + /* Canonical Code is "code". */ + it("parses Code", function() { + expect('start = "abcd" {a}' ).toParseAs(actionGrammar("a")); + expect('start = "abcd" {{a}}').toParseAs(actionGrammar("{a}")); + expect('start = "abcd" {aaa}').toParseAs(actionGrammar("aaa")); + + expect('start = "abcd" {{}').toFailToParse(); + expect('start = "abcd" {}}').toFailToParse(); + }); + /* Unicode character category rules are not tested. */ /* Token rules are not tested. */ diff --git a/src/parser.pegjs b/src/parser.pegjs index c2082e7..6f6a6b8 100644 --- a/src/parser.pegjs +++ b/src/parser.pegjs @@ -41,7 +41,7 @@ Grammar } Initializer - = code:Action (__ ";")? { + = code:CodeBlock (__ ";")? { return { type: "initializer", code: code @@ -77,7 +77,7 @@ Choice } Sequence - = first:Labeled rest:(__ Labeled)* __ code:Action { + = first:Labeled rest:(__ Labeled)* __ code:CodeBlock { var expression = rest.length > 0 ? { type: "sequence", elements: buildList(first, rest, 1) } : first; @@ -110,7 +110,7 @@ Prefixed expression: expression }; } - / "&" __ code:Action { + / "&" __ code:CodeBlock { return { type: "semantic_and", code: code @@ -122,7 +122,7 @@ Prefixed expression: expression }; } - / "!" __ code:Action { + / "!" __ code:CodeBlock { return { type: "semantic_not", code: code @@ -203,18 +203,6 @@ MultiLineComment SingleLineComment = "//" (!LineTerminator SourceCharacter)* -Action "action" - = braced:Braced __ { return braced.substr(1, braced.length - 2); } - -Braced - = $("{" (Braced / NonBraceCharacters)* "}") - -NonBraceCharacters - = NonBraceCharacter+ - -NonBraceCharacter - = [^{}] - Identifier = !ReservedWord name:IdentifierName { return name; } / name:IdentifierName { @@ -406,6 +394,12 @@ DecimalDigit HexDigit = [0-9a-f]i +CodeBlock "code block" + = "{" code:Code "}" { return code; } + +Code + = $([^{}] / "{" Code "}")* + /* * Unicode Character Categories *