6169 lines
170 KiB
JavaScript
6169 lines
170 KiB
JavaScript
// Generated by Peggy 1.2.0.
|
|
//
|
|
// https://peggyjs.org/
|
|
|
|
"use strict";
|
|
|
|
function peg$subclass(child, parent) {
|
|
function C() { this.constructor = child; }
|
|
C.prototype = parent.prototype;
|
|
child.prototype = new C();
|
|
}
|
|
|
|
function peg$SyntaxError(message, expected, found, location) {
|
|
var self = Error.call(this, message);
|
|
if (Object.setPrototypeOf) {
|
|
Object.setPrototypeOf(self, peg$SyntaxError.prototype);
|
|
}
|
|
self.expected = expected;
|
|
self.found = found;
|
|
self.location = location;
|
|
self.name = "SyntaxError";
|
|
return self;
|
|
}
|
|
|
|
peg$subclass(peg$SyntaxError, Error);
|
|
|
|
function peg$padEnd(str, targetLength, padString) {
|
|
padString = padString || " ";
|
|
if (str.length > targetLength) { return str; }
|
|
targetLength -= str.length;
|
|
padString += padString.repeat(targetLength);
|
|
return str + padString.slice(0, targetLength);
|
|
}
|
|
|
|
peg$SyntaxError.prototype.format = function(sources) {
|
|
var str = "Error: " + this.message;
|
|
if (this.location) {
|
|
var src = null;
|
|
var k;
|
|
for (k = 0; k < sources.length; k++) {
|
|
if (sources[k].source === this.location.source) {
|
|
src = sources[k].text.split(/\r\n|\n|\r/g);
|
|
break;
|
|
}
|
|
}
|
|
var s = this.location.start;
|
|
var loc = this.location.source + ":" + s.line + ":" + s.column;
|
|
if (src) {
|
|
var e = this.location.end;
|
|
var filler = peg$padEnd("", s.line.toString().length);
|
|
var line = src[s.line - 1];
|
|
var last = s.line === e.line ? e.column : line.length + 1;
|
|
str += "\n --> " + loc + "\n"
|
|
+ filler + " |\n"
|
|
+ s.line + " | " + line + "\n"
|
|
+ filler + " | " + peg$padEnd("", s.column - 1)
|
|
+ peg$padEnd("", last - s.column, "^");
|
|
} else {
|
|
str += "\n at " + loc;
|
|
}
|
|
}
|
|
return str;
|
|
};
|
|
|
|
peg$SyntaxError.buildMessage = function(expected, found) {
|
|
var DESCRIBE_EXPECTATION_FNS = {
|
|
literal: function(expectation) {
|
|
return "\"" + literalEscape(expectation.text) + "\"";
|
|
},
|
|
|
|
class: function(expectation) {
|
|
var escapedParts = expectation.parts.map(function(part) {
|
|
return Array.isArray(part)
|
|
? classEscape(part[0]) + "-" + classEscape(part[1])
|
|
: classEscape(part);
|
|
});
|
|
|
|
return "[" + (expectation.inverted ? "^" : "") + escapedParts + "]";
|
|
},
|
|
|
|
any: function() {
|
|
return "any character";
|
|
},
|
|
|
|
end: function() {
|
|
return "end of input";
|
|
},
|
|
|
|
other: function(expectation) {
|
|
return expectation.description;
|
|
}
|
|
};
|
|
|
|
function hex(ch) {
|
|
return ch.charCodeAt(0).toString(16).toUpperCase();
|
|
}
|
|
|
|
function literalEscape(s) {
|
|
return s
|
|
.replace(/\\/g, "\\\\")
|
|
.replace(/"/g, "\\\"")
|
|
.replace(/\0/g, "\\0")
|
|
.replace(/\t/g, "\\t")
|
|
.replace(/\n/g, "\\n")
|
|
.replace(/\r/g, "\\r")
|
|
.replace(/[\x00-\x0F]/g, function(ch) { return "\\x0" + hex(ch); })
|
|
.replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return "\\x" + hex(ch); });
|
|
}
|
|
|
|
function classEscape(s) {
|
|
return s
|
|
.replace(/\\/g, "\\\\")
|
|
.replace(/\]/g, "\\]")
|
|
.replace(/\^/g, "\\^")
|
|
.replace(/-/g, "\\-")
|
|
.replace(/\0/g, "\\0")
|
|
.replace(/\t/g, "\\t")
|
|
.replace(/\n/g, "\\n")
|
|
.replace(/\r/g, "\\r")
|
|
.replace(/[\x00-\x0F]/g, function(ch) { return "\\x0" + hex(ch); })
|
|
.replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return "\\x" + hex(ch); });
|
|
}
|
|
|
|
function describeExpectation(expectation) {
|
|
return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);
|
|
}
|
|
|
|
function describeExpected(expected) {
|
|
var descriptions = expected.map(describeExpectation);
|
|
var i, j;
|
|
|
|
descriptions.sort();
|
|
|
|
if (descriptions.length > 0) {
|
|
for (i = 1, j = 1; i < descriptions.length; i++) {
|
|
if (descriptions[i - 1] !== descriptions[i]) {
|
|
descriptions[j] = descriptions[i];
|
|
j++;
|
|
}
|
|
}
|
|
descriptions.length = j;
|
|
}
|
|
|
|
switch (descriptions.length) {
|
|
case 1:
|
|
return descriptions[0];
|
|
|
|
case 2:
|
|
return descriptions[0] + " or " + descriptions[1];
|
|
|
|
default:
|
|
return descriptions.slice(0, -1).join(", ")
|
|
+ ", or "
|
|
+ descriptions[descriptions.length - 1];
|
|
}
|
|
}
|
|
|
|
function describeFound(found) {
|
|
return found ? "\"" + literalEscape(found) + "\"" : "end of input";
|
|
}
|
|
|
|
return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";
|
|
};
|
|
|
|
function peg$parse(input, options) {
|
|
options = options !== undefined ? options : {};
|
|
|
|
var peg$FAILED = {};
|
|
var peg$source = options.grammarSource;
|
|
|
|
var peg$startRuleFunctions = { program: peg$parseprogram };
|
|
var peg$startRuleFunction = peg$parseprogram;
|
|
|
|
var peg$c0 = "(";
|
|
var peg$c1 = ")";
|
|
var peg$c2 = "\r";
|
|
var peg$c3 = "\n";
|
|
var peg$c4 = "if";
|
|
var peg$c5 = "else";
|
|
var peg$c6 = "while";
|
|
var peg$c7 = "until";
|
|
var peg$c8 = "break";
|
|
var peg$c9 = "continue";
|
|
var peg$c10 = "take it to the top";
|
|
var peg$c11 = "takes";
|
|
var peg$c12 = "wants";
|
|
var peg$c13 = "return";
|
|
var peg$c14 = "give back";
|
|
var peg$c15 = "send";
|
|
var peg$c16 = "give";
|
|
var peg$c17 = "back";
|
|
var peg$c18 = "they";
|
|
var peg$c19 = "them";
|
|
var peg$c20 = "she";
|
|
var peg$c21 = "him";
|
|
var peg$c22 = "her";
|
|
var peg$c23 = "hir";
|
|
var peg$c24 = "zie";
|
|
var peg$c25 = "zir";
|
|
var peg$c26 = "xem";
|
|
var peg$c27 = "ver";
|
|
var peg$c28 = "ze";
|
|
var peg$c29 = "ve";
|
|
var peg$c30 = "xe";
|
|
var peg$c31 = "it";
|
|
var peg$c32 = "he";
|
|
var peg$c33 = "an";
|
|
var peg$c34 = "a";
|
|
var peg$c35 = "the";
|
|
var peg$c36 = "my";
|
|
var peg$c37 = "your";
|
|
var peg$c38 = "our";
|
|
var peg$c39 = " ";
|
|
var peg$c40 = "and";
|
|
var peg$c41 = "at";
|
|
var peg$c42 = "says ";
|
|
var peg$c43 = "say ";
|
|
var peg$c44 = "said ";
|
|
var peg$c45 = "put";
|
|
var peg$c46 = "let";
|
|
var peg$c47 = "be";
|
|
var peg$c48 = "like";
|
|
var peg$c49 = "with";
|
|
var peg$c50 = ", and";
|
|
var peg$c51 = "&";
|
|
var peg$c52 = ",";
|
|
var peg$c53 = "'n'";
|
|
var peg$c54 = "nor";
|
|
var peg$c55 = "or";
|
|
var peg$c56 = "'s";
|
|
var peg$c57 = "'re";
|
|
var peg$c58 = "=";
|
|
var peg$c59 = "is";
|
|
var peg$c60 = "was";
|
|
var peg$c61 = "are";
|
|
var peg$c62 = "were";
|
|
var peg$c63 = "isnt";
|
|
var peg$c64 = "isn't";
|
|
var peg$c65 = "aint";
|
|
var peg$c66 = "ain't";
|
|
var peg$c67 = "arent";
|
|
var peg$c68 = "aren't";
|
|
var peg$c69 = "wasnt";
|
|
var peg$c70 = "wasn't";
|
|
var peg$c71 = "werent";
|
|
var peg$c72 = "weren't";
|
|
var peg$c73 = "not";
|
|
var peg$c74 = "higher";
|
|
var peg$c75 = "greater";
|
|
var peg$c76 = "bigger";
|
|
var peg$c77 = "stronger";
|
|
var peg$c78 = "lower";
|
|
var peg$c79 = "less";
|
|
var peg$c80 = "smaller";
|
|
var peg$c81 = "weaker";
|
|
var peg$c82 = "high";
|
|
var peg$c83 = "great";
|
|
var peg$c84 = "big";
|
|
var peg$c85 = "strong";
|
|
var peg$c86 = "low";
|
|
var peg$c87 = "little";
|
|
var peg$c88 = "small";
|
|
var peg$c89 = "weak";
|
|
var peg$c90 = "than";
|
|
var peg$c91 = "as";
|
|
var peg$c92 = "taking";
|
|
var peg$c93 = "null";
|
|
var peg$c94 = "nothing";
|
|
var peg$c95 = "nowhere";
|
|
var peg$c96 = "nobody";
|
|
var peg$c97 = "gone";
|
|
var peg$c98 = "true";
|
|
var peg$c99 = "ok";
|
|
var peg$c100 = "right";
|
|
var peg$c101 = "yes";
|
|
var peg$c102 = "false";
|
|
var peg$c103 = "lies";
|
|
var peg$c104 = "wrong";
|
|
var peg$c105 = "no";
|
|
var peg$c106 = "empty";
|
|
var peg$c107 = "silent";
|
|
var peg$c108 = "silence";
|
|
var peg$c109 = "mysterious";
|
|
var peg$c110 = "-";
|
|
var peg$c111 = ".";
|
|
var peg$c112 = "\"";
|
|
var peg$c113 = "listen to";
|
|
var peg$c114 = "listen";
|
|
var peg$c115 = "say";
|
|
var peg$c116 = "shout";
|
|
var peg$c117 = "whisper";
|
|
var peg$c118 = "scream";
|
|
var peg$c119 = "build";
|
|
var peg$c120 = "up";
|
|
var peg$c121 = "knock";
|
|
var peg$c122 = "down";
|
|
var peg$c123 = "cut";
|
|
var peg$c124 = "split";
|
|
var peg$c125 = "shatter";
|
|
var peg$c126 = "cast";
|
|
var peg$c127 = "burn";
|
|
var peg$c128 = "join";
|
|
var peg$c129 = "unite";
|
|
var peg$c130 = "using";
|
|
var peg$c131 = "turn";
|
|
var peg$c132 = "round";
|
|
var peg$c133 = "around";
|
|
var peg$c134 = "+";
|
|
var peg$c135 = "plus ";
|
|
var peg$c136 = "with ";
|
|
var peg$c137 = "minus ";
|
|
var peg$c138 = "without ";
|
|
var peg$c139 = "*";
|
|
var peg$c140 = "times ";
|
|
var peg$c141 = "of ";
|
|
var peg$c142 = "/";
|
|
var peg$c143 = "over ";
|
|
var peg$c144 = "between ";
|
|
var peg$c145 = "rock";
|
|
var peg$c146 = "push";
|
|
var peg$c147 = "roll";
|
|
var peg$c148 = "pop";
|
|
var peg$c149 = "into";
|
|
var peg$c150 = "in";
|
|
|
|
var peg$r0 = /^[ \t]/;
|
|
var peg$r1 = /^[^)]/;
|
|
var peg$r2 = /^[;,?!&.]/;
|
|
var peg$r3 = /^[^\n]/;
|
|
var peg$r4 = /^[A-Z\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD8\xD9\xDA\xDB\xDC\xDD\xDE\u0100\u0102\u0104\u0106\u0108\u010A\u010C\u010E\u0110\u0112\u0114\u0116\u0118\u011A\u011C\u011E\u0120\u0122\u0124\u0126\u0128\u012A\u012C\u012E\u0130\u0132\u0134\u0136\u0138\u0139\u013B\u013D\u013F\u0141\u0143\u0145\u0147\u014A\u014C\u014E\u0150\u0152\u0154\u0156\u0158\u015A\u015C\u015E\u0160\u0162\u0164\u0166\u0168\u016A\u016C\u016E\u0170\u0172\u0174\u0176\u0178\u0179\u017B\u017D]/;
|
|
var peg$r5 = /^[a-z\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF8\xF9\xFA\xFB\xFC\xFD\xFE\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\u014B\u014D\u014F\u0151\u0153\u0155\u0157\u0159\u015B\u015D\u015F\u0161\u0163\u0165\u0167\u0169\u016B\u016D\u016F\u0171\u0173\u0175\u0177\xFF\u017A\u017C\u017E\u0149\xDF]/;
|
|
var peg$r6 = /^[0-9]/;
|
|
var peg$r7 = /^[^"]/;
|
|
var peg$r8 = /^[^\r\n]/;
|
|
var peg$r9 = /^[0-9',;:?!+_\/]/;
|
|
var peg$r10 = /^[A-Za-z\-']/;
|
|
|
|
var peg$e0 = peg$classExpectation([" ", "\t"], false, false);
|
|
var peg$e1 = peg$literalExpectation("(", false);
|
|
var peg$e2 = peg$classExpectation([")"], true, false);
|
|
var peg$e3 = peg$literalExpectation(")", false);
|
|
var peg$e4 = peg$classExpectation([";", ",", "?", "!", "&", "."], false, false);
|
|
var peg$e5 = peg$otherExpectation("end of line");
|
|
var peg$e6 = peg$literalExpectation("\r", false);
|
|
var peg$e7 = peg$literalExpectation("\n", false);
|
|
var peg$e8 = peg$anyExpectation();
|
|
var peg$e9 = peg$classExpectation(["\n"], true, false);
|
|
var peg$e10 = peg$literalExpectation("if", true);
|
|
var peg$e11 = peg$literalExpectation("else", true);
|
|
var peg$e12 = peg$literalExpectation("while", true);
|
|
var peg$e13 = peg$literalExpectation("until", true);
|
|
var peg$e14 = peg$literalExpectation("break", true);
|
|
var peg$e15 = peg$literalExpectation("continue", true);
|
|
var peg$e16 = peg$literalExpectation("take it to the top", true);
|
|
var peg$e17 = peg$literalExpectation("takes", true);
|
|
var peg$e18 = peg$literalExpectation("wants", true);
|
|
var peg$e19 = peg$literalExpectation("return", true);
|
|
var peg$e20 = peg$literalExpectation("give back", true);
|
|
var peg$e21 = peg$literalExpectation("send", true);
|
|
var peg$e22 = peg$literalExpectation("give", true);
|
|
var peg$e23 = peg$literalExpectation("back", true);
|
|
var peg$e24 = peg$otherExpectation("pronoun");
|
|
var peg$e25 = peg$literalExpectation("they", true);
|
|
var peg$e26 = peg$literalExpectation("them", true);
|
|
var peg$e27 = peg$literalExpectation("she", true);
|
|
var peg$e28 = peg$literalExpectation("him", true);
|
|
var peg$e29 = peg$literalExpectation("her", true);
|
|
var peg$e30 = peg$literalExpectation("hir", true);
|
|
var peg$e31 = peg$literalExpectation("zie", true);
|
|
var peg$e32 = peg$literalExpectation("zir", true);
|
|
var peg$e33 = peg$literalExpectation("xem", true);
|
|
var peg$e34 = peg$literalExpectation("ver", true);
|
|
var peg$e35 = peg$literalExpectation("ze", true);
|
|
var peg$e36 = peg$literalExpectation("ve", true);
|
|
var peg$e37 = peg$literalExpectation("xe", true);
|
|
var peg$e38 = peg$literalExpectation("it", true);
|
|
var peg$e39 = peg$literalExpectation("he", true);
|
|
var peg$e40 = peg$otherExpectation("common variable prefix");
|
|
var peg$e41 = peg$literalExpectation("an", true);
|
|
var peg$e42 = peg$literalExpectation("a", true);
|
|
var peg$e43 = peg$literalExpectation("the", true);
|
|
var peg$e44 = peg$literalExpectation("my", true);
|
|
var peg$e45 = peg$literalExpectation("your", true);
|
|
var peg$e46 = peg$literalExpectation("our", true);
|
|
var peg$e47 = peg$otherExpectation("uppercase letter");
|
|
var peg$e48 = peg$classExpectation([["A", "Z"], "\xC0", "\xC1", "\xC2", "\xC3", "\xC4", "\xC5", "\xC6", "\xC7", "\xC8", "\xC9", "\xCA", "\xCB", "\xCC", "\xCD", "\xCE", "\xCF", "\xD0", "\xD1", "\xD2", "\xD3", "\xD4", "\xD5", "\xD6", "\xD8", "\xD9", "\xDA", "\xDB", "\xDC", "\xDD", "\xDE", "\u0100", "\u0102", "\u0104", "\u0106", "\u0108", "\u010A", "\u010C", "\u010E", "\u0110", "\u0112", "\u0114", "\u0116", "\u0118", "\u011A", "\u011C", "\u011E", "\u0120", "\u0122", "\u0124", "\u0126", "\u0128", "\u012A", "\u012C", "\u012E", "\u0130", "\u0132", "\u0134", "\u0136", "\u0138", "\u0139", "\u013B", "\u013D", "\u013F", "\u0141", "\u0143", "\u0145", "\u0147", "\u014A", "\u014C", "\u014E", "\u0150", "\u0152", "\u0154", "\u0156", "\u0158", "\u015A", "\u015C", "\u015E", "\u0160", "\u0162", "\u0164", "\u0166", "\u0168", "\u016A", "\u016C", "\u016E", "\u0170", "\u0172", "\u0174", "\u0176", "\u0178", "\u0179", "\u017B", "\u017D"], false, false);
|
|
var peg$e49 = peg$otherExpectation("lowercase letter");
|
|
var peg$e50 = peg$classExpectation([["a", "z"], "\xE0", "\xE1", "\xE2", "\xE3", "\xE4", "\xE5", "\xE6", "\xE7", "\xE8", "\xE9", "\xEA", "\xEB", "\xEC", "\xED", "\xEE", "\xEF", "\xF0", "\xF1", "\xF2", "\xF3", "\xF4", "\xF5", "\xF6", "\xF8", "\xF9", "\xFA", "\xFB", "\xFC", "\xFD", "\xFE", "\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", "\u014B", "\u014D", "\u014F", "\u0151", "\u0153", "\u0155", "\u0157", "\u0159", "\u015B", "\u015D", "\u015F", "\u0161", "\u0163", "\u0165", "\u0167", "\u0169", "\u016B", "\u016D", "\u016F", "\u0171", "\u0173", "\u0175", "\u0177", "\xFF", "\u017A", "\u017C", "\u017E", "\u0149", "\xDF"], false, false);
|
|
var peg$e51 = peg$otherExpectation("letter");
|
|
var peg$e52 = peg$otherExpectation("variable");
|
|
var peg$e53 = peg$literalExpectation(" ", false);
|
|
var peg$e54 = peg$otherExpectation("separator");
|
|
var peg$e55 = peg$literalExpectation("and", true);
|
|
var peg$e56 = peg$otherExpectation("variable list");
|
|
var peg$e57 = peg$literalExpectation("at", true);
|
|
var peg$e58 = peg$otherExpectation("assignable variable");
|
|
var peg$e59 = peg$otherExpectation("operator");
|
|
var peg$e60 = peg$otherExpectation("assignment statement");
|
|
var peg$e61 = peg$literalExpectation("says ", true);
|
|
var peg$e62 = peg$literalExpectation("say ", true);
|
|
var peg$e63 = peg$literalExpectation("said ", true);
|
|
var peg$e64 = peg$literalExpectation("put", true);
|
|
var peg$e65 = peg$literalExpectation("let", true);
|
|
var peg$e66 = peg$literalExpectation("be", true);
|
|
var peg$e67 = peg$literalExpectation("like", true);
|
|
var peg$e68 = peg$literalExpectation("with", true);
|
|
var peg$e69 = peg$literalExpectation(", and", true);
|
|
var peg$e70 = peg$literalExpectation("&", false);
|
|
var peg$e71 = peg$literalExpectation(",", false);
|
|
var peg$e72 = peg$literalExpectation("'n'", true);
|
|
var peg$e73 = peg$otherExpectation("expression list");
|
|
var peg$e74 = peg$otherExpectation("expression");
|
|
var peg$e75 = peg$literalExpectation("nor", true);
|
|
var peg$e76 = peg$literalExpectation("or", true);
|
|
var peg$e77 = peg$literalExpectation("'s", true);
|
|
var peg$e78 = peg$literalExpectation("'re", true);
|
|
var peg$e79 = peg$literalExpectation("=", false);
|
|
var peg$e80 = peg$literalExpectation("is", true);
|
|
var peg$e81 = peg$literalExpectation("was", true);
|
|
var peg$e82 = peg$literalExpectation("are", true);
|
|
var peg$e83 = peg$literalExpectation("were", true);
|
|
var peg$e84 = peg$literalExpectation("isnt", true);
|
|
var peg$e85 = peg$literalExpectation("isn't", true);
|
|
var peg$e86 = peg$literalExpectation("aint", true);
|
|
var peg$e87 = peg$literalExpectation("ain't", true);
|
|
var peg$e88 = peg$literalExpectation("arent", true);
|
|
var peg$e89 = peg$literalExpectation("aren't", true);
|
|
var peg$e90 = peg$literalExpectation("wasnt", true);
|
|
var peg$e91 = peg$literalExpectation("wasn't", true);
|
|
var peg$e92 = peg$literalExpectation("werent", true);
|
|
var peg$e93 = peg$literalExpectation("weren't", true);
|
|
var peg$e94 = peg$literalExpectation("not", true);
|
|
var peg$e95 = peg$literalExpectation("higher", true);
|
|
var peg$e96 = peg$literalExpectation("greater", true);
|
|
var peg$e97 = peg$literalExpectation("bigger", true);
|
|
var peg$e98 = peg$literalExpectation("stronger", true);
|
|
var peg$e99 = peg$literalExpectation("lower", true);
|
|
var peg$e100 = peg$literalExpectation("less", true);
|
|
var peg$e101 = peg$literalExpectation("smaller", true);
|
|
var peg$e102 = peg$literalExpectation("weaker", true);
|
|
var peg$e103 = peg$literalExpectation("high", true);
|
|
var peg$e104 = peg$literalExpectation("great", true);
|
|
var peg$e105 = peg$literalExpectation("big", true);
|
|
var peg$e106 = peg$literalExpectation("strong", true);
|
|
var peg$e107 = peg$literalExpectation("low", true);
|
|
var peg$e108 = peg$literalExpectation("little", true);
|
|
var peg$e109 = peg$literalExpectation("small", true);
|
|
var peg$e110 = peg$literalExpectation("weak", true);
|
|
var peg$e111 = peg$literalExpectation("than", true);
|
|
var peg$e112 = peg$literalExpectation("as", true);
|
|
var peg$e113 = peg$otherExpectation("function call");
|
|
var peg$e114 = peg$literalExpectation("taking", true);
|
|
var peg$e115 = peg$otherExpectation("literal");
|
|
var peg$e116 = peg$otherExpectation("constant");
|
|
var peg$e117 = peg$literalExpectation("null", true);
|
|
var peg$e118 = peg$literalExpectation("nothing", true);
|
|
var peg$e119 = peg$literalExpectation("nowhere", true);
|
|
var peg$e120 = peg$literalExpectation("nobody", true);
|
|
var peg$e121 = peg$literalExpectation("gone", true);
|
|
var peg$e122 = peg$literalExpectation("true", true);
|
|
var peg$e123 = peg$literalExpectation("ok", true);
|
|
var peg$e124 = peg$literalExpectation("right", true);
|
|
var peg$e125 = peg$literalExpectation("yes", true);
|
|
var peg$e126 = peg$literalExpectation("false", true);
|
|
var peg$e127 = peg$literalExpectation("lies", true);
|
|
var peg$e128 = peg$literalExpectation("wrong", true);
|
|
var peg$e129 = peg$literalExpectation("no", true);
|
|
var peg$e130 = peg$literalExpectation("empty", true);
|
|
var peg$e131 = peg$literalExpectation("silent", true);
|
|
var peg$e132 = peg$literalExpectation("silence", true);
|
|
var peg$e133 = peg$literalExpectation("mysterious", true);
|
|
var peg$e134 = peg$otherExpectation("number");
|
|
var peg$e135 = peg$literalExpectation("-", false);
|
|
var peg$e136 = peg$classExpectation([["0", "9"]], false, false);
|
|
var peg$e137 = peg$literalExpectation(".", false);
|
|
var peg$e138 = peg$otherExpectation("string");
|
|
var peg$e139 = peg$literalExpectation("\"", false);
|
|
var peg$e140 = peg$classExpectation(["\""], true, false);
|
|
var peg$e141 = peg$otherExpectation("operation statement");
|
|
var peg$e142 = peg$otherExpectation("stdin statement");
|
|
var peg$e143 = peg$literalExpectation("listen to", true);
|
|
var peg$e144 = peg$literalExpectation("listen", true);
|
|
var peg$e145 = peg$otherExpectation("stdout statement");
|
|
var peg$e146 = peg$literalExpectation("say", true);
|
|
var peg$e147 = peg$literalExpectation("shout", true);
|
|
var peg$e148 = peg$literalExpectation("whisper", true);
|
|
var peg$e149 = peg$literalExpectation("scream", true);
|
|
var peg$e150 = peg$otherExpectation("increment/decrement statement");
|
|
var peg$e151 = peg$literalExpectation("build", true);
|
|
var peg$e152 = peg$literalExpectation("up", true);
|
|
var peg$e153 = peg$literalExpectation("knock", true);
|
|
var peg$e154 = peg$literalExpectation("down", true);
|
|
var peg$e155 = peg$literalExpectation("cut", true);
|
|
var peg$e156 = peg$literalExpectation("split", true);
|
|
var peg$e157 = peg$literalExpectation("shatter", true);
|
|
var peg$e158 = peg$literalExpectation("cast", true);
|
|
var peg$e159 = peg$literalExpectation("burn", true);
|
|
var peg$e160 = peg$literalExpectation("join", true);
|
|
var peg$e161 = peg$literalExpectation("unite", true);
|
|
var peg$e162 = peg$otherExpectation("mutation keyword");
|
|
var peg$e163 = peg$literalExpectation("using", true);
|
|
var peg$e164 = peg$otherExpectation("mutation statement");
|
|
var peg$e165 = peg$otherExpectation("rounding statement");
|
|
var peg$e166 = peg$literalExpectation("turn", true);
|
|
var peg$e167 = peg$literalExpectation("round", true);
|
|
var peg$e168 = peg$literalExpectation("around", true);
|
|
var peg$e169 = peg$literalExpectation("+", false);
|
|
var peg$e170 = peg$literalExpectation("plus ", true);
|
|
var peg$e171 = peg$literalExpectation("with ", true);
|
|
var peg$e172 = peg$literalExpectation("minus ", true);
|
|
var peg$e173 = peg$literalExpectation("without ", true);
|
|
var peg$e174 = peg$literalExpectation("*", false);
|
|
var peg$e175 = peg$literalExpectation("times ", true);
|
|
var peg$e176 = peg$literalExpectation("of ", true);
|
|
var peg$e177 = peg$literalExpectation("/", false);
|
|
var peg$e178 = peg$literalExpectation("over ", true);
|
|
var peg$e179 = peg$literalExpectation("between ", true);
|
|
var peg$e180 = peg$literalExpectation("rock", true);
|
|
var peg$e181 = peg$literalExpectation("push", true);
|
|
var peg$e182 = peg$literalExpectation("roll", true);
|
|
var peg$e183 = peg$literalExpectation("pop", true);
|
|
var peg$e184 = peg$literalExpectation("into", true);
|
|
var peg$e185 = peg$literalExpectation("in", true);
|
|
var peg$e186 = peg$otherExpectation("array roll");
|
|
var peg$e187 = peg$otherExpectation("variable or array element");
|
|
var peg$e188 = peg$otherExpectation("poetic string");
|
|
var peg$e189 = peg$classExpectation(["\r", "\n"], true, false);
|
|
var peg$e190 = peg$otherExpectation("poetic number");
|
|
var peg$e191 = peg$classExpectation([["0", "9"], "'", ",", ";", ":", "?", "!", "+", "_", "/"], false, false);
|
|
var peg$e192 = peg$classExpectation([["A", "Z"], ["a", "z"], "-", "'"], false, false);
|
|
|
|
var peg$f0 = function(p) { return { list: p } };
|
|
var peg$f1 = function(s) { return s };
|
|
var peg$f2 = function() { return { type: 'blank' } };
|
|
var peg$f3 = function() {return { type: 'blank' } };
|
|
var peg$f4 = function(s) { return {s: s, start: location().start.offset }};
|
|
var peg$f5 = function(e, s) { return {
|
|
type: 'if',
|
|
condition: e,
|
|
statement: s && s.s,
|
|
split: s && s.start,
|
|
} };
|
|
var peg$f6 = function(a) { return { type: 'else', statement: a } };
|
|
var peg$f7 = function() {return { type: 'else', statement: null } };
|
|
var peg$f8 = function(e) { return { type: 'loop', condition: e } };
|
|
var peg$f9 = function() { return { type: 'break' } };
|
|
var peg$f10 = function() { return { type: 'continue' } };
|
|
var peg$f11 = function(name, args) { return { type: 'function_decl', name: name, args: args } };
|
|
var peg$f12 = function(e) { return { type: 'return', expression: e } };
|
|
var peg$f13 = function(pronoun) { return { pronoun: pronoun.toLowerCase() } };
|
|
var peg$f14 = function(prefix, name) { return (prefix + '_' + name).toLowerCase() };
|
|
var peg$f15 = function(name) { return isKeyword(name) };
|
|
var peg$f16 = function(name) { return name.toLowerCase() };
|
|
var peg$f17 = function(noun) { return isKeyword(noun) };
|
|
var peg$f18 = function(noun) { return noun };
|
|
var peg$f19 = function(head) { return head.replace(/ /g, '_').toLowerCase() };
|
|
var peg$f20 = function(head, tail) { return [head].concat(tail) };
|
|
var peg$f21 = function(arg) { return [arg] };
|
|
var peg$f22 = function(i) { return i };
|
|
var peg$f23 = function(v, i) { return { variable: v, index: i }; };
|
|
var peg$f24 = function(target, e) { return { type: "assign", target: target, expression: e} };
|
|
var peg$f25 = function(e, target) { return { type: "assign", target: target, expression: e} };
|
|
var peg$f26 = function(target, o, e) {
|
|
return {
|
|
type: "assign",
|
|
target: target,
|
|
expression: { binary: { op: o, lhs: { lookup: target }, rhs: e } }
|
|
}
|
|
};
|
|
var peg$f27 = function(t, e) { return { type: "assign", target: t, expression: e} };
|
|
var peg$f28 = function(e, v) { return { type: "enlist", variable: v, expression: e } };
|
|
var peg$f29 = function(v, e) { return { type: "enlist", variable: v, expression: e } };
|
|
var peg$f30 = function(v) { return { type: "enlist", variable: v } };
|
|
var peg$f31 = function(e, target) { return { type: "assign", target: target, expression: e } };
|
|
var peg$f32 = function(lhs, rhs) {
|
|
return { type: "binary", op: 'nor', lhs: lhs, rhs: rhs } };
|
|
var peg$f33 = function(lhs, rhs) {
|
|
return { type: "binary", op: 'or', lhs: lhs, rhs: rhs } };
|
|
var peg$f34 = function(lhs, rhs) {
|
|
return { type: "binary", op: 'and', lhs: lhs, rhs: rhs } };
|
|
var peg$f35 = function() { return 'ne' };
|
|
var peg$f36 = function() { return 'eq' };
|
|
var peg$f37 = function(lhs, c, rhs) { return { type: "comparison", comparator: c, lhs: lhs, rhs: rhs } };
|
|
var peg$f38 = function(e) { return { type: "not", expression: e } };
|
|
var peg$f39 = function() { return 'gt' };
|
|
var peg$f40 = function() { return 'lt' };
|
|
var peg$f41 = function() { return 'ge' };
|
|
var peg$f42 = function() { return 'le' };
|
|
var peg$f43 = function(first, rest) { return rest.reduce(function(memo, curr) {
|
|
return { type: "binary", op: curr[0], lhs: memo, rhs: curr[1] }
|
|
}, first); };
|
|
var peg$f44 = function(first, rest) { return rest.reduce(function(memo, curr) {
|
|
return { binary: { op: curr[0], lhs: memo, rhs: curr[1] } };
|
|
}, first); };
|
|
var peg$f45 = function(name, args) { return { type: "call", name: name, args: Array.isArray(args) ? args : [args] } };
|
|
var peg$f46 = function() { return { constant: null } };
|
|
var peg$f47 = function() { return { constant: true } };
|
|
var peg$f48 = function() { return { constant: false } };
|
|
var peg$f49 = function() { return { constant: "" } };
|
|
var peg$f50 = function() { return '__MYSTERIOUS__' };
|
|
var peg$f51 = function(n) { return {number: parseFloat(n)} };
|
|
var peg$f52 = function(n) { return {number: parseFloat(n) } };
|
|
var peg$f53 = function(s) { return {string: s }; };
|
|
var peg$f54 = function(target) { return { type: "stdin", target: target } };
|
|
var peg$f55 = function() { return { type: "stdin" } };
|
|
var peg$f56 = function(e) { return { type: "stdout", output: e } };
|
|
var peg$f57 = function(v, t) { return { type: "increment", variable: v, multiple: t.length } };
|
|
var peg$f58 = function(v, t) { return { type: "decrement", variable: v, multiple: t.length } };
|
|
var peg$f59 = function() { return 'split' };
|
|
var peg$f60 = function() { return 'cast' };
|
|
var peg$f61 = function() { return 'join' };
|
|
var peg$f62 = function(m) { return m };
|
|
var peg$f63 = function(op, s, t, m) { return { assign: { target: t, expression: { mutation: { type: op, source: s, modifier: m } } } } ; };
|
|
var peg$f64 = function(op, s, m) { return { assign: { target: s, expression: { mutation: { type: op, source: { lookup: s }, modifier: m } } } } ; };
|
|
var peg$f65 = function(v) { return { type: "rounding", variable: v, direction: 'down' } };
|
|
var peg$f66 = function(v) { return { type: "rounding", variable: v, direction: 'up' } };
|
|
var peg$f67 = function(v) { return { type: "rounding", variable: v, direction: 'up' } };
|
|
var peg$f68 = function(v) { return { type: "rounding", variable: v, direction: 'nearest' } };
|
|
var peg$f69 = function() { return '+' };
|
|
var peg$f70 = function() { return '-' };
|
|
var peg$f71 = function() { return '*' };
|
|
var peg$f72 = function() { return '/' };
|
|
var peg$f73 = function(v) { return { type: "delist", variable: v } };
|
|
var peg$f74 = function(d) { return d; };
|
|
var peg$f75 = function(v, i) { return { type: "lookup", variable: v, index: i } };
|
|
var peg$f76 = function(v) { return { type: "lookup", variable: v } };
|
|
var peg$f77 = function(s) { return { string: s } };
|
|
var peg$f78 = function(n, d) { return { number: parseFloat(d?n+'.'+d:n)}};
|
|
var peg$f79 = function(d) {return d};
|
|
var peg$f80 = function(head, tail) { return head + tail };
|
|
var peg$f81 = function(d) { return d };
|
|
var peg$f82 = function(t) { return (t.filter(c => /[A-Za-z\-]/.test(c)).length%10).toString() };
|
|
|
|
var peg$currPos = 0;
|
|
var peg$savedPos = 0;
|
|
var peg$posDetailsCache = [{ line: 1, column: 1 }];
|
|
var peg$maxFailPos = 0;
|
|
var peg$maxFailExpected = [];
|
|
var peg$silentFails = 0;
|
|
|
|
var peg$result;
|
|
|
|
if ("startRule" in options) {
|
|
if (!(options.startRule in peg$startRuleFunctions)) {
|
|
throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
|
|
}
|
|
|
|
peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
|
|
}
|
|
|
|
function text() {
|
|
return input.substring(peg$savedPos, peg$currPos);
|
|
}
|
|
|
|
function offset() {
|
|
return peg$savedPos;
|
|
}
|
|
|
|
function range() {
|
|
return {
|
|
source: peg$source,
|
|
start: peg$savedPos,
|
|
end: peg$currPos
|
|
};
|
|
}
|
|
|
|
function location() {
|
|
return peg$computeLocation(peg$savedPos, peg$currPos);
|
|
}
|
|
|
|
function expected(description, location) {
|
|
location = location !== undefined
|
|
? location
|
|
: peg$computeLocation(peg$savedPos, peg$currPos);
|
|
|
|
throw peg$buildStructuredError(
|
|
[peg$otherExpectation(description)],
|
|
input.substring(peg$savedPos, peg$currPos),
|
|
location
|
|
);
|
|
}
|
|
|
|
function error(message, location) {
|
|
location = location !== undefined
|
|
? location
|
|
: peg$computeLocation(peg$savedPos, peg$currPos);
|
|
|
|
throw peg$buildSimpleError(message, location);
|
|
}
|
|
|
|
function peg$literalExpectation(text, ignoreCase) {
|
|
return { type: "literal", text: text, ignoreCase: ignoreCase };
|
|
}
|
|
|
|
function peg$classExpectation(parts, inverted, ignoreCase) {
|
|
return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase };
|
|
}
|
|
|
|
function peg$anyExpectation() {
|
|
return { type: "any" };
|
|
}
|
|
|
|
function peg$endExpectation() {
|
|
return { type: "end" };
|
|
}
|
|
|
|
function peg$otherExpectation(description) {
|
|
return { type: "other", description: description };
|
|
}
|
|
|
|
function peg$computePosDetails(pos) {
|
|
var details = peg$posDetailsCache[pos];
|
|
var p;
|
|
|
|
if (details) {
|
|
return details;
|
|
} else {
|
|
p = pos - 1;
|
|
while (!peg$posDetailsCache[p]) {
|
|
p--;
|
|
}
|
|
|
|
details = peg$posDetailsCache[p];
|
|
details = {
|
|
line: details.line,
|
|
column: details.column
|
|
};
|
|
|
|
while (p < pos) {
|
|
if (input.charCodeAt(p) === 10) {
|
|
details.line++;
|
|
details.column = 1;
|
|
} else {
|
|
details.column++;
|
|
}
|
|
|
|
p++;
|
|
}
|
|
|
|
peg$posDetailsCache[pos] = details;
|
|
|
|
return details;
|
|
}
|
|
}
|
|
|
|
function peg$computeLocation(startPos, endPos) {
|
|
var startPosDetails = peg$computePosDetails(startPos);
|
|
var endPosDetails = peg$computePosDetails(endPos);
|
|
|
|
return {
|
|
source: peg$source,
|
|
start: {
|
|
offset: startPos,
|
|
line: startPosDetails.line,
|
|
column: startPosDetails.column
|
|
},
|
|
end: {
|
|
offset: endPos,
|
|
line: endPosDetails.line,
|
|
column: endPosDetails.column
|
|
}
|
|
};
|
|
}
|
|
|
|
function peg$fail(expected) {
|
|
if (peg$currPos < peg$maxFailPos) { return; }
|
|
|
|
if (peg$currPos > peg$maxFailPos) {
|
|
peg$maxFailPos = peg$currPos;
|
|
peg$maxFailExpected = [];
|
|
}
|
|
|
|
peg$maxFailExpected.push(expected);
|
|
}
|
|
|
|
function peg$buildSimpleError(message, location) {
|
|
return new peg$SyntaxError(message, null, null, location);
|
|
}
|
|
|
|
function peg$buildStructuredError(expected, found, location) {
|
|
return new peg$SyntaxError(
|
|
peg$SyntaxError.buildMessage(expected, found),
|
|
expected,
|
|
found,
|
|
location
|
|
);
|
|
}
|
|
|
|
function peg$parseprogram() {
|
|
var s0, s1, s2;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = [];
|
|
s2 = peg$parseline();
|
|
while (s2 !== peg$FAILED) {
|
|
s1.push(s2);
|
|
s2 = peg$parseline();
|
|
}
|
|
peg$savedPos = s0;
|
|
s1 = peg$f0(s1);
|
|
s0 = s1;
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseline() {
|
|
var s0, s1, s2, s3, s4;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = [];
|
|
s2 = peg$parse_();
|
|
while (s2 !== peg$FAILED) {
|
|
s1.push(s2);
|
|
s2 = peg$parse_();
|
|
}
|
|
s2 = peg$parsestatement();
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = [];
|
|
s4 = peg$parse_();
|
|
while (s4 !== peg$FAILED) {
|
|
s3.push(s4);
|
|
s4 = peg$parse_();
|
|
}
|
|
s4 = peg$parseEOL();
|
|
if (s4 === peg$FAILED) {
|
|
s4 = peg$parseEOF();
|
|
}
|
|
if (s4 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f1(s2);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
s1 = [];
|
|
s2 = peg$parse_();
|
|
while (s2 !== peg$FAILED) {
|
|
s1.push(s2);
|
|
s2 = peg$parse_();
|
|
}
|
|
s2 = peg$parseEOL();
|
|
if (s2 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f2();
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
s1 = [];
|
|
s2 = peg$parse_();
|
|
if (s2 !== peg$FAILED) {
|
|
while (s2 !== peg$FAILED) {
|
|
s1.push(s2);
|
|
s2 = peg$parse_();
|
|
}
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parseEOF();
|
|
if (s2 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f3();
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
}
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsewhitespace() {
|
|
var s0;
|
|
|
|
if (peg$r0.test(input.charAt(peg$currPos))) {
|
|
s0 = input.charAt(peg$currPos);
|
|
peg$currPos++;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e0); }
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsecomment() {
|
|
var s0, s1, s2, s3;
|
|
|
|
s0 = peg$currPos;
|
|
if (input.charCodeAt(peg$currPos) === 40) {
|
|
s1 = peg$c0;
|
|
peg$currPos++;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e1); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = [];
|
|
if (peg$r1.test(input.charAt(peg$currPos))) {
|
|
s3 = input.charAt(peg$currPos);
|
|
peg$currPos++;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e2); }
|
|
}
|
|
while (s3 !== peg$FAILED) {
|
|
s2.push(s3);
|
|
if (peg$r1.test(input.charAt(peg$currPos))) {
|
|
s3 = input.charAt(peg$currPos);
|
|
peg$currPos++;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e2); }
|
|
}
|
|
}
|
|
if (input.charCodeAt(peg$currPos) === 41) {
|
|
s3 = peg$c1;
|
|
peg$currPos++;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e3); }
|
|
}
|
|
if (s3 !== peg$FAILED) {
|
|
s1 = [s1, s2, s3];
|
|
s0 = s1;
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parse_() {
|
|
var s0, s1;
|
|
|
|
s0 = [];
|
|
s1 = peg$parsewhitespace();
|
|
if (s1 === peg$FAILED) {
|
|
s1 = peg$parsecomment();
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
while (s1 !== peg$FAILED) {
|
|
s0.push(s1);
|
|
s1 = peg$parsewhitespace();
|
|
if (s1 === peg$FAILED) {
|
|
s1 = peg$parsecomment();
|
|
}
|
|
}
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsenoise() {
|
|
var s0;
|
|
|
|
s0 = peg$parse_();
|
|
if (s0 === peg$FAILED) {
|
|
if (peg$r2.test(input.charAt(peg$currPos))) {
|
|
s0 = input.charAt(peg$currPos);
|
|
peg$currPos++;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e4); }
|
|
}
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseEOL() {
|
|
var s0, s1, s2, s3;
|
|
|
|
peg$silentFails++;
|
|
s0 = peg$currPos;
|
|
s1 = [];
|
|
s2 = peg$parsenoise();
|
|
while (s2 !== peg$FAILED) {
|
|
s1.push(s2);
|
|
s2 = peg$parsenoise();
|
|
}
|
|
if (input.charCodeAt(peg$currPos) === 13) {
|
|
s2 = peg$c2;
|
|
peg$currPos++;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e6); }
|
|
}
|
|
if (s2 === peg$FAILED) {
|
|
s2 = null;
|
|
}
|
|
if (input.charCodeAt(peg$currPos) === 10) {
|
|
s3 = peg$c3;
|
|
peg$currPos++;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e7); }
|
|
}
|
|
if (s3 !== peg$FAILED) {
|
|
s1 = [s1, s2, s3];
|
|
s0 = s1;
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
peg$silentFails--;
|
|
if (s0 === peg$FAILED) {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e5); }
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseEOF() {
|
|
var s0, s1;
|
|
|
|
s0 = peg$currPos;
|
|
peg$silentFails++;
|
|
if (input.length > peg$currPos) {
|
|
s1 = input.charAt(peg$currPos);
|
|
peg$currPos++;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e8); }
|
|
}
|
|
peg$silentFails--;
|
|
if (s1 === peg$FAILED) {
|
|
s0 = undefined;
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseignore_rest_of_line() {
|
|
var s0, s1, s2, s3;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parse_();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = [];
|
|
if (peg$r3.test(input.charAt(peg$currPos))) {
|
|
s3 = input.charAt(peg$currPos);
|
|
peg$currPos++;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e9); }
|
|
}
|
|
while (s3 !== peg$FAILED) {
|
|
s2.push(s3);
|
|
if (peg$r3.test(input.charAt(peg$currPos))) {
|
|
s3 = input.charAt(peg$currPos);
|
|
peg$currPos++;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e9); }
|
|
}
|
|
}
|
|
s1 = [s1, s2];
|
|
s0 = s1;
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = null;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsestatement() {
|
|
var s0, s1, s2;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = [];
|
|
s2 = peg$parse_();
|
|
while (s2 !== peg$FAILED) {
|
|
s1.push(s2);
|
|
s2 = peg$parse_();
|
|
}
|
|
s2 = peg$parsebreak();
|
|
if (s2 === peg$FAILED) {
|
|
s2 = peg$parsecontinue();
|
|
if (s2 === peg$FAILED) {
|
|
s2 = peg$parsefunction_decl();
|
|
if (s2 === peg$FAILED) {
|
|
s2 = peg$parsefunction_call();
|
|
if (s2 === peg$FAILED) {
|
|
s2 = peg$parsefunction_return();
|
|
if (s2 === peg$FAILED) {
|
|
s2 = peg$parseloop();
|
|
if (s2 === peg$FAILED) {
|
|
s2 = peg$parseif();
|
|
if (s2 === peg$FAILED) {
|
|
s2 = peg$parseelse();
|
|
if (s2 === peg$FAILED) {
|
|
s2 = peg$parseoperation();
|
|
if (s2 === peg$FAILED) {
|
|
s2 = peg$parseexpression();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f1(s2);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseinline_statement() {
|
|
var s0, s1;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parsestatement();
|
|
if (s1 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$f4(s1);
|
|
}
|
|
s0 = s1;
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseif() {
|
|
var s0, s1, s2, s3, s4;
|
|
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 2).toLowerCase() === peg$c4) {
|
|
s1 = input.substr(peg$currPos, 2);
|
|
peg$currPos += 2;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e10); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse_();
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parseexpression();
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parseinline_statement();
|
|
if (s4 === peg$FAILED) {
|
|
s4 = null;
|
|
}
|
|
peg$savedPos = s0;
|
|
s0 = peg$f5(s3, s4);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseelse() {
|
|
var s0, s1, s2, s3, s4;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = [];
|
|
s2 = peg$parse_();
|
|
while (s2 !== peg$FAILED) {
|
|
s1.push(s2);
|
|
s2 = peg$parse_();
|
|
}
|
|
if (input.substr(peg$currPos, 4).toLowerCase() === peg$c5) {
|
|
s2 = input.substr(peg$currPos, 4);
|
|
peg$currPos += 4;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e11); }
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parse_();
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parsestatement();
|
|
if (s4 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f6(s4);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
s1 = [];
|
|
s2 = peg$parse_();
|
|
while (s2 !== peg$FAILED) {
|
|
s1.push(s2);
|
|
s2 = peg$parse_();
|
|
}
|
|
if (input.substr(peg$currPos, 4).toLowerCase() === peg$c5) {
|
|
s2 = input.substr(peg$currPos, 4);
|
|
peg$currPos += 4;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e11); }
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = [];
|
|
s4 = peg$parse_();
|
|
while (s4 !== peg$FAILED) {
|
|
s3.push(s4);
|
|
s4 = peg$parse_();
|
|
}
|
|
peg$savedPos = s0;
|
|
s0 = peg$f7();
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseloop_keyword() {
|
|
var s0;
|
|
|
|
if (input.substr(peg$currPos, 5).toLowerCase() === peg$c6) {
|
|
s0 = input.substr(peg$currPos, 5);
|
|
peg$currPos += 5;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e12); }
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 5).toLowerCase() === peg$c7) {
|
|
s0 = input.substr(peg$currPos, 5);
|
|
peg$currPos += 5;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e13); }
|
|
}
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseloop() {
|
|
var s0, s1, s2, s3;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parseloop_keyword();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse_();
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parseexpression();
|
|
if (s3 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f8(s3);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsebreak() {
|
|
var s0, s1, s2;
|
|
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 5).toLowerCase() === peg$c8) {
|
|
s1 = input.substr(peg$currPos, 5);
|
|
peg$currPos += 5;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e14); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parseignore_rest_of_line();
|
|
peg$savedPos = s0;
|
|
s0 = peg$f9();
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsecontinue() {
|
|
var s0, s1, s2, s3;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$currPos;
|
|
if (input.substr(peg$currPos, 8).toLowerCase() === peg$c9) {
|
|
s2 = input.substr(peg$currPos, 8);
|
|
peg$currPos += 8;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e15); }
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parseignore_rest_of_line();
|
|
s2 = [s2, s3];
|
|
s1 = s2;
|
|
} else {
|
|
peg$currPos = s1;
|
|
s1 = peg$FAILED;
|
|
}
|
|
if (s1 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 18).toLowerCase() === peg$c10) {
|
|
s1 = input.substr(peg$currPos, 18);
|
|
peg$currPos += 18;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e16); }
|
|
}
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$f10();
|
|
}
|
|
s0 = s1;
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsetakes() {
|
|
var s0;
|
|
|
|
if (input.substr(peg$currPos, 5).toLowerCase() === peg$c11) {
|
|
s0 = input.substr(peg$currPos, 5);
|
|
peg$currPos += 5;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e17); }
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 5).toLowerCase() === peg$c12) {
|
|
s0 = input.substr(peg$currPos, 5);
|
|
peg$currPos += 5;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e18); }
|
|
}
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsefunction_decl() {
|
|
var s0, s1, s2, s3, s4, s5;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parsevariable();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse_();
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parsetakes();
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parse_();
|
|
if (s4 !== peg$FAILED) {
|
|
s5 = peg$parsevariable_list();
|
|
if (s5 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f11(s1, s5);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsereturn() {
|
|
var s0;
|
|
|
|
if (input.substr(peg$currPos, 6).toLowerCase() === peg$c13) {
|
|
s0 = input.substr(peg$currPos, 6);
|
|
peg$currPos += 6;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e19); }
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 9).toLowerCase() === peg$c14) {
|
|
s0 = input.substr(peg$currPos, 9);
|
|
peg$currPos += 9;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e20); }
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 4).toLowerCase() === peg$c15) {
|
|
s0 = input.substr(peg$currPos, 4);
|
|
peg$currPos += 4;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e21); }
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 4).toLowerCase() === peg$c16) {
|
|
s0 = input.substr(peg$currPos, 4);
|
|
peg$currPos += 4;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e22); }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsefunction_return() {
|
|
var s0, s1, s2, s3, s4, s5, s6;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parsereturn();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse_();
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parseexpression();
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$currPos;
|
|
s5 = peg$parse_();
|
|
if (s5 !== peg$FAILED) {
|
|
if (input.substr(peg$currPos, 4).toLowerCase() === peg$c17) {
|
|
s6 = input.substr(peg$currPos, 4);
|
|
peg$currPos += 4;
|
|
} else {
|
|
s6 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e23); }
|
|
}
|
|
if (s6 !== peg$FAILED) {
|
|
s5 = [s5, s6];
|
|
s4 = s5;
|
|
} else {
|
|
peg$currPos = s4;
|
|
s4 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s4;
|
|
s4 = peg$FAILED;
|
|
}
|
|
if (s4 === peg$FAILED) {
|
|
s4 = null;
|
|
}
|
|
peg$savedPos = s0;
|
|
s0 = peg$f12(s3);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsepronoun() {
|
|
var s0, s1, s2, s3;
|
|
|
|
peg$silentFails++;
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 4).toLowerCase() === peg$c18) {
|
|
s1 = input.substr(peg$currPos, 4);
|
|
peg$currPos += 4;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e25); }
|
|
}
|
|
if (s1 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 4).toLowerCase() === peg$c19) {
|
|
s1 = input.substr(peg$currPos, 4);
|
|
peg$currPos += 4;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e26); }
|
|
}
|
|
if (s1 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 3).toLowerCase() === peg$c20) {
|
|
s1 = input.substr(peg$currPos, 3);
|
|
peg$currPos += 3;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e27); }
|
|
}
|
|
if (s1 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 3).toLowerCase() === peg$c21) {
|
|
s1 = input.substr(peg$currPos, 3);
|
|
peg$currPos += 3;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e28); }
|
|
}
|
|
if (s1 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 3).toLowerCase() === peg$c22) {
|
|
s1 = input.substr(peg$currPos, 3);
|
|
peg$currPos += 3;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e29); }
|
|
}
|
|
if (s1 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 3).toLowerCase() === peg$c23) {
|
|
s1 = input.substr(peg$currPos, 3);
|
|
peg$currPos += 3;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e30); }
|
|
}
|
|
if (s1 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 3).toLowerCase() === peg$c24) {
|
|
s1 = input.substr(peg$currPos, 3);
|
|
peg$currPos += 3;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e31); }
|
|
}
|
|
if (s1 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 3).toLowerCase() === peg$c25) {
|
|
s1 = input.substr(peg$currPos, 3);
|
|
peg$currPos += 3;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e32); }
|
|
}
|
|
if (s1 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 3).toLowerCase() === peg$c26) {
|
|
s1 = input.substr(peg$currPos, 3);
|
|
peg$currPos += 3;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e33); }
|
|
}
|
|
if (s1 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 3).toLowerCase() === peg$c27) {
|
|
s1 = input.substr(peg$currPos, 3);
|
|
peg$currPos += 3;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e34); }
|
|
}
|
|
if (s1 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 2).toLowerCase() === peg$c28) {
|
|
s1 = input.substr(peg$currPos, 2);
|
|
peg$currPos += 2;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e35); }
|
|
}
|
|
if (s1 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 2).toLowerCase() === peg$c29) {
|
|
s1 = input.substr(peg$currPos, 2);
|
|
peg$currPos += 2;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e36); }
|
|
}
|
|
if (s1 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 2).toLowerCase() === peg$c30) {
|
|
s1 = input.substr(peg$currPos, 2);
|
|
peg$currPos += 2;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e37); }
|
|
}
|
|
if (s1 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 2).toLowerCase() === peg$c31) {
|
|
s1 = input.substr(peg$currPos, 2);
|
|
peg$currPos += 2;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e38); }
|
|
}
|
|
if (s1 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 2).toLowerCase() === peg$c32) {
|
|
s1 = input.substr(peg$currPos, 2);
|
|
peg$currPos += 2;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e39); }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$currPos;
|
|
peg$silentFails++;
|
|
s3 = peg$parseis();
|
|
if (s3 === peg$FAILED) {
|
|
s3 = peg$parse_();
|
|
if (s3 === peg$FAILED) {
|
|
s3 = peg$parseEOL();
|
|
if (s3 === peg$FAILED) {
|
|
s3 = peg$parseEOF();
|
|
}
|
|
}
|
|
}
|
|
peg$silentFails--;
|
|
if (s3 !== peg$FAILED) {
|
|
peg$currPos = s2;
|
|
s2 = undefined;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f13(s1);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
peg$silentFails--;
|
|
if (s0 === peg$FAILED) {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e24); }
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsecommon_prefix() {
|
|
var s0, s1;
|
|
|
|
peg$silentFails++;
|
|
if (input.substr(peg$currPos, 2).toLowerCase() === peg$c33) {
|
|
s0 = input.substr(peg$currPos, 2);
|
|
peg$currPos += 2;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e41); }
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 1).toLowerCase() === peg$c34) {
|
|
s0 = input.charAt(peg$currPos);
|
|
peg$currPos++;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e42); }
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 3).toLowerCase() === peg$c35) {
|
|
s0 = input.substr(peg$currPos, 3);
|
|
peg$currPos += 3;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e43); }
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 2).toLowerCase() === peg$c36) {
|
|
s0 = input.substr(peg$currPos, 2);
|
|
peg$currPos += 2;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e44); }
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 4).toLowerCase() === peg$c37) {
|
|
s0 = input.substr(peg$currPos, 4);
|
|
peg$currPos += 4;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e45); }
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 3).toLowerCase() === peg$c38) {
|
|
s0 = input.substr(peg$currPos, 3);
|
|
peg$currPos += 3;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e46); }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
peg$silentFails--;
|
|
if (s0 === peg$FAILED) {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e40); }
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseuppercase_letter() {
|
|
var s0, s1;
|
|
|
|
peg$silentFails++;
|
|
if (peg$r4.test(input.charAt(peg$currPos))) {
|
|
s0 = input.charAt(peg$currPos);
|
|
peg$currPos++;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e48); }
|
|
}
|
|
peg$silentFails--;
|
|
if (s0 === peg$FAILED) {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e47); }
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parselowercase_letter() {
|
|
var s0, s1;
|
|
|
|
peg$silentFails++;
|
|
if (peg$r5.test(input.charAt(peg$currPos))) {
|
|
s0 = input.charAt(peg$currPos);
|
|
peg$currPos++;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e50); }
|
|
}
|
|
peg$silentFails--;
|
|
if (s0 === peg$FAILED) {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e49); }
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseletter() {
|
|
var s0, s1;
|
|
|
|
peg$silentFails++;
|
|
s0 = peg$parseuppercase_letter();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parselowercase_letter();
|
|
}
|
|
peg$silentFails--;
|
|
if (s0 === peg$FAILED) {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e51); }
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsevariable() {
|
|
var s0, s1;
|
|
|
|
peg$silentFails++;
|
|
s0 = peg$parsecommon_variable();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parseproper_variable();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parsepronoun();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parsesimple_variable();
|
|
}
|
|
}
|
|
}
|
|
peg$silentFails--;
|
|
if (s0 === peg$FAILED) {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e52); }
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsecommon_variable() {
|
|
var s0, s1, s2, s3, s4, s5;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parsecommon_prefix();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse_();
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$currPos;
|
|
s4 = [];
|
|
s5 = peg$parseletter();
|
|
if (s5 !== peg$FAILED) {
|
|
while (s5 !== peg$FAILED) {
|
|
s4.push(s5);
|
|
s5 = peg$parseletter();
|
|
}
|
|
} else {
|
|
s4 = peg$FAILED;
|
|
}
|
|
if (s4 !== peg$FAILED) {
|
|
s3 = input.substring(s3, peg$currPos);
|
|
} else {
|
|
s3 = s4;
|
|
}
|
|
if (s3 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f14(s1, s3);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsesimple_variable() {
|
|
var s0, s1, s2, s3, s4, s5;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$currPos;
|
|
s2 = peg$currPos;
|
|
s3 = peg$parseletter();
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = [];
|
|
s5 = peg$parseletter();
|
|
while (s5 !== peg$FAILED) {
|
|
s4.push(s5);
|
|
s5 = peg$parseletter();
|
|
}
|
|
s3 = [s3, s4];
|
|
s2 = s3;
|
|
} else {
|
|
peg$currPos = s2;
|
|
s2 = peg$FAILED;
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
s1 = input.substring(s1, peg$currPos);
|
|
} else {
|
|
s1 = s2;
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
peg$savedPos = peg$currPos;
|
|
s2 = peg$f15(s1);
|
|
if (s2) {
|
|
s2 = peg$FAILED;
|
|
} else {
|
|
s2 = undefined;
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f16(s1);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseproper_noun() {
|
|
var s0, s1, s2, s3, s4, s5;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$currPos;
|
|
s2 = peg$currPos;
|
|
s3 = peg$parseuppercase_letter();
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = [];
|
|
s5 = peg$parseletter();
|
|
while (s5 !== peg$FAILED) {
|
|
s4.push(s5);
|
|
s5 = peg$parseletter();
|
|
}
|
|
s3 = [s3, s4];
|
|
s2 = s3;
|
|
} else {
|
|
peg$currPos = s2;
|
|
s2 = peg$FAILED;
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
s1 = input.substring(s1, peg$currPos);
|
|
} else {
|
|
s1 = s2;
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
peg$savedPos = peg$currPos;
|
|
s2 = peg$f17(s1);
|
|
if (s2) {
|
|
s2 = peg$FAILED;
|
|
} else {
|
|
s2 = undefined;
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f18(s1);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseproper_variable() {
|
|
var s0, s1, s2, s3, s4, s5, s6, s7, s8;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$currPos;
|
|
s2 = peg$currPos;
|
|
s3 = peg$parseproper_noun();
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = [];
|
|
s5 = peg$currPos;
|
|
if (input.charCodeAt(peg$currPos) === 32) {
|
|
s6 = peg$c39;
|
|
peg$currPos++;
|
|
} else {
|
|
s6 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e53); }
|
|
}
|
|
if (s6 !== peg$FAILED) {
|
|
s7 = peg$currPos;
|
|
s8 = peg$parseproper_noun();
|
|
if (s8 !== peg$FAILED) {
|
|
s7 = input.substring(s7, peg$currPos);
|
|
} else {
|
|
s7 = s8;
|
|
}
|
|
if (s7 !== peg$FAILED) {
|
|
s6 = [s6, s7];
|
|
s5 = s6;
|
|
} else {
|
|
peg$currPos = s5;
|
|
s5 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s5;
|
|
s5 = peg$FAILED;
|
|
}
|
|
while (s5 !== peg$FAILED) {
|
|
s4.push(s5);
|
|
s5 = peg$currPos;
|
|
if (input.charCodeAt(peg$currPos) === 32) {
|
|
s6 = peg$c39;
|
|
peg$currPos++;
|
|
} else {
|
|
s6 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e53); }
|
|
}
|
|
if (s6 !== peg$FAILED) {
|
|
s7 = peg$currPos;
|
|
s8 = peg$parseproper_noun();
|
|
if (s8 !== peg$FAILED) {
|
|
s7 = input.substring(s7, peg$currPos);
|
|
} else {
|
|
s7 = s8;
|
|
}
|
|
if (s7 !== peg$FAILED) {
|
|
s6 = [s6, s7];
|
|
s5 = s6;
|
|
} else {
|
|
peg$currPos = s5;
|
|
s5 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s5;
|
|
s5 = peg$FAILED;
|
|
}
|
|
}
|
|
s3 = [s3, s4];
|
|
s2 = s3;
|
|
} else {
|
|
peg$currPos = s2;
|
|
s2 = peg$FAILED;
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
s1 = input.substring(s1, peg$currPos);
|
|
} else {
|
|
s1 = s2;
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$f19(s1);
|
|
}
|
|
s0 = s1;
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsevariable_list_separator() {
|
|
var s0, s1, s2, s3;
|
|
|
|
peg$silentFails++;
|
|
s0 = peg$parseexpression_list_separator();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
s1 = peg$parse_();
|
|
if (s1 !== peg$FAILED) {
|
|
if (input.substr(peg$currPos, 3).toLowerCase() === peg$c40) {
|
|
s2 = input.substr(peg$currPos, 3);
|
|
peg$currPos += 3;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e55); }
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parse_();
|
|
if (s3 !== peg$FAILED) {
|
|
s1 = [s1, s2, s3];
|
|
s0 = s1;
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
}
|
|
peg$silentFails--;
|
|
if (s0 === peg$FAILED) {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e54); }
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsevariable_list() {
|
|
var s0, s1, s2, s3;
|
|
|
|
peg$silentFails++;
|
|
s0 = peg$currPos;
|
|
s1 = peg$parsevariable();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parsevariable_list_separator();
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parsevariable_list();
|
|
if (s3 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f20(s1, s3);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
s1 = peg$parsevariable();
|
|
if (s1 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$f21(s1);
|
|
}
|
|
s0 = s1;
|
|
}
|
|
peg$silentFails--;
|
|
if (s0 === peg$FAILED) {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e56); }
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseindexer() {
|
|
var s0, s1, s2, s3, s4;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parse_();
|
|
if (s1 !== peg$FAILED) {
|
|
if (input.substr(peg$currPos, 2).toLowerCase() === peg$c41) {
|
|
s2 = input.substr(peg$currPos, 2);
|
|
peg$currPos += 2;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e57); }
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parse_();
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parseexpression();
|
|
if (s4 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f22(s4);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseassignable() {
|
|
var s0, s1, s2;
|
|
|
|
peg$silentFails++;
|
|
s0 = peg$currPos;
|
|
s1 = peg$parsevariable();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parseindexer();
|
|
if (s2 === peg$FAILED) {
|
|
s2 = null;
|
|
}
|
|
peg$savedPos = s0;
|
|
s0 = peg$f23(s1, s2);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
peg$silentFails--;
|
|
if (s0 === peg$FAILED) {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e58); }
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsecompoundable_operator() {
|
|
var s0, s1;
|
|
|
|
peg$silentFails++;
|
|
s0 = peg$parseadd();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parsesubtract();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parsemultiply();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parsedivide();
|
|
}
|
|
}
|
|
}
|
|
peg$silentFails--;
|
|
if (s0 === peg$FAILED) {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e59); }
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseassignment() {
|
|
var s0, s1, s2, s3, s4, s5, s6, s7;
|
|
|
|
peg$silentFails++;
|
|
s0 = peg$currPos;
|
|
s1 = peg$parseassignable();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parseis();
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = [];
|
|
s4 = peg$parse_();
|
|
while (s4 !== peg$FAILED) {
|
|
s3.push(s4);
|
|
s4 = peg$parse_();
|
|
}
|
|
s4 = peg$parseliteral();
|
|
if (s4 === peg$FAILED) {
|
|
s4 = peg$parsepoetic_number();
|
|
}
|
|
if (s4 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f24(s1, s4);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
s1 = peg$parseassignable();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse_();
|
|
if (s2 !== peg$FAILED) {
|
|
if (input.substr(peg$currPos, 5).toLowerCase() === peg$c42) {
|
|
s3 = input.substr(peg$currPos, 5);
|
|
peg$currPos += 5;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e61); }
|
|
}
|
|
if (s3 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 4).toLowerCase() === peg$c43) {
|
|
s3 = input.substr(peg$currPos, 4);
|
|
peg$currPos += 4;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e62); }
|
|
}
|
|
if (s3 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 5).toLowerCase() === peg$c44) {
|
|
s3 = input.substr(peg$currPos, 5);
|
|
peg$currPos += 5;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e63); }
|
|
}
|
|
}
|
|
}
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parsepoetic_string();
|
|
peg$savedPos = s0;
|
|
s0 = peg$f24(s1, s4);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 3).toLowerCase() === peg$c45) {
|
|
s1 = input.substr(peg$currPos, 3);
|
|
peg$currPos += 3;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e64); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse_();
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parseexpression();
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parseinto();
|
|
if (s4 !== peg$FAILED) {
|
|
s5 = peg$parseassignable();
|
|
if (s5 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f25(s3, s5);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 3).toLowerCase() === peg$c46) {
|
|
s1 = input.substr(peg$currPos, 3);
|
|
peg$currPos += 3;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e65); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse_();
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parseassignable();
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parse_();
|
|
if (s4 !== peg$FAILED) {
|
|
if (input.substr(peg$currPos, 2).toLowerCase() === peg$c47) {
|
|
s5 = input.substr(peg$currPos, 2);
|
|
peg$currPos += 2;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e66); }
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$parsecompoundable_operator();
|
|
if (s6 !== peg$FAILED) {
|
|
s7 = peg$parseexpression();
|
|
if (s7 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f26(s3, s6, s7);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 3).toLowerCase() === peg$c46) {
|
|
s1 = input.substr(peg$currPos, 3);
|
|
peg$currPos += 3;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e65); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse_();
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parseassignable();
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parse_();
|
|
if (s4 !== peg$FAILED) {
|
|
if (input.substr(peg$currPos, 2).toLowerCase() === peg$c47) {
|
|
s5 = input.substr(peg$currPos, 2);
|
|
peg$currPos += 2;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e66); }
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$parse_();
|
|
if (s6 !== peg$FAILED) {
|
|
s7 = peg$parseexpression();
|
|
if (s7 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f27(s3, s7);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
s1 = peg$parsepush();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse_();
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parseexpression();
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parseinto();
|
|
if (s4 !== peg$FAILED) {
|
|
s5 = peg$parsevariable();
|
|
if (s5 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f28(s3, s5);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
s1 = peg$parsepush();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse_();
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parsevariable();
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parse_();
|
|
if (s4 !== peg$FAILED) {
|
|
if (input.substr(peg$currPos, 4).toLowerCase() === peg$c48) {
|
|
s5 = input.substr(peg$currPos, 4);
|
|
peg$currPos += 4;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e67); }
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$parse_();
|
|
if (s6 !== peg$FAILED) {
|
|
s7 = peg$parseliteral();
|
|
if (s7 === peg$FAILED) {
|
|
s7 = peg$parsepoetic_number();
|
|
}
|
|
if (s7 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f29(s3, s7);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
s1 = peg$parsepush();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse_();
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parsevariable();
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$currPos;
|
|
s5 = peg$parse_();
|
|
if (s5 !== peg$FAILED) {
|
|
if (input.substr(peg$currPos, 4).toLowerCase() === peg$c49) {
|
|
s6 = input.substr(peg$currPos, 4);
|
|
peg$currPos += 4;
|
|
} else {
|
|
s6 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e68); }
|
|
}
|
|
if (s6 !== peg$FAILED) {
|
|
s5 = [s5, s6];
|
|
s4 = s5;
|
|
} else {
|
|
peg$currPos = s4;
|
|
s4 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s4;
|
|
s4 = peg$FAILED;
|
|
}
|
|
if (s4 === peg$FAILED) {
|
|
s4 = null;
|
|
}
|
|
s5 = peg$parse_();
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$parseexpression();
|
|
if (s6 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f29(s3, s6);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
s1 = peg$parsepush();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse_();
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parsevariable();
|
|
if (s3 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f30(s3);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
s1 = peg$parsedelist();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parseinto();
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parseassignable();
|
|
if (s3 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f31(s1, s3);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
peg$silentFails--;
|
|
if (s0 === peg$FAILED) {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e60); }
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseexpression_list_separator() {
|
|
var s0, s1, s2, s3;
|
|
|
|
peg$silentFails++;
|
|
s0 = peg$currPos;
|
|
s1 = peg$parse_();
|
|
if (s1 === peg$FAILED) {
|
|
s1 = null;
|
|
}
|
|
if (input.substr(peg$currPos, 5).toLowerCase() === peg$c50) {
|
|
s2 = input.substr(peg$currPos, 5);
|
|
peg$currPos += 5;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e69); }
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parse_();
|
|
if (s3 !== peg$FAILED) {
|
|
s1 = [s1, s2, s3];
|
|
s0 = s1;
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
s1 = peg$parse_();
|
|
if (s1 === peg$FAILED) {
|
|
s1 = null;
|
|
}
|
|
if (input.charCodeAt(peg$currPos) === 38) {
|
|
s2 = peg$c51;
|
|
peg$currPos++;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e70); }
|
|
}
|
|
if (s2 === peg$FAILED) {
|
|
if (input.charCodeAt(peg$currPos) === 44) {
|
|
s2 = peg$c52;
|
|
peg$currPos++;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e71); }
|
|
}
|
|
if (s2 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 3).toLowerCase() === peg$c53) {
|
|
s2 = input.substr(peg$currPos, 3);
|
|
peg$currPos += 3;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e72); }
|
|
}
|
|
}
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parse_();
|
|
if (s3 === peg$FAILED) {
|
|
s3 = null;
|
|
}
|
|
s1 = [s1, s2, s3];
|
|
s0 = s1;
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
}
|
|
peg$silentFails--;
|
|
if (s0 === peg$FAILED) {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e54); }
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseexpression_list() {
|
|
var s0, s1, s2, s3;
|
|
|
|
peg$silentFails++;
|
|
s0 = peg$currPos;
|
|
s1 = peg$parsesimple_expression();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parseexpression_list_separator();
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parseexpression_list();
|
|
if (s3 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f20(s1, s3);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
s1 = peg$parsesimple_expression();
|
|
if (s1 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$f21(s1);
|
|
}
|
|
s0 = s1;
|
|
}
|
|
peg$silentFails--;
|
|
if (s0 === peg$FAILED) {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e73); }
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseexpression() {
|
|
var s0, s1;
|
|
|
|
peg$silentFails++;
|
|
s0 = peg$parsenor();
|
|
peg$silentFails--;
|
|
if (s0 === peg$FAILED) {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e74); }
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsenor() {
|
|
var s0, s1, s2, s3, s4, s5;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parseor();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse_();
|
|
if (s2 !== peg$FAILED) {
|
|
if (input.substr(peg$currPos, 3).toLowerCase() === peg$c54) {
|
|
s3 = input.substr(peg$currPos, 3);
|
|
peg$currPos += 3;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e75); }
|
|
}
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parse_();
|
|
if (s4 !== peg$FAILED) {
|
|
s5 = peg$parsenor();
|
|
if (s5 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f32(s1, s5);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parseor();
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseor() {
|
|
var s0, s1, s2, s3, s4, s5;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parseand();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse_();
|
|
if (s2 !== peg$FAILED) {
|
|
if (input.substr(peg$currPos, 2).toLowerCase() === peg$c55) {
|
|
s3 = input.substr(peg$currPos, 2);
|
|
peg$currPos += 2;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e76); }
|
|
}
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parse_();
|
|
if (s4 !== peg$FAILED) {
|
|
s5 = peg$parseor();
|
|
if (s5 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f33(s1, s5);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parseand();
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseand() {
|
|
var s0, s1, s2, s3, s4, s5;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parseequality_check();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse_();
|
|
if (s2 !== peg$FAILED) {
|
|
if (input.substr(peg$currPos, 3).toLowerCase() === peg$c40) {
|
|
s3 = input.substr(peg$currPos, 3);
|
|
peg$currPos += 3;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e55); }
|
|
}
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parse_();
|
|
if (s4 !== peg$FAILED) {
|
|
s5 = peg$parseand();
|
|
if (s5 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f34(s1, s5);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parseequality_check();
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseis() {
|
|
var s0, s1, s2, s3;
|
|
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 2).toLowerCase() === peg$c56) {
|
|
s1 = input.substr(peg$currPos, 2);
|
|
peg$currPos += 2;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e77); }
|
|
}
|
|
if (s1 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 3).toLowerCase() === peg$c57) {
|
|
s1 = input.substr(peg$currPos, 3);
|
|
peg$currPos += 3;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e78); }
|
|
}
|
|
if (s1 === peg$FAILED) {
|
|
s1 = peg$currPos;
|
|
s2 = peg$parse_();
|
|
if (s2 !== peg$FAILED) {
|
|
if (input.charCodeAt(peg$currPos) === 61) {
|
|
s3 = peg$c58;
|
|
peg$currPos++;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e79); }
|
|
}
|
|
if (s3 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 2).toLowerCase() === peg$c59) {
|
|
s3 = input.substr(peg$currPos, 2);
|
|
peg$currPos += 2;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e80); }
|
|
}
|
|
if (s3 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 3).toLowerCase() === peg$c60) {
|
|
s3 = input.substr(peg$currPos, 3);
|
|
peg$currPos += 3;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e81); }
|
|
}
|
|
if (s3 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 3).toLowerCase() === peg$c61) {
|
|
s3 = input.substr(peg$currPos, 3);
|
|
peg$currPos += 3;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e82); }
|
|
}
|
|
if (s3 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 4).toLowerCase() === peg$c62) {
|
|
s3 = input.substr(peg$currPos, 4);
|
|
peg$currPos += 4;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e83); }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (s3 !== peg$FAILED) {
|
|
s2 = [s2, s3];
|
|
s1 = s2;
|
|
} else {
|
|
peg$currPos = s1;
|
|
s1 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s1;
|
|
s1 = peg$FAILED;
|
|
}
|
|
}
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse_();
|
|
if (s2 !== peg$FAILED) {
|
|
s1 = [s1, s2];
|
|
s0 = s1;
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseisnt() {
|
|
var s0, s1, s2, s3;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parse_();
|
|
if (s1 !== peg$FAILED) {
|
|
if (input.substr(peg$currPos, 4).toLowerCase() === peg$c63) {
|
|
s2 = input.substr(peg$currPos, 4);
|
|
peg$currPos += 4;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e84); }
|
|
}
|
|
if (s2 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 5).toLowerCase() === peg$c64) {
|
|
s2 = input.substr(peg$currPos, 5);
|
|
peg$currPos += 5;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e85); }
|
|
}
|
|
if (s2 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 4).toLowerCase() === peg$c65) {
|
|
s2 = input.substr(peg$currPos, 4);
|
|
peg$currPos += 4;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e86); }
|
|
}
|
|
if (s2 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 5).toLowerCase() === peg$c66) {
|
|
s2 = input.substr(peg$currPos, 5);
|
|
peg$currPos += 5;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e87); }
|
|
}
|
|
if (s2 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 5).toLowerCase() === peg$c67) {
|
|
s2 = input.substr(peg$currPos, 5);
|
|
peg$currPos += 5;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e88); }
|
|
}
|
|
if (s2 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 6).toLowerCase() === peg$c68) {
|
|
s2 = input.substr(peg$currPos, 6);
|
|
peg$currPos += 6;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e89); }
|
|
}
|
|
if (s2 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 5).toLowerCase() === peg$c69) {
|
|
s2 = input.substr(peg$currPos, 5);
|
|
peg$currPos += 5;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e90); }
|
|
}
|
|
if (s2 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 6).toLowerCase() === peg$c70) {
|
|
s2 = input.substr(peg$currPos, 6);
|
|
peg$currPos += 6;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e91); }
|
|
}
|
|
if (s2 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 6).toLowerCase() === peg$c71) {
|
|
s2 = input.substr(peg$currPos, 6);
|
|
peg$currPos += 6;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e92); }
|
|
}
|
|
if (s2 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 7).toLowerCase() === peg$c72) {
|
|
s2 = input.substr(peg$currPos, 7);
|
|
peg$currPos += 7;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e93); }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parse_();
|
|
if (s3 !== peg$FAILED) {
|
|
s1 = [s1, s2, s3];
|
|
s0 = s1;
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseeq() {
|
|
var s0, s1;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parseisnt();
|
|
if (s1 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$f35();
|
|
}
|
|
s0 = s1;
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
s1 = peg$parseis();
|
|
if (s1 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$f36();
|
|
}
|
|
s0 = s1;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseequality_check() {
|
|
var s0, s1, s2, s3;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parsenot();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parseeq();
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parseequality_check();
|
|
if (s3 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f37(s1, s2, s3);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parsenot();
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsenot() {
|
|
var s0, s1, s2, s3;
|
|
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 3).toLowerCase() === peg$c73) {
|
|
s1 = input.substr(peg$currPos, 3);
|
|
peg$currPos += 3;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e94); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse_();
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parsenot();
|
|
if (s3 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f38(s3);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parsecomparison();
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsegreater() {
|
|
var s0;
|
|
|
|
if (input.substr(peg$currPos, 6).toLowerCase() === peg$c74) {
|
|
s0 = input.substr(peg$currPos, 6);
|
|
peg$currPos += 6;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e95); }
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 7).toLowerCase() === peg$c75) {
|
|
s0 = input.substr(peg$currPos, 7);
|
|
peg$currPos += 7;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e96); }
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 6).toLowerCase() === peg$c76) {
|
|
s0 = input.substr(peg$currPos, 6);
|
|
peg$currPos += 6;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e97); }
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 8).toLowerCase() === peg$c77) {
|
|
s0 = input.substr(peg$currPos, 8);
|
|
peg$currPos += 8;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e98); }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsesmaller() {
|
|
var s0;
|
|
|
|
if (input.substr(peg$currPos, 5).toLowerCase() === peg$c78) {
|
|
s0 = input.substr(peg$currPos, 5);
|
|
peg$currPos += 5;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e99); }
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 4).toLowerCase() === peg$c79) {
|
|
s0 = input.substr(peg$currPos, 4);
|
|
peg$currPos += 4;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e100); }
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 7).toLowerCase() === peg$c80) {
|
|
s0 = input.substr(peg$currPos, 7);
|
|
peg$currPos += 7;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e101); }
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 6).toLowerCase() === peg$c81) {
|
|
s0 = input.substr(peg$currPos, 6);
|
|
peg$currPos += 6;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e102); }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsegreat() {
|
|
var s0;
|
|
|
|
if (input.substr(peg$currPos, 4).toLowerCase() === peg$c82) {
|
|
s0 = input.substr(peg$currPos, 4);
|
|
peg$currPos += 4;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e103); }
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 5).toLowerCase() === peg$c83) {
|
|
s0 = input.substr(peg$currPos, 5);
|
|
peg$currPos += 5;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e104); }
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 3).toLowerCase() === peg$c84) {
|
|
s0 = input.substr(peg$currPos, 3);
|
|
peg$currPos += 3;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e105); }
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 6).toLowerCase() === peg$c85) {
|
|
s0 = input.substr(peg$currPos, 6);
|
|
peg$currPos += 6;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e106); }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsesmall() {
|
|
var s0;
|
|
|
|
if (input.substr(peg$currPos, 3).toLowerCase() === peg$c86) {
|
|
s0 = input.substr(peg$currPos, 3);
|
|
peg$currPos += 3;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e107); }
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 6).toLowerCase() === peg$c87) {
|
|
s0 = input.substr(peg$currPos, 6);
|
|
peg$currPos += 6;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e108); }
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 5).toLowerCase() === peg$c88) {
|
|
s0 = input.substr(peg$currPos, 5);
|
|
peg$currPos += 5;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e109); }
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 4).toLowerCase() === peg$c89) {
|
|
s0 = input.substr(peg$currPos, 4);
|
|
peg$currPos += 4;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e110); }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsecomparator() {
|
|
var s0, s1, s2, s3, s4, s5, s6, s7;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parseis();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parsegreater();
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parse_();
|
|
if (s3 !== peg$FAILED) {
|
|
if (input.substr(peg$currPos, 4).toLowerCase() === peg$c90) {
|
|
s4 = input.substr(peg$currPos, 4);
|
|
peg$currPos += 4;
|
|
} else {
|
|
s4 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e111); }
|
|
}
|
|
if (s4 !== peg$FAILED) {
|
|
s5 = peg$parse_();
|
|
if (s5 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f39();
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
s1 = peg$parseis();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parsesmaller();
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parse_();
|
|
if (s3 !== peg$FAILED) {
|
|
if (input.substr(peg$currPos, 4).toLowerCase() === peg$c90) {
|
|
s4 = input.substr(peg$currPos, 4);
|
|
peg$currPos += 4;
|
|
} else {
|
|
s4 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e111); }
|
|
}
|
|
if (s4 !== peg$FAILED) {
|
|
s5 = peg$parse_();
|
|
if (s5 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f40();
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
s1 = peg$parseis();
|
|
if (s1 !== peg$FAILED) {
|
|
if (input.substr(peg$currPos, 2).toLowerCase() === peg$c91) {
|
|
s2 = input.substr(peg$currPos, 2);
|
|
peg$currPos += 2;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e112); }
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parse_();
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parsegreat();
|
|
if (s4 !== peg$FAILED) {
|
|
s5 = peg$parse_();
|
|
if (s5 !== peg$FAILED) {
|
|
if (input.substr(peg$currPos, 2).toLowerCase() === peg$c91) {
|
|
s6 = input.substr(peg$currPos, 2);
|
|
peg$currPos += 2;
|
|
} else {
|
|
s6 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e112); }
|
|
}
|
|
if (s6 !== peg$FAILED) {
|
|
s7 = peg$parse_();
|
|
if (s7 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f41();
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
s1 = peg$parseis();
|
|
if (s1 !== peg$FAILED) {
|
|
if (input.substr(peg$currPos, 2).toLowerCase() === peg$c91) {
|
|
s2 = input.substr(peg$currPos, 2);
|
|
peg$currPos += 2;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e112); }
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parse_();
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parsesmall();
|
|
if (s4 !== peg$FAILED) {
|
|
s5 = peg$parse_();
|
|
if (s5 !== peg$FAILED) {
|
|
if (input.substr(peg$currPos, 2).toLowerCase() === peg$c91) {
|
|
s6 = input.substr(peg$currPos, 2);
|
|
peg$currPos += 2;
|
|
} else {
|
|
s6 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e112); }
|
|
}
|
|
if (s6 !== peg$FAILED) {
|
|
s7 = peg$parse_();
|
|
if (s7 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f42();
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsecomparison() {
|
|
var s0, s1, s2, s3;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parsearithmetic();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parsecomparator();
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parsecomparison();
|
|
if (s3 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f37(s1, s2, s3);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parsearithmetic();
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsearithmetic() {
|
|
var s0, s1, s2, s3, s4, s5;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parseproduct();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = [];
|
|
s3 = peg$currPos;
|
|
s4 = peg$parseadd();
|
|
if (s4 === peg$FAILED) {
|
|
s4 = peg$parsesubtract();
|
|
}
|
|
if (s4 !== peg$FAILED) {
|
|
s5 = peg$parseproduct();
|
|
if (s5 !== peg$FAILED) {
|
|
s4 = [s4, s5];
|
|
s3 = s4;
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
if (s3 !== peg$FAILED) {
|
|
while (s3 !== peg$FAILED) {
|
|
s2.push(s3);
|
|
s3 = peg$currPos;
|
|
s4 = peg$parseadd();
|
|
if (s4 === peg$FAILED) {
|
|
s4 = peg$parsesubtract();
|
|
}
|
|
if (s4 !== peg$FAILED) {
|
|
s5 = peg$parseproduct();
|
|
if (s5 !== peg$FAILED) {
|
|
s4 = [s4, s5];
|
|
s3 = s4;
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
}
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f43(s1, s2);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parseproduct();
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseproduct() {
|
|
var s0, s1, s2, s3, s4, s5;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parsesimple_expression();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = [];
|
|
s3 = peg$currPos;
|
|
s4 = peg$parsemultiply();
|
|
if (s4 === peg$FAILED) {
|
|
s4 = peg$parsedivide();
|
|
}
|
|
if (s4 !== peg$FAILED) {
|
|
s5 = peg$parseexpression_list();
|
|
if (s5 !== peg$FAILED) {
|
|
s4 = [s4, s5];
|
|
s3 = s4;
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
if (s3 !== peg$FAILED) {
|
|
while (s3 !== peg$FAILED) {
|
|
s2.push(s3);
|
|
s3 = peg$currPos;
|
|
s4 = peg$parsemultiply();
|
|
if (s4 === peg$FAILED) {
|
|
s4 = peg$parsedivide();
|
|
}
|
|
if (s4 !== peg$FAILED) {
|
|
s5 = peg$parseexpression_list();
|
|
if (s5 !== peg$FAILED) {
|
|
s4 = [s4, s5];
|
|
s3 = s4;
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
}
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f44(s1, s2);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parseexpression_list();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parsesimple_expression();
|
|
}
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsesimple_expression() {
|
|
var s0;
|
|
|
|
s0 = peg$parsefunction_call();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parseconstant();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parselookup();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parseliteral();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parsepronoun();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsefunction_call() {
|
|
var s0, s1, s2, s3, s4, s5;
|
|
|
|
peg$silentFails++;
|
|
s0 = peg$currPos;
|
|
s1 = peg$parsevariable();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse_();
|
|
if (s2 !== peg$FAILED) {
|
|
if (input.substr(peg$currPos, 6).toLowerCase() === peg$c92) {
|
|
s3 = input.substr(peg$currPos, 6);
|
|
peg$currPos += 6;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e114); }
|
|
}
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parse_();
|
|
if (s4 !== peg$FAILED) {
|
|
s5 = peg$parseexpression_list();
|
|
if (s5 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f45(s1, s5);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
peg$silentFails--;
|
|
if (s0 === peg$FAILED) {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e113); }
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseliteral() {
|
|
var s0, s1;
|
|
|
|
peg$silentFails++;
|
|
s0 = peg$parseconstant();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parsenumber();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parsestring();
|
|
}
|
|
}
|
|
peg$silentFails--;
|
|
if (s0 === peg$FAILED) {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e115); }
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseconstant() {
|
|
var s0, s1;
|
|
|
|
peg$silentFails++;
|
|
s0 = peg$parsenull();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parsetrue();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parsefalse();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parseempty_string();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parsemysterious();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
peg$silentFails--;
|
|
if (s0 === peg$FAILED) {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e116); }
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsenull() {
|
|
var s0, s1;
|
|
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 4).toLowerCase() === peg$c93) {
|
|
s1 = input.substr(peg$currPos, 4);
|
|
peg$currPos += 4;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e117); }
|
|
}
|
|
if (s1 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 7).toLowerCase() === peg$c94) {
|
|
s1 = input.substr(peg$currPos, 7);
|
|
peg$currPos += 7;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e118); }
|
|
}
|
|
if (s1 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 7).toLowerCase() === peg$c95) {
|
|
s1 = input.substr(peg$currPos, 7);
|
|
peg$currPos += 7;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e119); }
|
|
}
|
|
if (s1 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 6).toLowerCase() === peg$c96) {
|
|
s1 = input.substr(peg$currPos, 6);
|
|
peg$currPos += 6;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e120); }
|
|
}
|
|
if (s1 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 4).toLowerCase() === peg$c97) {
|
|
s1 = input.substr(peg$currPos, 4);
|
|
peg$currPos += 4;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e121); }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$f46();
|
|
}
|
|
s0 = s1;
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsetrue() {
|
|
var s0, s1, s2, s3;
|
|
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 4).toLowerCase() === peg$c98) {
|
|
s1 = input.substr(peg$currPos, 4);
|
|
peg$currPos += 4;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e122); }
|
|
}
|
|
if (s1 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 2).toLowerCase() === peg$c99) {
|
|
s1 = input.substr(peg$currPos, 2);
|
|
peg$currPos += 2;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e123); }
|
|
}
|
|
if (s1 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 5).toLowerCase() === peg$c100) {
|
|
s1 = input.substr(peg$currPos, 5);
|
|
peg$currPos += 5;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e124); }
|
|
}
|
|
if (s1 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 3).toLowerCase() === peg$c101) {
|
|
s1 = input.substr(peg$currPos, 3);
|
|
peg$currPos += 3;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e125); }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$currPos;
|
|
peg$silentFails++;
|
|
s3 = peg$parseletter();
|
|
peg$silentFails--;
|
|
if (s3 === peg$FAILED) {
|
|
s2 = undefined;
|
|
} else {
|
|
peg$currPos = s2;
|
|
s2 = peg$FAILED;
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f47();
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsefalse() {
|
|
var s0, s1, s2, s3;
|
|
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 5).toLowerCase() === peg$c102) {
|
|
s1 = input.substr(peg$currPos, 5);
|
|
peg$currPos += 5;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e126); }
|
|
}
|
|
if (s1 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 4).toLowerCase() === peg$c103) {
|
|
s1 = input.substr(peg$currPos, 4);
|
|
peg$currPos += 4;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e127); }
|
|
}
|
|
if (s1 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 5).toLowerCase() === peg$c104) {
|
|
s1 = input.substr(peg$currPos, 5);
|
|
peg$currPos += 5;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e128); }
|
|
}
|
|
if (s1 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 2).toLowerCase() === peg$c105) {
|
|
s1 = input.substr(peg$currPos, 2);
|
|
peg$currPos += 2;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e129); }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$currPos;
|
|
peg$silentFails++;
|
|
s3 = peg$parseletter();
|
|
peg$silentFails--;
|
|
if (s3 === peg$FAILED) {
|
|
s2 = undefined;
|
|
} else {
|
|
peg$currPos = s2;
|
|
s2 = peg$FAILED;
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f48();
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseempty_string() {
|
|
var s0, s1;
|
|
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 5).toLowerCase() === peg$c106) {
|
|
s1 = input.substr(peg$currPos, 5);
|
|
peg$currPos += 5;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e130); }
|
|
}
|
|
if (s1 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 6).toLowerCase() === peg$c107) {
|
|
s1 = input.substr(peg$currPos, 6);
|
|
peg$currPos += 6;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e131); }
|
|
}
|
|
if (s1 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 7).toLowerCase() === peg$c108) {
|
|
s1 = input.substr(peg$currPos, 7);
|
|
peg$currPos += 7;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e132); }
|
|
}
|
|
}
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$f49();
|
|
}
|
|
s0 = s1;
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsemysterious() {
|
|
var s0, s1;
|
|
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 10).toLowerCase() === peg$c109) {
|
|
s1 = input.substr(peg$currPos, 10);
|
|
peg$currPos += 10;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e133); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$f50();
|
|
}
|
|
s0 = s1;
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsenumber() {
|
|
var s0, s1, s2, s3, s4, s5, s6, s7, s8;
|
|
|
|
peg$silentFails++;
|
|
s0 = peg$currPos;
|
|
s1 = peg$currPos;
|
|
s2 = peg$currPos;
|
|
if (input.charCodeAt(peg$currPos) === 45) {
|
|
s3 = peg$c110;
|
|
peg$currPos++;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e135); }
|
|
}
|
|
if (s3 === peg$FAILED) {
|
|
s3 = null;
|
|
}
|
|
s4 = [];
|
|
if (peg$r6.test(input.charAt(peg$currPos))) {
|
|
s5 = input.charAt(peg$currPos);
|
|
peg$currPos++;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e136); }
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
while (s5 !== peg$FAILED) {
|
|
s4.push(s5);
|
|
if (peg$r6.test(input.charAt(peg$currPos))) {
|
|
s5 = input.charAt(peg$currPos);
|
|
peg$currPos++;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e136); }
|
|
}
|
|
}
|
|
} else {
|
|
s4 = peg$FAILED;
|
|
}
|
|
if (s4 !== peg$FAILED) {
|
|
s5 = peg$currPos;
|
|
if (input.charCodeAt(peg$currPos) === 46) {
|
|
s6 = peg$c111;
|
|
peg$currPos++;
|
|
} else {
|
|
s6 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e137); }
|
|
}
|
|
if (s6 !== peg$FAILED) {
|
|
s7 = [];
|
|
if (peg$r6.test(input.charAt(peg$currPos))) {
|
|
s8 = input.charAt(peg$currPos);
|
|
peg$currPos++;
|
|
} else {
|
|
s8 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e136); }
|
|
}
|
|
if (s8 !== peg$FAILED) {
|
|
while (s8 !== peg$FAILED) {
|
|
s7.push(s8);
|
|
if (peg$r6.test(input.charAt(peg$currPos))) {
|
|
s8 = input.charAt(peg$currPos);
|
|
peg$currPos++;
|
|
} else {
|
|
s8 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e136); }
|
|
}
|
|
}
|
|
} else {
|
|
s7 = peg$FAILED;
|
|
}
|
|
if (s7 !== peg$FAILED) {
|
|
s6 = [s6, s7];
|
|
s5 = s6;
|
|
} else {
|
|
peg$currPos = s5;
|
|
s5 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s5;
|
|
s5 = peg$FAILED;
|
|
}
|
|
if (s5 === peg$FAILED) {
|
|
s5 = null;
|
|
}
|
|
s3 = [s3, s4, s5];
|
|
s2 = s3;
|
|
} else {
|
|
peg$currPos = s2;
|
|
s2 = peg$FAILED;
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
s1 = input.substring(s1, peg$currPos);
|
|
} else {
|
|
s1 = s2;
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
if (input.charCodeAt(peg$currPos) === 46) {
|
|
s2 = peg$c111;
|
|
peg$currPos++;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e137); }
|
|
}
|
|
if (s2 === peg$FAILED) {
|
|
s2 = null;
|
|
}
|
|
peg$savedPos = s0;
|
|
s0 = peg$f51(s1);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
s1 = peg$currPos;
|
|
s2 = peg$currPos;
|
|
if (input.charCodeAt(peg$currPos) === 46) {
|
|
s3 = peg$c111;
|
|
peg$currPos++;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e137); }
|
|
}
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = [];
|
|
if (peg$r6.test(input.charAt(peg$currPos))) {
|
|
s5 = input.charAt(peg$currPos);
|
|
peg$currPos++;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e136); }
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
while (s5 !== peg$FAILED) {
|
|
s4.push(s5);
|
|
if (peg$r6.test(input.charAt(peg$currPos))) {
|
|
s5 = input.charAt(peg$currPos);
|
|
peg$currPos++;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e136); }
|
|
}
|
|
}
|
|
} else {
|
|
s4 = peg$FAILED;
|
|
}
|
|
if (s4 !== peg$FAILED) {
|
|
s3 = [s3, s4];
|
|
s2 = s3;
|
|
} else {
|
|
peg$currPos = s2;
|
|
s2 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s2;
|
|
s2 = peg$FAILED;
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
s1 = input.substring(s1, peg$currPos);
|
|
} else {
|
|
s1 = s2;
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$f52(s1);
|
|
}
|
|
s0 = s1;
|
|
}
|
|
peg$silentFails--;
|
|
if (s0 === peg$FAILED) {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e134); }
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsestring() {
|
|
var s0, s1, s2, s3, s4;
|
|
|
|
peg$silentFails++;
|
|
s0 = peg$currPos;
|
|
if (input.charCodeAt(peg$currPos) === 34) {
|
|
s1 = peg$c112;
|
|
peg$currPos++;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e139); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$currPos;
|
|
s3 = [];
|
|
if (peg$r7.test(input.charAt(peg$currPos))) {
|
|
s4 = input.charAt(peg$currPos);
|
|
peg$currPos++;
|
|
} else {
|
|
s4 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e140); }
|
|
}
|
|
while (s4 !== peg$FAILED) {
|
|
s3.push(s4);
|
|
if (peg$r7.test(input.charAt(peg$currPos))) {
|
|
s4 = input.charAt(peg$currPos);
|
|
peg$currPos++;
|
|
} else {
|
|
s4 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e140); }
|
|
}
|
|
}
|
|
s2 = input.substring(s2, peg$currPos);
|
|
if (input.charCodeAt(peg$currPos) === 34) {
|
|
s3 = peg$c112;
|
|
peg$currPos++;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e139); }
|
|
}
|
|
if (s3 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f53(s2);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
peg$silentFails--;
|
|
if (s0 === peg$FAILED) {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e138); }
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseoperation() {
|
|
var s0, s1;
|
|
|
|
peg$silentFails++;
|
|
s0 = peg$parsereadline();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parseoutput();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parsecrement();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parsemutation();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parseassignment();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parserounding();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
peg$silentFails--;
|
|
if (s0 === peg$FAILED) {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e141); }
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsereadline() {
|
|
var s0, s1, s2, s3;
|
|
|
|
peg$silentFails++;
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 9).toLowerCase() === peg$c113) {
|
|
s1 = input.substr(peg$currPos, 9);
|
|
peg$currPos += 9;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e143); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse_();
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parseassignable();
|
|
if (s3 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f54(s3);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 6).toLowerCase() === peg$c114) {
|
|
s1 = input.substr(peg$currPos, 6);
|
|
peg$currPos += 6;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e144); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$f55();
|
|
}
|
|
s0 = s1;
|
|
}
|
|
peg$silentFails--;
|
|
if (s0 === peg$FAILED) {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e142); }
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseoutput() {
|
|
var s0, s1, s2, s3;
|
|
|
|
peg$silentFails++;
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 3).toLowerCase() === peg$c115) {
|
|
s1 = input.substr(peg$currPos, 3);
|
|
peg$currPos += 3;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e146); }
|
|
}
|
|
if (s1 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 5).toLowerCase() === peg$c116) {
|
|
s1 = input.substr(peg$currPos, 5);
|
|
peg$currPos += 5;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e147); }
|
|
}
|
|
if (s1 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 7).toLowerCase() === peg$c117) {
|
|
s1 = input.substr(peg$currPos, 7);
|
|
peg$currPos += 7;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e148); }
|
|
}
|
|
if (s1 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 6).toLowerCase() === peg$c118) {
|
|
s1 = input.substr(peg$currPos, 6);
|
|
peg$currPos += 6;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e149); }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse_();
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parseexpression();
|
|
if (s3 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f56(s3);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
peg$silentFails--;
|
|
if (s0 === peg$FAILED) {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e145); }
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsecrement() {
|
|
var s0, s1;
|
|
|
|
peg$silentFails++;
|
|
s0 = peg$parseincrement();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parsedecrement();
|
|
}
|
|
peg$silentFails--;
|
|
if (s0 === peg$FAILED) {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e150); }
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseincrement() {
|
|
var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9;
|
|
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 5).toLowerCase() === peg$c119) {
|
|
s1 = input.substr(peg$currPos, 5);
|
|
peg$currPos += 5;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e151); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse_();
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parsevariable();
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parse_();
|
|
if (s4 !== peg$FAILED) {
|
|
s5 = [];
|
|
s6 = peg$currPos;
|
|
if (input.substr(peg$currPos, 2).toLowerCase() === peg$c120) {
|
|
s7 = input.substr(peg$currPos, 2);
|
|
peg$currPos += 2;
|
|
} else {
|
|
s7 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e152); }
|
|
}
|
|
if (s7 !== peg$FAILED) {
|
|
s8 = [];
|
|
s9 = peg$parsenoise();
|
|
while (s9 !== peg$FAILED) {
|
|
s8.push(s9);
|
|
s9 = peg$parsenoise();
|
|
}
|
|
s7 = [s7, s8];
|
|
s6 = s7;
|
|
} else {
|
|
peg$currPos = s6;
|
|
s6 = peg$FAILED;
|
|
}
|
|
if (s6 !== peg$FAILED) {
|
|
while (s6 !== peg$FAILED) {
|
|
s5.push(s6);
|
|
s6 = peg$currPos;
|
|
if (input.substr(peg$currPos, 2).toLowerCase() === peg$c120) {
|
|
s7 = input.substr(peg$currPos, 2);
|
|
peg$currPos += 2;
|
|
} else {
|
|
s7 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e152); }
|
|
}
|
|
if (s7 !== peg$FAILED) {
|
|
s8 = [];
|
|
s9 = peg$parsenoise();
|
|
while (s9 !== peg$FAILED) {
|
|
s8.push(s9);
|
|
s9 = peg$parsenoise();
|
|
}
|
|
s7 = [s7, s8];
|
|
s6 = s7;
|
|
} else {
|
|
peg$currPos = s6;
|
|
s6 = peg$FAILED;
|
|
}
|
|
}
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f57(s3, s5);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsedecrement() {
|
|
var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9;
|
|
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 5).toLowerCase() === peg$c121) {
|
|
s1 = input.substr(peg$currPos, 5);
|
|
peg$currPos += 5;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e153); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse_();
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parsevariable();
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parse_();
|
|
if (s4 !== peg$FAILED) {
|
|
s5 = [];
|
|
s6 = peg$currPos;
|
|
if (input.substr(peg$currPos, 4).toLowerCase() === peg$c122) {
|
|
s7 = input.substr(peg$currPos, 4);
|
|
peg$currPos += 4;
|
|
} else {
|
|
s7 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e154); }
|
|
}
|
|
if (s7 !== peg$FAILED) {
|
|
s8 = [];
|
|
s9 = peg$parsenoise();
|
|
while (s9 !== peg$FAILED) {
|
|
s8.push(s9);
|
|
s9 = peg$parsenoise();
|
|
}
|
|
s7 = [s7, s8];
|
|
s6 = s7;
|
|
} else {
|
|
peg$currPos = s6;
|
|
s6 = peg$FAILED;
|
|
}
|
|
if (s6 !== peg$FAILED) {
|
|
while (s6 !== peg$FAILED) {
|
|
s5.push(s6);
|
|
s6 = peg$currPos;
|
|
if (input.substr(peg$currPos, 4).toLowerCase() === peg$c122) {
|
|
s7 = input.substr(peg$currPos, 4);
|
|
peg$currPos += 4;
|
|
} else {
|
|
s7 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e154); }
|
|
}
|
|
if (s7 !== peg$FAILED) {
|
|
s8 = [];
|
|
s9 = peg$parsenoise();
|
|
while (s9 !== peg$FAILED) {
|
|
s8.push(s9);
|
|
s9 = peg$parsenoise();
|
|
}
|
|
s7 = [s7, s8];
|
|
s6 = s7;
|
|
} else {
|
|
peg$currPos = s6;
|
|
s6 = peg$FAILED;
|
|
}
|
|
}
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f58(s3, s5);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsesplit() {
|
|
var s0, s1;
|
|
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 3).toLowerCase() === peg$c123) {
|
|
s1 = input.substr(peg$currPos, 3);
|
|
peg$currPos += 3;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e155); }
|
|
}
|
|
if (s1 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 5).toLowerCase() === peg$c124) {
|
|
s1 = input.substr(peg$currPos, 5);
|
|
peg$currPos += 5;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e156); }
|
|
}
|
|
if (s1 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 7).toLowerCase() === peg$c125) {
|
|
s1 = input.substr(peg$currPos, 7);
|
|
peg$currPos += 7;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e157); }
|
|
}
|
|
}
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$f59();
|
|
}
|
|
s0 = s1;
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsecast() {
|
|
var s0, s1;
|
|
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 4).toLowerCase() === peg$c126) {
|
|
s1 = input.substr(peg$currPos, 4);
|
|
peg$currPos += 4;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e158); }
|
|
}
|
|
if (s1 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 4).toLowerCase() === peg$c127) {
|
|
s1 = input.substr(peg$currPos, 4);
|
|
peg$currPos += 4;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e159); }
|
|
}
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$f60();
|
|
}
|
|
s0 = s1;
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsejoin() {
|
|
var s0, s1;
|
|
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 4).toLowerCase() === peg$c128) {
|
|
s1 = input.substr(peg$currPos, 4);
|
|
peg$currPos += 4;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e160); }
|
|
}
|
|
if (s1 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 5).toLowerCase() === peg$c129) {
|
|
s1 = input.substr(peg$currPos, 5);
|
|
peg$currPos += 5;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e161); }
|
|
}
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$f61();
|
|
}
|
|
s0 = s1;
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsemutator() {
|
|
var s0, s1;
|
|
|
|
peg$silentFails++;
|
|
s0 = peg$parsesplit();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parsecast();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parsejoin();
|
|
}
|
|
}
|
|
peg$silentFails--;
|
|
if (s0 === peg$FAILED) {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e162); }
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsemodifier() {
|
|
var s0, s1, s2, s3, s4;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parse_();
|
|
if (s1 !== peg$FAILED) {
|
|
if (input.substr(peg$currPos, 4).toLowerCase() === peg$c49) {
|
|
s2 = input.substr(peg$currPos, 4);
|
|
peg$currPos += 4;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e68); }
|
|
}
|
|
if (s2 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 5).toLowerCase() === peg$c130) {
|
|
s2 = input.substr(peg$currPos, 5);
|
|
peg$currPos += 5;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e163); }
|
|
}
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parse_();
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parseexpression();
|
|
if (s4 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f62(s4);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsemutation() {
|
|
var s0, s1, s2, s3, s4, s5, s6;
|
|
|
|
peg$silentFails++;
|
|
s0 = peg$currPos;
|
|
s1 = peg$parsemutator();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse_();
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parseexpression();
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parseinto();
|
|
if (s4 !== peg$FAILED) {
|
|
s5 = peg$parseassignable();
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$parsemodifier();
|
|
if (s6 === peg$FAILED) {
|
|
s6 = null;
|
|
}
|
|
peg$savedPos = s0;
|
|
s0 = peg$f63(s1, s3, s5, s6);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
s1 = peg$parsemutator();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse_();
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parseassignable();
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parsemodifier();
|
|
if (s4 === peg$FAILED) {
|
|
s4 = null;
|
|
}
|
|
peg$savedPos = s0;
|
|
s0 = peg$f64(s1, s3, s4);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
}
|
|
peg$silentFails--;
|
|
if (s0 === peg$FAILED) {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e164); }
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parserounding() {
|
|
var s0, s1;
|
|
|
|
peg$silentFails++;
|
|
s0 = peg$parsefloor();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parseceil();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parsemath_round();
|
|
}
|
|
}
|
|
peg$silentFails--;
|
|
if (s0 === peg$FAILED) {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e165); }
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsefloor() {
|
|
var s0, s1, s2, s3, s4, s5;
|
|
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 4).toLowerCase() === peg$c131) {
|
|
s1 = input.substr(peg$currPos, 4);
|
|
peg$currPos += 4;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e166); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse_();
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parsevariable();
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parse_();
|
|
if (s4 !== peg$FAILED) {
|
|
if (input.substr(peg$currPos, 4).toLowerCase() === peg$c122) {
|
|
s5 = input.substr(peg$currPos, 4);
|
|
peg$currPos += 4;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e154); }
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f65(s3);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 4).toLowerCase() === peg$c131) {
|
|
s1 = input.substr(peg$currPos, 4);
|
|
peg$currPos += 4;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e166); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse_();
|
|
if (s2 !== peg$FAILED) {
|
|
if (input.substr(peg$currPos, 4).toLowerCase() === peg$c122) {
|
|
s3 = input.substr(peg$currPos, 4);
|
|
peg$currPos += 4;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e154); }
|
|
}
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parse_();
|
|
if (s4 !== peg$FAILED) {
|
|
s5 = peg$parsevariable();
|
|
if (s5 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f65(s5);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseceil() {
|
|
var s0, s1, s2, s3, s4, s5;
|
|
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 4).toLowerCase() === peg$c131) {
|
|
s1 = input.substr(peg$currPos, 4);
|
|
peg$currPos += 4;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e166); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse_();
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parsevariable();
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parse_();
|
|
if (s4 !== peg$FAILED) {
|
|
if (input.substr(peg$currPos, 2).toLowerCase() === peg$c120) {
|
|
s5 = input.substr(peg$currPos, 2);
|
|
peg$currPos += 2;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e152); }
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f66(s3);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 4).toLowerCase() === peg$c131) {
|
|
s1 = input.substr(peg$currPos, 4);
|
|
peg$currPos += 4;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e166); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse_();
|
|
if (s2 !== peg$FAILED) {
|
|
if (input.substr(peg$currPos, 2).toLowerCase() === peg$c120) {
|
|
s3 = input.substr(peg$currPos, 2);
|
|
peg$currPos += 2;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e152); }
|
|
}
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parse_();
|
|
if (s4 !== peg$FAILED) {
|
|
s5 = peg$parsevariable();
|
|
if (s5 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f67(s5);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsemath_round() {
|
|
var s0, s1, s2, s3, s4, s5;
|
|
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 4).toLowerCase() === peg$c131) {
|
|
s1 = input.substr(peg$currPos, 4);
|
|
peg$currPos += 4;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e166); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse_();
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parsevariable();
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parse_();
|
|
if (s4 !== peg$FAILED) {
|
|
if (input.substr(peg$currPos, 5).toLowerCase() === peg$c132) {
|
|
s5 = input.substr(peg$currPos, 5);
|
|
peg$currPos += 5;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e167); }
|
|
}
|
|
if (s5 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 6).toLowerCase() === peg$c133) {
|
|
s5 = input.substr(peg$currPos, 6);
|
|
peg$currPos += 6;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e168); }
|
|
}
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f68(s3);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 4).toLowerCase() === peg$c131) {
|
|
s1 = input.substr(peg$currPos, 4);
|
|
peg$currPos += 4;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e166); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse_();
|
|
if (s2 !== peg$FAILED) {
|
|
if (input.substr(peg$currPos, 5).toLowerCase() === peg$c132) {
|
|
s3 = input.substr(peg$currPos, 5);
|
|
peg$currPos += 5;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e167); }
|
|
}
|
|
if (s3 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 6).toLowerCase() === peg$c133) {
|
|
s3 = input.substr(peg$currPos, 6);
|
|
peg$currPos += 6;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e168); }
|
|
}
|
|
}
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parse_();
|
|
if (s4 !== peg$FAILED) {
|
|
s5 = peg$parsevariable();
|
|
if (s5 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f68(s5);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseadd() {
|
|
var s0, s1, s2, s3, s4;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = [];
|
|
s2 = peg$parse_();
|
|
while (s2 !== peg$FAILED) {
|
|
s1.push(s2);
|
|
s2 = peg$parse_();
|
|
}
|
|
if (input.charCodeAt(peg$currPos) === 43) {
|
|
s2 = peg$c134;
|
|
peg$currPos++;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e169); }
|
|
}
|
|
if (s2 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 5).toLowerCase() === peg$c135) {
|
|
s2 = input.substr(peg$currPos, 5);
|
|
peg$currPos += 5;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e170); }
|
|
}
|
|
if (s2 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 5).toLowerCase() === peg$c136) {
|
|
s2 = input.substr(peg$currPos, 5);
|
|
peg$currPos += 5;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e171); }
|
|
}
|
|
}
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = [];
|
|
s4 = peg$parse_();
|
|
while (s4 !== peg$FAILED) {
|
|
s3.push(s4);
|
|
s4 = peg$parse_();
|
|
}
|
|
peg$savedPos = s0;
|
|
s0 = peg$f69();
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsesubtract() {
|
|
var s0, s1, s2, s3, s4;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = [];
|
|
s2 = peg$parse_();
|
|
while (s2 !== peg$FAILED) {
|
|
s1.push(s2);
|
|
s2 = peg$parse_();
|
|
}
|
|
if (input.charCodeAt(peg$currPos) === 45) {
|
|
s2 = peg$c110;
|
|
peg$currPos++;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e135); }
|
|
}
|
|
if (s2 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 6).toLowerCase() === peg$c137) {
|
|
s2 = input.substr(peg$currPos, 6);
|
|
peg$currPos += 6;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e172); }
|
|
}
|
|
if (s2 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 8).toLowerCase() === peg$c138) {
|
|
s2 = input.substr(peg$currPos, 8);
|
|
peg$currPos += 8;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e173); }
|
|
}
|
|
}
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = [];
|
|
s4 = peg$parse_();
|
|
while (s4 !== peg$FAILED) {
|
|
s3.push(s4);
|
|
s4 = peg$parse_();
|
|
}
|
|
peg$savedPos = s0;
|
|
s0 = peg$f70();
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsemultiply() {
|
|
var s0, s1, s2, s3, s4;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = [];
|
|
s2 = peg$parse_();
|
|
while (s2 !== peg$FAILED) {
|
|
s1.push(s2);
|
|
s2 = peg$parse_();
|
|
}
|
|
if (input.charCodeAt(peg$currPos) === 42) {
|
|
s2 = peg$c139;
|
|
peg$currPos++;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e174); }
|
|
}
|
|
if (s2 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 6).toLowerCase() === peg$c140) {
|
|
s2 = input.substr(peg$currPos, 6);
|
|
peg$currPos += 6;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e175); }
|
|
}
|
|
if (s2 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 3).toLowerCase() === peg$c141) {
|
|
s2 = input.substr(peg$currPos, 3);
|
|
peg$currPos += 3;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e176); }
|
|
}
|
|
}
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = [];
|
|
s4 = peg$parse_();
|
|
while (s4 !== peg$FAILED) {
|
|
s3.push(s4);
|
|
s4 = peg$parse_();
|
|
}
|
|
peg$savedPos = s0;
|
|
s0 = peg$f71();
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsedivide() {
|
|
var s0, s1, s2, s3, s4;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = [];
|
|
s2 = peg$parse_();
|
|
while (s2 !== peg$FAILED) {
|
|
s1.push(s2);
|
|
s2 = peg$parse_();
|
|
}
|
|
if (input.charCodeAt(peg$currPos) === 47) {
|
|
s2 = peg$c142;
|
|
peg$currPos++;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e177); }
|
|
}
|
|
if (s2 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 5).toLowerCase() === peg$c143) {
|
|
s2 = input.substr(peg$currPos, 5);
|
|
peg$currPos += 5;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e178); }
|
|
}
|
|
if (s2 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 8).toLowerCase() === peg$c144) {
|
|
s2 = input.substr(peg$currPos, 8);
|
|
peg$currPos += 8;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e179); }
|
|
}
|
|
}
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = [];
|
|
s4 = peg$parse_();
|
|
while (s4 !== peg$FAILED) {
|
|
s3.push(s4);
|
|
s4 = peg$parse_();
|
|
}
|
|
peg$savedPos = s0;
|
|
s0 = peg$f72();
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsepush() {
|
|
var s0;
|
|
|
|
if (input.substr(peg$currPos, 4).toLowerCase() === peg$c145) {
|
|
s0 = input.substr(peg$currPos, 4);
|
|
peg$currPos += 4;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e180); }
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 4).toLowerCase() === peg$c146) {
|
|
s0 = input.substr(peg$currPos, 4);
|
|
peg$currPos += 4;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e181); }
|
|
}
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsepop() {
|
|
var s0;
|
|
|
|
if (input.substr(peg$currPos, 4).toLowerCase() === peg$c147) {
|
|
s0 = input.substr(peg$currPos, 4);
|
|
peg$currPos += 4;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e182); }
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 3).toLowerCase() === peg$c148) {
|
|
s0 = input.substr(peg$currPos, 3);
|
|
peg$currPos += 3;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e183); }
|
|
}
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseinto() {
|
|
var s0, s1, s2, s3;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parse_();
|
|
if (s1 !== peg$FAILED) {
|
|
if (input.substr(peg$currPos, 4).toLowerCase() === peg$c149) {
|
|
s2 = input.substr(peg$currPos, 4);
|
|
peg$currPos += 4;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e184); }
|
|
}
|
|
if (s2 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 2).toLowerCase() === peg$c150) {
|
|
s2 = input.substr(peg$currPos, 2);
|
|
peg$currPos += 2;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e185); }
|
|
}
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parse_();
|
|
if (s3 !== peg$FAILED) {
|
|
s1 = [s1, s2, s3];
|
|
s0 = s1;
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsedelist() {
|
|
var s0, s1, s2, s3;
|
|
|
|
peg$silentFails++;
|
|
s0 = peg$currPos;
|
|
s1 = peg$parsepop();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse_();
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parsevariable();
|
|
if (s3 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f73(s3);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
peg$silentFails--;
|
|
if (s0 === peg$FAILED) {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e186); }
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parselookup() {
|
|
var s0, s1, s2, s3, s4, s5;
|
|
|
|
peg$silentFails++;
|
|
s0 = peg$currPos;
|
|
s1 = peg$parsedelist();
|
|
if (s1 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$f74(s1);
|
|
}
|
|
s0 = s1;
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
s1 = peg$parsevariable();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse_();
|
|
if (s2 !== peg$FAILED) {
|
|
if (input.substr(peg$currPos, 2).toLowerCase() === peg$c41) {
|
|
s3 = input.substr(peg$currPos, 2);
|
|
peg$currPos += 2;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e57); }
|
|
}
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parse_();
|
|
if (s4 !== peg$FAILED) {
|
|
s5 = peg$parseexpression();
|
|
if (s5 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f75(s1, s5);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
s1 = peg$parsevariable();
|
|
if (s1 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$f76(s1);
|
|
}
|
|
s0 = s1;
|
|
}
|
|
}
|
|
peg$silentFails--;
|
|
if (s0 === peg$FAILED) {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e187); }
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsepoetic_string() {
|
|
var s0, s1, s2, s3;
|
|
|
|
peg$silentFails++;
|
|
s0 = peg$currPos;
|
|
s1 = peg$currPos;
|
|
s2 = [];
|
|
if (peg$r8.test(input.charAt(peg$currPos))) {
|
|
s3 = input.charAt(peg$currPos);
|
|
peg$currPos++;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e189); }
|
|
}
|
|
while (s3 !== peg$FAILED) {
|
|
s2.push(s3);
|
|
if (peg$r8.test(input.charAt(peg$currPos))) {
|
|
s3 = input.charAt(peg$currPos);
|
|
peg$currPos++;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e189); }
|
|
}
|
|
}
|
|
s1 = input.substring(s1, peg$currPos);
|
|
peg$savedPos = s0;
|
|
s1 = peg$f77(s1);
|
|
s0 = s1;
|
|
peg$silentFails--;
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e188); }
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsepoetic_number() {
|
|
var s0, s1, s2, s3, s4, s5, s6;
|
|
|
|
peg$silentFails++;
|
|
s0 = peg$currPos;
|
|
s1 = [];
|
|
s2 = peg$parsepoetic_digit_separator();
|
|
while (s2 !== peg$FAILED) {
|
|
s1.push(s2);
|
|
s2 = peg$parsepoetic_digit_separator();
|
|
}
|
|
s2 = peg$parsepoetic_digits();
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = [];
|
|
s4 = peg$parsepoetic_digit_separator();
|
|
while (s4 !== peg$FAILED) {
|
|
s3.push(s4);
|
|
s4 = peg$parsepoetic_digit_separator();
|
|
}
|
|
s4 = peg$parsepoetic_decimal();
|
|
if (s4 === peg$FAILED) {
|
|
s4 = null;
|
|
}
|
|
s5 = [];
|
|
s6 = peg$parsepoetic_digit_separator();
|
|
while (s6 !== peg$FAILED) {
|
|
s5.push(s6);
|
|
s6 = peg$parsepoetic_digit_separator();
|
|
}
|
|
peg$savedPos = s0;
|
|
s0 = peg$f78(s2, s4);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
peg$silentFails--;
|
|
if (s0 === peg$FAILED) {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e190); }
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsepoetic_decimal() {
|
|
var s0, s1, s2, s3, s4, s5;
|
|
|
|
s0 = peg$currPos;
|
|
if (input.charCodeAt(peg$currPos) === 46) {
|
|
s1 = peg$c111;
|
|
peg$currPos++;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e137); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = [];
|
|
s3 = peg$parsepoetic_decimal_digit_separator();
|
|
while (s3 !== peg$FAILED) {
|
|
s2.push(s3);
|
|
s3 = peg$parsepoetic_decimal_digit_separator();
|
|
}
|
|
s3 = peg$parsepoetic_decimal_digits();
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = [];
|
|
s5 = peg$parsepoetic_decimal_digit_separator();
|
|
while (s5 !== peg$FAILED) {
|
|
s4.push(s5);
|
|
s5 = peg$parsepoetic_decimal_digit_separator();
|
|
}
|
|
peg$savedPos = s0;
|
|
s0 = peg$f79(s3);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
if (input.charCodeAt(peg$currPos) === 46) {
|
|
s1 = peg$c111;
|
|
peg$currPos++;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e137); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = [];
|
|
s3 = peg$parsepoetic_decimal_digit_separator();
|
|
while (s3 !== peg$FAILED) {
|
|
s2.push(s3);
|
|
s3 = peg$parsepoetic_decimal_digit_separator();
|
|
}
|
|
s1 = [s1, s2];
|
|
s0 = s1;
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsepoetic_digit_separator() {
|
|
var s0;
|
|
|
|
s0 = peg$parse_();
|
|
if (s0 === peg$FAILED) {
|
|
if (peg$r9.test(input.charAt(peg$currPos))) {
|
|
s0 = input.charAt(peg$currPos);
|
|
peg$currPos++;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e191); }
|
|
}
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsepoetic_digits() {
|
|
var s0, s1, s2, s3, s4;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = [];
|
|
s2 = peg$parsepoetic_digit_separator();
|
|
while (s2 !== peg$FAILED) {
|
|
s1.push(s2);
|
|
s2 = peg$parsepoetic_digit_separator();
|
|
}
|
|
s2 = peg$parsepoetic_digit();
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = [];
|
|
s4 = peg$parsepoetic_digit_separator();
|
|
if (s4 !== peg$FAILED) {
|
|
while (s4 !== peg$FAILED) {
|
|
s3.push(s4);
|
|
s4 = peg$parsepoetic_digit_separator();
|
|
}
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
}
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parsepoetic_digits();
|
|
if (s4 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f80(s2, s4);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
s1 = peg$parsepoetic_digit();
|
|
if (s1 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$f81(s1);
|
|
}
|
|
s0 = s1;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsepoetic_decimal_digit_separator() {
|
|
var s0;
|
|
|
|
s0 = peg$parse_();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parsepoetic_digit_separator();
|
|
if (s0 === peg$FAILED) {
|
|
if (input.charCodeAt(peg$currPos) === 46) {
|
|
s0 = peg$c111;
|
|
peg$currPos++;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e137); }
|
|
}
|
|
}
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsepoetic_decimal_digits() {
|
|
var s0, s1, s2, s3, s4;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = [];
|
|
s2 = peg$parsepoetic_decimal_digit_separator();
|
|
while (s2 !== peg$FAILED) {
|
|
s1.push(s2);
|
|
s2 = peg$parsepoetic_decimal_digit_separator();
|
|
}
|
|
s2 = peg$parsepoetic_digit();
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = [];
|
|
s4 = peg$parsepoetic_decimal_digit_separator();
|
|
if (s4 !== peg$FAILED) {
|
|
while (s4 !== peg$FAILED) {
|
|
s3.push(s4);
|
|
s4 = peg$parsepoetic_decimal_digit_separator();
|
|
}
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
}
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parsepoetic_decimal_digits();
|
|
if (s4 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f80(s2, s4);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
s1 = peg$parsepoetic_digit();
|
|
if (s1 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$f81(s1);
|
|
}
|
|
s0 = s1;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsepoetic_digit() {
|
|
var s0, s1, s2;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = [];
|
|
if (peg$r10.test(input.charAt(peg$currPos))) {
|
|
s2 = input.charAt(peg$currPos);
|
|
peg$currPos++;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e192); }
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
while (s2 !== peg$FAILED) {
|
|
s1.push(s2);
|
|
if (peg$r10.test(input.charAt(peg$currPos))) {
|
|
s2 = input.charAt(peg$currPos);
|
|
peg$currPos++;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e192); }
|
|
}
|
|
}
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$f82(s1);
|
|
}
|
|
s0 = s1;
|
|
|
|
return s0;
|
|
}
|
|
|
|
|
|
/* initialiser code - this is JS that runs before the parser is generated */
|
|
|
|
const keywords = new Set([
|
|
// common variable prefixes
|
|
'a', 'an', 'the', 'my', 'your', 'our',
|
|
|
|
// pronouns
|
|
'it', 'he', 'she', 'him', 'her', 'they', 'them', 'ze', 'hir', 'zie', 'zir', 'xe', 'xem', 've', 'ver',
|
|
|
|
// literal values
|
|
'mysterious',
|
|
'null', 'nothing', 'nowhere', 'nobody', 'gone',
|
|
'true', 'right', 'yes', 'ok',
|
|
'false', 'wrong', 'no', 'lies',
|
|
'maybe', 'definitely', // reserved for future use
|
|
'empty', 'silent', 'silence',
|
|
|
|
// assignment
|
|
'let', 'be', 'put', 'into', 'in', // expression
|
|
'is', 'are', 'was', 'were', 'say', 'says', 'said', // poetic
|
|
|
|
// operations
|
|
'at', 'rock', 'with', 'roll', 'into', 'push', 'pop', 'like', // arrays
|
|
'cut', 'split', 'shatter', 'join', 'unite', 'cast', 'burn', // strings
|
|
'build', 'up', 'knock', 'down', // increment/decrement
|
|
'plus', 'with', 'minus', 'without', 'times', 'of', 'over', 'between', // arithmetic
|
|
'and', // list arithmetic
|
|
'turn', 'up', 'down', 'round', 'around', // rounding
|
|
'and', 'or', 'nor', 'not', // logical
|
|
|
|
// comparison
|
|
'is', "isn't", 'isnt', "ain't", 'aint',
|
|
'arent', "aren't", 'wasnt', "wasn't", 'werent', "weren't",
|
|
'not',
|
|
'than',
|
|
'higher', 'greater', 'bigger', 'stronger',
|
|
'lower', 'less', 'smaller', 'weaker',
|
|
'as',
|
|
'high', 'great', 'big', 'strong',
|
|
'low', 'little', 'small', 'weak',
|
|
|
|
// input/output
|
|
'listen', 'to',
|
|
'say', 'shout', 'whisper', 'scream',
|
|
|
|
// control flow
|
|
'if', 'else',
|
|
'while', 'until',
|
|
'break', 'continue',
|
|
'break', 'it', 'down',
|
|
'take', 'it', 'to', 'the', 'top',
|
|
'take',
|
|
|
|
// functions
|
|
'takes', 'wants',
|
|
'give', 'return', 'send', 'back',
|
|
'taking',
|
|
])
|
|
|
|
function isKeyword(string) {
|
|
return keywords.has(string.toLowerCase());
|
|
}
|
|
|
|
|
|
peg$result = peg$startRuleFunction();
|
|
|
|
if (peg$result !== peg$FAILED && peg$currPos === input.length) {
|
|
return peg$result;
|
|
} else {
|
|
if (peg$result !== peg$FAILED && peg$currPos < input.length) {
|
|
peg$fail(peg$endExpectation());
|
|
}
|
|
|
|
throw peg$buildStructuredError(
|
|
peg$maxFailExpected,
|
|
peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
|
|
peg$maxFailPos < input.length
|
|
? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
|
|
: peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
|
|
);
|
|
}
|
|
}
|
|
|
|
module.exports = {
|
|
SyntaxError: peg$SyntaxError,
|
|
parse: peg$parse
|
|
};
|