advanced-poe-filter-parser
Version:
Advanced PoE Filter is used by [Filter of Kalandra](https://filter-of-kalandra.netlify.com/).
1,405 lines (1,311 loc) • 178 kB
JavaScript
// Generated by Peggy 3.0.2.
//
// 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);
// istanbul ignore next Check is a necessary evil to support older environments
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 offset_s = (this.location.source && (typeof this.location.source.offset === "function"))
? this.location.source.offset(s)
: s;
var loc = this.location.source + ":" + offset_s.line + ":" + offset_s.column;
if (src) {
var e = this.location.end;
var filler = peg$padEnd("", offset_s.line.toString().length, ' ');
var line = src[s.line - 1];
var last = s.line === e.line ? e.column : line.length + 1;
var hatLen = (last - s.column) || 1;
str += "\n --> " + loc + "\n"
+ filler + " |\n"
+ offset_s.line + " | " + line + "\n"
+ filler + " | " + peg$padEnd("", s.column - 1, ' ')
+ peg$padEnd("", hatLen, "^");
} 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.join("") + "]";
},
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 = { start: peg$parsestart };
var peg$startRuleFunction = peg$parsestart;
var peg$c0 = "Show";
var peg$c1 = "Hide";
var peg$c2 = "Unset";
var peg$c3 = "Ignore";
var peg$c4 = "Fork";
var peg$c5 = "Mixin";
var peg$c6 = "#";
var peg$c7 = "Class";
var peg$c8 = "BaseType";
var peg$c9 = "DropLevel";
var peg$c10 = "ItemLevel";
var peg$c11 = "AreaLevel";
var peg$c12 = "GemLevel";
var peg$c13 = "TransfiguredGem";
var peg$c14 = "StackSize";
var peg$c15 = "MapTier";
var peg$c16 = "WaystoneTier";
var peg$c17 = "Quality";
var peg$c18 = "LinkedSockets";
var peg$c19 = "Sockets";
var peg$c20 = "SocketGroup";
var peg$c21 = "Rarity";
var peg$c22 = "BaseDefencePercentile";
var peg$c23 = "BaseArmour";
var peg$c24 = "BaseEnergyShield";
var peg$c25 = "BaseEvasion";
var peg$c26 = "BaseWard";
var peg$c27 = "FracturedItem";
var peg$c28 = "SynthesisedItem";
var peg$c29 = "Corrupted";
var peg$c30 = "Mirrored";
var peg$c31 = "Identified";
var peg$c32 = "Scourged";
var peg$c33 = "ShapedMap";
var peg$c34 = "ElderMap";
var peg$c35 = "BlightedMap";
var peg$c36 = "UberBlightedMap";
var peg$c37 = "Height";
var peg$c38 = "Width";
var peg$c39 = "CorruptedMods";
var peg$c40 = "EnchantmentPassiveNum";
var peg$c41 = "HasExplicitMod";
var peg$c42 = "HasImplicitMod";
var peg$c43 = "HasEaterOfWorldsImplicit";
var peg$c44 = "HasSearingExarchImplicit";
var peg$c45 = "AnyEnchantment";
var peg$c46 = "HasEnchantment";
var peg$c47 = "HasInfluence";
var peg$c48 = "EnchantmentPassiveNode";
var peg$c49 = "Replica";
var peg$c50 = "ArchnemesisMod";
var peg$c51 = "HasCruciblePassiveTree";
var peg$c52 = "None";
var peg$c53 = "SetBorderColor";
var peg$c54 = "SetTextColor";
var peg$c55 = "SetBackgroundColor";
var peg$c56 = "SetFontSize";
var peg$c57 = "PlayAlertSound";
var peg$c58 = "PlayAlertSoundPositional";
var peg$c59 = "CustomAlertSound";
var peg$c60 = "CustomAlertSoundOptional";
var peg$c61 = "DisableDropSoundIfAlertSound";
var peg$c62 = "EnableDropSoundIfAlertSound";
var peg$c63 = "DisableDropSound";
var peg$c64 = "EnableDropSound";
var peg$c65 = "MinimapIcon";
var peg$c66 = "PlayEffect";
var peg$c67 = "Negate";
var peg$c68 = "()";
var peg$c69 = "Grayscale";
var peg$c70 = "Saturate";
var peg$c71 = "(";
var peg$c72 = "%";
var peg$c73 = ")";
var peg$c74 = "Desaturate";
var peg$c75 = "Lighten";
var peg$c76 = "Darken";
var peg$c77 = "Whiten";
var peg$c78 = "Blacken";
var peg$c79 = "Hex";
var peg$c80 = "Saturation";
var peg$c81 = "Lightness";
var peg$c82 = "Plus";
var peg$c83 = "Minus";
var peg$c84 = "Temp";
var peg$c85 = "<=";
var peg$c86 = ">=";
var peg$c87 = "<";
var peg$c88 = ">";
var peg$c89 = "=";
var peg$c90 = "==";
var peg$c91 = "Normal";
var peg$c92 = "Magic";
var peg$c93 = "Rare";
var peg$c94 = "Unique";
var peg$c95 = "R";
var peg$c96 = "G";
var peg$c97 = "B";
var peg$c98 = "W";
var peg$c99 = "A";
var peg$c100 = "D";
var peg$c101 = "1";
var peg$c102 = "2";
var peg$c103 = "3";
var peg$c104 = "4";
var peg$c105 = "5";
var peg$c106 = "6";
var peg$c107 = "Lesser";
var peg$c108 = "Greater";
var peg$c109 = "Grand";
var peg$c110 = "Exceptional";
var peg$c111 = "Exquisite";
var peg$c112 = "Perfect";
var peg$c113 = "0";
var peg$c114 = "Large";
var peg$c115 = "Medium";
var peg$c116 = "Small";
var peg$c117 = "Red";
var peg$c118 = "Green";
var peg$c119 = "Blue";
var peg$c120 = "Brown";
var peg$c121 = "White";
var peg$c122 = "Yellow";
var peg$c123 = "Cyan";
var peg$c124 = "Grey";
var peg$c125 = "Orange";
var peg$c126 = "Pink";
var peg$c127 = "Purple";
var peg$c128 = "Circle";
var peg$c129 = "Diamond";
var peg$c130 = "Hexagon";
var peg$c131 = "Square";
var peg$c132 = "Star";
var peg$c133 = "Triangle";
var peg$c134 = "Cross";
var peg$c135 = "Moon";
var peg$c136 = "Raindrop";
var peg$c137 = "Kite";
var peg$c138 = "Pentagon";
var peg$c139 = "UpsideDownHouse";
var peg$c140 = "10";
var peg$c141 = "11";
var peg$c142 = "12";
var peg$c143 = "13";
var peg$c144 = "14";
var peg$c145 = "15";
var peg$c146 = "16";
var peg$c147 = "7";
var peg$c148 = "8";
var peg$c149 = "9";
var peg$c150 = "ShAlchemy";
var peg$c151 = "ShBlessed";
var peg$c152 = "ShChaos";
var peg$c153 = "ShDivine";
var peg$c154 = "ShExalted";
var peg$c155 = "ShFusing";
var peg$c156 = "ShGeneral";
var peg$c157 = "ShMirror";
var peg$c158 = "ShRegal";
var peg$c159 = "ShVaal";
var peg$c160 = "True";
var peg$c161 = "False";
var peg$c162 = "\"";
var peg$c163 = " ";
var peg$c164 = " ";
var peg$r0 = /^[^\n]/;
var peg$r1 = /^[^\n|\^"]/;
var peg$r2 = /^[0-9]/;
var peg$r3 = /^[\n]/;
var peg$e0 = peg$literalExpectation("Show", false);
var peg$e1 = peg$literalExpectation("Hide", false);
var peg$e2 = peg$literalExpectation("Unset", false);
var peg$e3 = peg$literalExpectation("Ignore", false);
var peg$e4 = peg$literalExpectation("Fork", false);
var peg$e5 = peg$literalExpectation("Mixin", false);
var peg$e6 = peg$literalExpectation("#", false);
var peg$e7 = peg$classExpectation(["\n"], true, false);
var peg$e8 = peg$literalExpectation("Class", false);
var peg$e9 = peg$literalExpectation("BaseType", false);
var peg$e10 = peg$literalExpectation("DropLevel", false);
var peg$e11 = peg$literalExpectation("ItemLevel", false);
var peg$e12 = peg$literalExpectation("AreaLevel", false);
var peg$e13 = peg$literalExpectation("GemLevel", false);
var peg$e14 = peg$literalExpectation("TransfiguredGem", false);
var peg$e15 = peg$literalExpectation("StackSize", false);
var peg$e16 = peg$literalExpectation("MapTier", false);
var peg$e17 = peg$literalExpectation("WaystoneTier", false);
var peg$e18 = peg$literalExpectation("Quality", false);
var peg$e19 = peg$literalExpectation("LinkedSockets", false);
var peg$e20 = peg$literalExpectation("Sockets", false);
var peg$e21 = peg$literalExpectation("SocketGroup", false);
var peg$e22 = peg$literalExpectation("Rarity", false);
var peg$e23 = peg$literalExpectation("BaseDefencePercentile", false);
var peg$e24 = peg$literalExpectation("BaseArmour", false);
var peg$e25 = peg$literalExpectation("BaseEnergyShield", false);
var peg$e26 = peg$literalExpectation("BaseEvasion", false);
var peg$e27 = peg$literalExpectation("BaseWard", false);
var peg$e28 = peg$literalExpectation("FracturedItem", false);
var peg$e29 = peg$literalExpectation("SynthesisedItem", false);
var peg$e30 = peg$literalExpectation("Corrupted", false);
var peg$e31 = peg$literalExpectation("Mirrored", false);
var peg$e32 = peg$literalExpectation("Identified", false);
var peg$e33 = peg$literalExpectation("Scourged", false);
var peg$e34 = peg$literalExpectation("ShapedMap", false);
var peg$e35 = peg$literalExpectation("ElderMap", false);
var peg$e36 = peg$literalExpectation("BlightedMap", false);
var peg$e37 = peg$literalExpectation("UberBlightedMap", false);
var peg$e38 = peg$literalExpectation("Height", false);
var peg$e39 = peg$literalExpectation("Width", false);
var peg$e40 = peg$literalExpectation("CorruptedMods", false);
var peg$e41 = peg$literalExpectation("EnchantmentPassiveNum", false);
var peg$e42 = peg$literalExpectation("HasExplicitMod", false);
var peg$e43 = peg$literalExpectation("HasImplicitMod", false);
var peg$e44 = peg$literalExpectation("HasEaterOfWorldsImplicit", false);
var peg$e45 = peg$literalExpectation("HasSearingExarchImplicit", false);
var peg$e46 = peg$literalExpectation("AnyEnchantment", false);
var peg$e47 = peg$literalExpectation("HasEnchantment", false);
var peg$e48 = peg$literalExpectation("HasInfluence", false);
var peg$e49 = peg$literalExpectation("EnchantmentPassiveNode", false);
var peg$e50 = peg$literalExpectation("Replica", false);
var peg$e51 = peg$literalExpectation("ArchnemesisMod", false);
var peg$e52 = peg$literalExpectation("HasCruciblePassiveTree", false);
var peg$e53 = peg$literalExpectation("None", false);
var peg$e54 = peg$literalExpectation("SetBorderColor", false);
var peg$e55 = peg$literalExpectation("SetTextColor", false);
var peg$e56 = peg$literalExpectation("SetBackgroundColor", false);
var peg$e57 = peg$literalExpectation("SetFontSize", false);
var peg$e58 = peg$literalExpectation("PlayAlertSound", false);
var peg$e59 = peg$literalExpectation("PlayAlertSoundPositional", false);
var peg$e60 = peg$literalExpectation("CustomAlertSound", false);
var peg$e61 = peg$literalExpectation("CustomAlertSoundOptional", false);
var peg$e62 = peg$literalExpectation("DisableDropSoundIfAlertSound", false);
var peg$e63 = peg$literalExpectation("EnableDropSoundIfAlertSound", false);
var peg$e64 = peg$literalExpectation("DisableDropSound", false);
var peg$e65 = peg$literalExpectation("EnableDropSound", false);
var peg$e66 = peg$literalExpectation("MinimapIcon", false);
var peg$e67 = peg$literalExpectation("PlayEffect", false);
var peg$e68 = peg$literalExpectation("Negate", false);
var peg$e69 = peg$literalExpectation("()", false);
var peg$e70 = peg$literalExpectation("Grayscale", false);
var peg$e71 = peg$literalExpectation("Saturate", false);
var peg$e72 = peg$literalExpectation("(", false);
var peg$e73 = peg$literalExpectation("%", false);
var peg$e74 = peg$literalExpectation(")", false);
var peg$e75 = peg$literalExpectation("Desaturate", false);
var peg$e76 = peg$literalExpectation("Lighten", false);
var peg$e77 = peg$literalExpectation("Darken", false);
var peg$e78 = peg$literalExpectation("Whiten", false);
var peg$e79 = peg$literalExpectation("Blacken", false);
var peg$e80 = peg$literalExpectation("Hex", false);
var peg$e81 = peg$literalExpectation("Saturation", false);
var peg$e82 = peg$literalExpectation("Lightness", false);
var peg$e83 = peg$literalExpectation("Plus", false);
var peg$e84 = peg$literalExpectation("Minus", false);
var peg$e85 = peg$literalExpectation("Temp", false);
var peg$e86 = peg$literalExpectation("<=", false);
var peg$e87 = peg$literalExpectation(">=", false);
var peg$e88 = peg$literalExpectation("<", false);
var peg$e89 = peg$literalExpectation(">", false);
var peg$e90 = peg$literalExpectation("=", false);
var peg$e91 = peg$literalExpectation("==", false);
var peg$e92 = peg$literalExpectation("Normal", false);
var peg$e93 = peg$literalExpectation("Magic", false);
var peg$e94 = peg$literalExpectation("Rare", false);
var peg$e95 = peg$literalExpectation("Unique", false);
var peg$e96 = peg$literalExpectation("R", false);
var peg$e97 = peg$literalExpectation("G", false);
var peg$e98 = peg$literalExpectation("B", false);
var peg$e99 = peg$literalExpectation("W", false);
var peg$e100 = peg$literalExpectation("A", false);
var peg$e101 = peg$literalExpectation("D", false);
var peg$e102 = peg$literalExpectation("1", false);
var peg$e103 = peg$literalExpectation("2", false);
var peg$e104 = peg$literalExpectation("3", false);
var peg$e105 = peg$literalExpectation("4", false);
var peg$e106 = peg$literalExpectation("5", false);
var peg$e107 = peg$literalExpectation("6", false);
var peg$e108 = peg$literalExpectation("Lesser", false);
var peg$e109 = peg$literalExpectation("Greater", false);
var peg$e110 = peg$literalExpectation("Grand", false);
var peg$e111 = peg$literalExpectation("Exceptional", false);
var peg$e112 = peg$literalExpectation("Exquisite", false);
var peg$e113 = peg$literalExpectation("Perfect", false);
var peg$e114 = peg$literalExpectation("0", false);
var peg$e115 = peg$literalExpectation("Large", false);
var peg$e116 = peg$literalExpectation("Medium", false);
var peg$e117 = peg$literalExpectation("Small", false);
var peg$e118 = peg$literalExpectation("Red", false);
var peg$e119 = peg$literalExpectation("Green", false);
var peg$e120 = peg$literalExpectation("Blue", false);
var peg$e121 = peg$literalExpectation("Brown", false);
var peg$e122 = peg$literalExpectation("White", false);
var peg$e123 = peg$literalExpectation("Yellow", false);
var peg$e124 = peg$literalExpectation("Cyan", false);
var peg$e125 = peg$literalExpectation("Grey", false);
var peg$e126 = peg$literalExpectation("Orange", false);
var peg$e127 = peg$literalExpectation("Pink", false);
var peg$e128 = peg$literalExpectation("Purple", false);
var peg$e129 = peg$literalExpectation("Circle", false);
var peg$e130 = peg$literalExpectation("Diamond", false);
var peg$e131 = peg$literalExpectation("Hexagon", false);
var peg$e132 = peg$literalExpectation("Square", false);
var peg$e133 = peg$literalExpectation("Star", false);
var peg$e134 = peg$literalExpectation("Triangle", false);
var peg$e135 = peg$literalExpectation("Cross", false);
var peg$e136 = peg$literalExpectation("Moon", false);
var peg$e137 = peg$literalExpectation("Raindrop", false);
var peg$e138 = peg$literalExpectation("Kite", false);
var peg$e139 = peg$literalExpectation("Pentagon", false);
var peg$e140 = peg$literalExpectation("UpsideDownHouse", false);
var peg$e141 = peg$literalExpectation("10", false);
var peg$e142 = peg$literalExpectation("11", false);
var peg$e143 = peg$literalExpectation("12", false);
var peg$e144 = peg$literalExpectation("13", false);
var peg$e145 = peg$literalExpectation("14", false);
var peg$e146 = peg$literalExpectation("15", false);
var peg$e147 = peg$literalExpectation("16", false);
var peg$e148 = peg$literalExpectation("7", false);
var peg$e149 = peg$literalExpectation("8", false);
var peg$e150 = peg$literalExpectation("9", false);
var peg$e151 = peg$literalExpectation("ShAlchemy", false);
var peg$e152 = peg$literalExpectation("ShBlessed", false);
var peg$e153 = peg$literalExpectation("ShChaos", false);
var peg$e154 = peg$literalExpectation("ShDivine", false);
var peg$e155 = peg$literalExpectation("ShExalted", false);
var peg$e156 = peg$literalExpectation("ShFusing", false);
var peg$e157 = peg$literalExpectation("ShGeneral", false);
var peg$e158 = peg$literalExpectation("ShMirror", false);
var peg$e159 = peg$literalExpectation("ShRegal", false);
var peg$e160 = peg$literalExpectation("ShVaal", false);
var peg$e161 = peg$literalExpectation("True", false);
var peg$e162 = peg$literalExpectation("False", false);
var peg$e163 = peg$literalExpectation("\"", false);
var peg$e164 = peg$classExpectation(["\n", "|", "^", "\""], true, false);
var peg$e165 = peg$classExpectation([["0", "9"]], false, false);
var peg$e166 = peg$classExpectation(["\n"], false, false);
var peg$e167 = peg$literalExpectation(" ", false);
var peg$e168 = peg$literalExpectation(" ", false);
var peg$f0 = function(block) {
resetBlockId()
return block
};
var peg$f1 = function(activity, name, line0, lines, branches) {
let conditions = {};
let actions = {};
[line0].concat(lines.map(l => l[1])).forEach((line) => {
if(line.lineType == 'condition') {
conditions[line.attr] = line.val
} else if(line.lineType == 'action') {
actions[line.attr] = line.val
}
})
let allBranches = branches.map(m => m[1])
return { id: getBlockId(), name, activity, conditions, actions, branches: allBranches, location: location() }
};
var peg$f2 = function(activity, name) {
return { id: getBlockId(), name, activity, conditions: {}, actions: {}, branches: [], location: location() }
};
var peg$f3 = function(line) { return line };
var peg$f4 = function(type, name, block0, blocks) {
let allBlocks = [block0].concat(blocks.map(b => b[1]))
return { name, type, blocks: allBlocks, location: location() }
};
var peg$f5 = function(attr, val) { return { lineType: 'condition', attr, val} };
var peg$f6 = function(attr, val) { return { lineType: 'condition', attr, val} };
var peg$f7 = function(attr, val) { return { lineType: 'condition', attr, val} };
var peg$f8 = function(attr, val) { return { lineType: 'condition', attr, val} };
var peg$f9 = function(attr, val) { return { lineType: 'condition', attr, val} };
var peg$f10 = function(attr, val) { return { lineType: 'condition', attr, val} };
var peg$f11 = function(attr, val) { return { lineType: 'condition', attr, val} };
var peg$f12 = function(attr, val) { return { lineType: 'condition', attr, val} };
var peg$f13 = function(attr, val) { return { lineType: 'condition', attr, val} };
var peg$f14 = function(attr, val) { return { lineType: 'condition', attr, val} };
var peg$f15 = function(attr, val) { return { lineType: 'condition', attr, val} };
var peg$f16 = function(attr, val) { return { lineType: 'condition', attr, val} };
var peg$f17 = function(attr, val) { return { lineType: 'condition', attr, val} };
var peg$f18 = function(attr, val) { return { lineType: 'condition', attr, val} };
var peg$f19 = function(attr, val) { return { lineType: 'condition', attr, val} };
var peg$f20 = function(attr, val) { return { lineType: 'condition', attr, val} };
var peg$f21 = function(attr, val) { return { lineType: 'condition', attr, val} };
var peg$f22 = function(attr, val) { return { lineType: 'condition', attr, val} };
var peg$f23 = function(attr, val) { return { lineType: 'condition', attr, val} };
var peg$f24 = function(attr, val) { return { lineType: 'condition', attr, val} };
var peg$f25 = function(attr, val) { return { lineType: 'condition', attr, val} };
var peg$f26 = function(attr, val) { return { lineType: 'condition', attr, val} };
var peg$f27 = function(attr, val) { return { lineType: 'condition', attr, val} };
var peg$f28 = function(attr, val) { return { lineType: 'condition', attr, val} };
var peg$f29 = function(attr, val) { return { lineType: 'condition', attr, val} };
var peg$f30 = function(attr, val) { return { lineType: 'condition', attr, val} };
var peg$f31 = function(attr, val) { return { lineType: 'condition', attr, val} };
var peg$f32 = function(attr, val) { return { lineType: 'condition', attr, val} };
var peg$f33 = function(attr, val) { return { lineType: 'condition', attr, val} };
var peg$f34 = function(attr, val) { return { lineType: 'condition', attr, val} };
var peg$f35 = function(attr, val) { return { lineType: 'condition', attr, val} };
var peg$f36 = function(attr, val) { return { lineType: 'condition', attr, val} };
var peg$f37 = function(attr, val) { return { lineType: 'condition', attr, val} };
var peg$f38 = function(attr, val) { return { lineType: 'condition', attr, val} };
var peg$f39 = function(attr, val) { return { lineType: 'condition', attr, val} };
var peg$f40 = function(attr, val) { return { lineType: 'condition', attr, val} };
var peg$f41 = function(attr, val) { return { lineType: 'condition', attr, val} };
var peg$f42 = function(attr, val) { return { lineType: 'condition', attr, val} };
var peg$f43 = function(attr, val) { return { lineType: 'condition', attr, val} };
var peg$f44 = function(attr, val) { return { lineType: 'condition', attr, val} };
var peg$f45 = function(attr, val) { return { lineType: 'condition', attr, val} };
var peg$f46 = function(attr, val) { return { lineType: 'condition', attr, val} };
var peg$f47 = function(attr, val) { return { lineType: 'condition', attr, val} };
var peg$f48 = function(attr, val) { return { lineType: 'condition', attr, val} };
var peg$f49 = function(attr, val) { return { lineType: 'condition', attr, val} };
var peg$f50 = function(operator, names) { return operator ? { ope: operator[0], vals: names } : { ope: '=', vals: names } };
var peg$f51 = function(val) { return val ? { ope: undefined, val: 'None' } : { ope, vals } };
var peg$f52 = function(pre, names) {
if (pre) {
if (pre.length === 4) {
return { numeric: { ope: pre[0], val: pre[2] }, vals: names }
} else {
return { ope: pre[0], vals: names }
}
} else {
return { ope: '=', vals: names }
}
};
var peg$f53 = function(operator, num) { return { ope: operator, val: num } };
var peg$f54 = function(operator, num, socketTypes) { return operator ? { ope: operator[0], val: `${num == undefined ? '' : num}${socketTypes}` } : { ope: '=', val: `${num == undefined ? '' : num}${socketTypes}` } };
var peg$f55 = function(operator, rarity) { return operator ? { ope: operator[0], val: rarity } : { ope: '=', val: rarity } };
var peg$f56 = function(operator, modTier) { return { ope: operator, val: modTier } };
var peg$f57 = function(attr, val) { return { lineType: 'action', attr, val } };
var peg$f58 = function(attr, val) { return { lineType: 'action', attr, val } };
var peg$f59 = function(attr, val) { return { lineType: 'action', attr, val } };
var peg$f60 = function(attr, val) { return { lineType: 'action', attr, val } };
var peg$f61 = function(attr, val) { return { lineType: 'action', attr, val } };
var peg$f62 = function(attr, val) { return { lineType: 'action', attr, val } };
var peg$f63 = function(attr, val) { return { lineType: 'action', attr, val } };
var peg$f64 = function(attr, val) { return { lineType: 'action', attr, val } };
var peg$f65 = function(attr) { return { lineType: 'action', attr, val: true } };
var peg$f66 = function(attr) { return { lineType: 'action', attr, val: true } };
var peg$f67 = function(attr) { return { lineType: 'action', attr, val: true } };
var peg$f68 = function(attr) { return { lineType: 'action', attr, val: true } };
var peg$f69 = function(attr, val) { return { lineType: 'action', attr, val } };
var peg$f70 = function(attr, val) { return { lineType: 'action', attr, val } };
var peg$f71 = function(name) { return { function: name, val: undefined } };
var peg$f72 = function(name) { return { function: name, val: undefined } };
var peg$f73 = function(name, num) { return 0 <= num && num <= 1000 };
var peg$f74 = function(name, num) { return { function: name, val: num / 100 } };
var peg$f75 = function(name, num) { return 0 <= num && num <= 1000 };
var peg$f76 = function(name, num) { return { function: name, val: num / 100 } };
var peg$f77 = function(name, num) { return 0 <= num && num <= 1000 };
var peg$f78 = function(name, num) { return { function: name, val: num / 100 } };
var peg$f79 = function(name, num) { return 0 <= num && num <= 1000 };
var peg$f80 = function(name, num) { return { function: name, val: num / 100 } };
var peg$f81 = function(name, num) { return 0 <= num && num <= 1000 };
var peg$f82 = function(name, num) { return { function: name, val: num / 100 } };
var peg$f83 = function(name, num) { return 0 <= num && num <= 1000 };
var peg$f84 = function(name, num) { return { function: name, val: num / 100 } };
var peg$f85 = function(name, num) { return 0 <= num && num <= 360 };
var peg$f86 = function(name, num) { return { function: name, val: num } };
var peg$f87 = function(num) { return 0 <= num && num <= 100 };
var peg$f88 = function(num) { return { function: 'Saturationv', val: num } };
var peg$f89 = function(name, num) { return 0 <= num && num <= 100 };
var peg$f90 = function(name, num) { return { function: name, val: num } };
var peg$f91 = function(name, num) { return 0 <= num && num <= 27 };
var peg$f92 = function(name, num) { return { function: name, val: num } };
var peg$f93 = function(name, num) { return 0 <= num && num <= 27 };
var peg$f94 = function(name, num) { return { function: name, val: num } };
var peg$f95 = function(id, volume) { return { id, volume: volume ? parseInt(volume[1], 10) : 50 } };
var peg$f96 = function(filePath, volume) { return { filePath, volume: volume ? parseInt(volume[1], 10) : 100 } };
var peg$f97 = function(size, color, shape) { return { size, color, shape } };
var peg$f98 = function(color, temp) { return temp ? { color, temp: true } : { color, temp: false } };
var peg$f99 = function(name0, names) { return [name0].concat(names.map((n) => n[1])) };
var peg$f100 = function(r, g, b, alpha) { return { rgb: { r, g, b }, alpha: alpha ? alpha[1] : 255 } };
var peg$f101 = function(vals) {
const order = ['R', 'G', 'B', 'W', 'A', 'D']
return vals.sort((left, right) => order.indexOf(left) - order.indexOf(right)).join('')
};
var peg$f102 = function(num) { return 0 <= num && num <= 255 };
var peg$f103 = function(num) { return num };
var peg$f104 = function(val) {
switch (val) {
case '1':
return 'Lesser'
case '2':
return 'Greater'
case '3':
return 'Grand'
case '4':
return 'Exceptional'
case '5':
return 'Exquisite'
case '6':
return 'Perfect'
default:
return val
}
};
var peg$f105 = function(num) { return 1 <= num && num <= 45 };
var peg$f106 = function(num) { return num };
var peg$f107 = function(val) {
switch (val) {
case '0':
return 'Large'
case '1':
return 'Medium'
case '2':
return 'Small'
default:
return val
}
};
var peg$f108 = function(num) { return 0 <= num && num <= 300 };
var peg$f109 = function(num) { return num };
var peg$f110 = function(val) { return val === 'True' };
var peg$f111 = function(string) { return string };
var peg$f112 = function(num) { return parseInt(num, 10) };
var peg$f113 = function() { return undefined };
var peg$f114 = function() { return ' ' };
var peg$f115 = function(i) { return getIndentLevel(i) === indentLevel };
var peg$f116 = function(i) { return indentLevel };
var peg$f117 = function(i) { return getIndentLevel(i) > indentLevel };
var peg$f118 = function(i) { indentLevel += 1; return indentLevel };
var peg$f119 = function() { indentLevel -= 1; return indentLevel };
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, offset) {
var startPosDetails = peg$computePosDetails(startPos);
var endPosDetails = peg$computePosDetails(endPos);
var res = {
source: peg$source,
start: {
offset: startPos,
line: startPosDetails.line,
column: startPosDetails.column
},
end: {
offset: endPos,
line: endPosDetails.line,
column: endPosDetails.column
}
};
if (offset && peg$source && (typeof peg$source.offset === "function")) {
res.start = peg$source.offset(res.start);
res.end = peg$source.offset(res.end);
}
return res;
}
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$parsestart() {
var s0;
s0 = peg$parsescript();
return s0;
}
function peg$parsescript() {
var s0, s1;
s0 = [];
s1 = peg$parsesection();
while (s1 !== peg$FAILED) {
s0.push(s1);
s1 = peg$parsesection();
}
return s0;
}
function peg$parsesection() {
var s0, s1;
s0 = peg$currPos;
s1 = peg$parseblock();
if (s1 === peg$FAILED) {
s1 = peg$parseemptyBlock();
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$f0(s1);
}
s0 = s1;
return s0;
}
function peg$parseblock() {
var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15;
s0 = peg$currPos;
s1 = [];
s2 = peg$parseblankline();
while (s2 !== peg$FAILED) {
s1.push(s2);
s2 = peg$parseblankline();
}
if (input.substr(peg$currPos, 4) === peg$c0) {
s2 = peg$c0;
peg$currPos += 4;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e0); }
}
if (s2 === peg$FAILED) {
if (input.substr(peg$currPos, 4) === peg$c1) {
s2 = peg$c1;
peg$currPos += 4;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e1); }
}
if (s2 === peg$FAILED) {
if (input.substr(peg$currPos, 5) === peg$c2) {
s2 = peg$c2;
peg$currPos += 5;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e2); }
}
if (s2 === peg$FAILED) {
if (input.substr(peg$currPos, 6) === peg$c3) {
s2 = peg$c3;
peg$currPos += 6;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e3); }
}
}
}
}
if (s2 !== peg$FAILED) {
s3 = peg$parse__();
if (s3 !== peg$FAILED) {
s4 = peg$parsestring();
if (s4 !== peg$FAILED) {
s5 = peg$parsebr();
if (s5 !== peg$FAILED) {
s6 = [];
s7 = peg$parseblankline();
while (s7 !== peg$FAILED) {
s6.push(s7);
s7 = peg$parseblankline();
}
s7 = peg$parseINDENT();
if (s7 !== peg$FAILED) {
s8 = peg$parseline();
if (s8 !== peg$FAILED) {
s9 = [];
s10 = peg$parseblankline();
while (s10 !== peg$FAILED) {
s9.push(s10);
s10 = peg$parseblankline();
}
s10 = [];
s11 = peg$currPos;
s12 = peg$parseSAMEDENT();
if (s12 !== peg$FAILED) {
s13 = peg$parseline();
if (s13 !== peg$FAILED) {
s14 = [];
s15 = peg$parseblankline();
while (s15 !== peg$FAILED) {
s14.push(s15);
s15 = peg$parseblankline();
}
s12 = [s12, s13, s14];
s11 = s12;
} else {
peg$currPos = s11;
s11 = peg$FAILED;
}
} else {
peg$currPos = s11;
s11 = peg$FAILED;
}
while (s11 !== peg$FAILED) {
s10.push(s11);
s11 = peg$currPos;
s12 = peg$parseSAMEDENT();
if (s12 !== peg$FAILED) {
s13 = peg$parseline();
if (s13 !== peg$FAILED) {
s14 = [];
s15 = peg$parseblankline();
while (s15 !== peg$FAILED) {
s14.push(s15);
s15 = peg$parseblankline();
}
s12 = [s12, s13, s14];
s11 = s12;
} else {
peg$currPos = s11;
s11 = peg$FAILED;
}
} else {
peg$currPos = s11;
s11 = peg$FAILED;
}
}
s11 = [];
s12 = peg$currPos;
s13 = peg$parseSAMEDENT();
if (s13 !== peg$FAILED) {
s14 = peg$parsebranch();
if (s14 !== peg$FAILED) {
s13 = [s13, s14];
s12 = s13;
} else {
peg$currPos = s12;
s12 = peg$FAILED;
}
} else {
peg$currPos = s12;
s12 = peg$FAILED;
}
while (s12 !== peg$FAILED) {
s11.push(s12);
s12 = peg$currPos;
s13 = peg$parseSAMEDENT();
if (s13 !== peg$FAILED) {
s14 = peg$parsebranch();
if (s14 !== peg$FAILED) {
s13 = [s13, s14];
s12 = s13;
} else {
peg$currPos = s12;
s12 = peg$FAILED;
}
} else {
peg$currPos = s12;
s12 = peg$FAILED;
}
}
s12 = peg$parseOUTDENT();
s13 = [];
s14 = peg$parseblankline();
while (s14 !== peg$FAILED) {
s13.push(s14);
s14 = peg$parseblankline();
}
peg$savedPos = s0;
s0 = peg$f1(s2, s4, s8, s10, s11);
} 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$parseemptyBlock() {
var s0, s1, s2, s3, s4, s5, s6, s7;
s0 = peg$currPos;
s1 = [];
s2 = peg$parseblankline();
while (s2 !== peg$FAILED) {
s1.push(s2);
s2 = peg$parseblankline();
}
if (input.substr(peg$currPos, 4) === peg$c0) {
s2 = peg$c0;
peg$currPos += 4;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e0); }
}
if (s2 === peg$FAILED) {
if (input.substr(peg$currPos, 4) === peg$c1) {
s2 = peg$c1;
peg$currPos += 4;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e1); }
}
}
if (s2 !== peg$FAILED) {
s3 = peg$parse__();
if (s3 !== peg$FAILED) {
s4 = peg$parsestring();
if (s4 !== peg$FAILED) {
s5 = peg$parsebr();
if (s5 !== peg$FAILED) {
s6 = [];
s7 = peg$parseblankline();
while (s7 !== peg$FAILED) {
s6.push(s7);
s7 = peg$parseblankline();
}
peg$savedPos = s0;
s0 = peg$f2(s2, 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$parseline() {
var s0, s1, s2;
s0 = peg$currPos;
s1 = peg$parsecondition();
if (s1 === peg$FAILED) {
s1 = peg$parseaction();
}
if (s1 !== peg$FAILED) {
s2 = peg$parsebr();
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s0 = peg$f3(s1);
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsebranch() {
var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12;
s0 = peg$currPos;
s1 = [];
s2 = peg$parseblankline();
while (s2 !== peg$FAILED) {
s1.push(s2);
s2 = peg$parseblankline();
}
if (input.substr(peg$currPos, 4) === peg$c4) {
s2 = peg$c4;
peg$currPos += 4;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e4); }
}
if (s2 === peg$FAILED) {
if (input.substr(peg$currPos, 5) === peg$c5) {
s2 = peg$c5;
peg$currPos += 5;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e5); }
}
}
if (s2 !== peg$FAILED) {
s3 = peg$parse__();
if (s3 !== peg$FAILED) {
s4 = peg$parsestring();
if (s4 !== peg$FAILED) {
s5 = peg$parsebr();
if (s5 !== peg$FAILED) {
s6 = [];
s7 = peg$parseblankline();
while (s7 !== peg$FAILED) {
s6.push(s7);
s7 = peg$parseblankline();
}
s7 = peg$parseINDENT();
if (s7 !== peg$FAILED) {
s8 = peg$parseblock();
if (s8 !== peg$FAILED) {
s9 = [];
s10 = peg$currPos;
s11 = peg$parseSAMEDENT();
if (s11 !== peg$FAILED) {
s12 = peg$parseblock();
if (s12 !== peg$FAILED) {
s11 = [s11, s12];
s10 = s11;
} else {
peg$currPos = s10;
s10 = peg$FAILED;
}
} else {
peg$currPos = s10;
s10 = peg$FAILED;
}
while (s10 !== peg$FAILED) {
s9.push(s10);
s10 = peg$currPos;
s11 = peg$parseSAMEDENT();
if (s11 !== peg$FAILED) {
s12 = peg$parseblock();
if (s12 !== peg$FAILED) {
s11 = [s11, s12];
s10 = s11;
} else {
peg$currPos = s10;
s10 = peg$FAILED;
}
} else {
peg$currPos = s10;
s10 = peg$FAILED;
}
}
s10 = peg$parseOUTDENT();
peg$savedPos = s0;
s0 = peg$f4(s2, s4, s8, s9);
} 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$parseblankline() {
var s0, s1, s2;
s0 = peg$currPos;
s1 = [];
s2 = peg$parse_();
while (s2 !== peg$FAILED) {
s1.push(s2);
s2 = peg$parse_();
}
s2 = peg$parsebr();
if (s2 !== peg$FAILED) {
s1 = [s1, s2];
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$parsecommentline();
}
return s0;
}
function peg$parsecommentline() {
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) === 35) {
s2 = peg$c6;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e6); }
}
if (s2 !== peg$FAILED) {
s3 = [];
if (peg$r0.test(input.charAt(peg$currPos))) {
s4 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e7); }
}
while (s4 !== peg$FAILED) {
s3.push(s4);
if (peg$r0.test(input.charAt(peg$currPos))) {
s4 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e7); }
}
}
s4 = peg$parsebr();
if (s4 !== peg$FAILED) {
s1 = [s1, s2, s3, s4];
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsecondition() {
var s0;
s0 = peg$parseconditionClass();
if (s0 === peg$FAILED) {
s0 = peg$parseconditionBaseType();
if (s0 === peg$FAILED) {
s0 = peg$parseconditionDropLevel();
if (s0 === peg$FAILED) {
s0 = peg$parseconditionItemLevel();
if (s0 === peg$FAILED) {
s0 = peg$parseconditionAreaLevel();
if (s0 === peg$FAILED) {
s0 = peg$parseconditionGemLevel();
if (s0 === peg$FAILED) {
s0 = peg$parseconditionTransfiguredGem();
if (s0 === peg$FAILED) {
s0 = peg$parseconditionStackSize();
if (s0 === peg$FAILED) {
s0 = peg$parseconditionMapTier();
if (s0 === peg$FAILED) {
s0 = peg$parseconditionWaystoneTier();
if (s0 === peg$FAILED) {
s0 = peg$parseconditionQuality();
if (s0 === peg$FAILED) {
s0 = peg$parseconditionLinkedSockets();
if (s0 === peg$FAILED) {
s0 = peg$parseconditionSockets();
if (s0 === peg$FAILED) {
s0 = peg$parseconditionSocketGroup();
if (s0 === peg$FAILED) {
s0 = peg$parseconditionRarity();
if (s0 === peg$FAILED) {
s0 = peg$parseconditionBaseDefencePercentile();
if (s0 === peg$FAILED) {
s0 = peg$parseconditionBaseArmour();
if (s0 === peg$FAILED) {
s0 = peg$parseconditionBaseEnergyShield();
if (s0 === peg$FAILED) {
s0 = peg$parseconditionBaseEvasion();
if (s0 === peg$FAILED) {
s0 = peg$parseconditionBaseWard();
if (s0 === peg$FAILED) {
s0 = peg$parseconditionFracturedItem();
if (s0 === peg$FAILED) {
s0 = peg$parseconditionSynthesisedItem();
if (s0 === peg$FAILED) {
s0 = peg$parseconditionCorrupted();