lidl
Version:
The LIDL Interaction Desccription Language
1,480 lines (1,401 loc) • 82.5 kB
JavaScript
module.exports = (function() {
"use strict";
/*
* Generated by PEG.js 0.9.0.
*
* http://pegjs.org/
*/
function peg$subclass(child, parent) {
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
child.prototype = new ctor();
}
function peg$SyntaxError(message, expected, found, location) {
this.message = message;
this.expected = expected;
this.found = found;
this.location = location;
this.name = "SyntaxError";
if (typeof Error.captureStackTrace === "function") {
Error.captureStackTrace(this, peg$SyntaxError);
}
}
peg$subclass(peg$SyntaxError, Error);
function peg$parse(input) {
var options = arguments.length > 1 ? arguments[1] : {},
parser = this,
peg$FAILED = {},
peg$startRuleFunctions = { start: peg$parsestart, interaction: peg$parseinteraction, interfac: peg$parseinterfac, data: peg$parsedata, interactionDefinition: peg$parseinteractionDefinition },
peg$startRuleFunction = peg$parsestart,
peg$c0 = function(definitions) {return definitions;},
peg$c1 = { type: "other", description: "a list of definitions" },
peg$c2 = function(content) {return flatten(content);},
peg$c3 = { type: "other", description: "a definition or an import statement" },
peg$c4 = function(definition) {return [definition];},
peg$c5 = "import",
peg$c6 = { type: "literal", value: "import", description: "\"import\"" },
peg$c7 = /^[^`]/,
peg$c8 = { type: "class", value: "[^`]", description: "[^`]" },
peg$c9 = function(filename) {return parse(fs.readFileSync(filename.join(''),{encoding:'utf8'}));},
peg$c10 = { type: "other", description: "an interaction definition" },
peg$c11 = "interaction",
peg$c12 = { type: "literal", value: "interaction", description: "\"interaction\"" },
peg$c13 = "with",
peg$c14 = { type: "literal", value: "with", description: "\"with\"" },
peg$c15 = function(signature, definitions) {return definitions;},
peg$c16 = "is",
peg$c17 = { type: "literal", value: "is", description: "\"is\"" },
peg$c18 = function(signature, definitions, interaction) {
var res = {
type:'Definition',
interaction:interaction,
signature:signature,
definitions:(definitions===null?[]:definitions)
};
var arrayLength = res.definitions.length;
for (var i = 0; i < arrayLength; i++) {
res.definitions[i].parent = res;
}
return res;
},
peg$c19 = { type: "other", description: "an interaction interactionSignature specification" },
peg$c20 = "(",
peg$c21 = { type: "literal", value: "(", description: "\"(\"" },
peg$c22 = ")",
peg$c23 = { type: "literal", value: ")", description: "\")\"" },
peg$c24 = ":",
peg$c25 = { type: "literal", value: ":", description: "\":\"" },
peg$c26 = function(elements, interfac) { var temp = mergeSignature(elements);return {type:'Signature',interfac:interfac,operator:temp.operator,operand:temp.operand};},
peg$c27 = { type: "other", description: "a interactionSignature element" },
peg$c28 = function(operator) {return {operator:operator};},
peg$c29 = function(name, interfac) {return {operand:{interfac:interfac,name:name}};},
peg$c30 = { type: "other", description: "an interaction" },
peg$c31 = function(elements) {var temp= mergeExpression(elements);return {type:'InteractionSimple',operator:temp.operator,operand:temp.operand};},
peg$c32 = { type: "other", description: "an interaction element" },
peg$c33 = function(operand) {return {operand:operand};},
peg$c34 = { type: "other", description: "the specification of an interfac" },
peg$c35 = { type: "other", description: "the specification of an interfac using operators" },
peg$c36 = ",",
peg$c37 = { type: "literal", value: ",", description: "\",\"" },
peg$c38 = function(operator, first, content) {return content;},
peg$c39 = function(operator, first, rest) { return {type:"InterfaceOperation",operator:operator,operand:mergeElements(first,rest)}},
peg$c40 = { type: "other", description: "an interfac operator (conjugation,globalisation,localisation,reception,emission,union,intersection,complement)" },
peg$c41 = "conjugation",
peg$c42 = { type: "literal", value: "conjugation", description: "\"conjugation\"" },
peg$c43 = "globalisation",
peg$c44 = { type: "literal", value: "globalisation", description: "\"globalisation\"" },
peg$c45 = "localisation",
peg$c46 = { type: "literal", value: "localisation", description: "\"localisation\"" },
peg$c47 = "reception",
peg$c48 = { type: "literal", value: "reception", description: "\"reception\"" },
peg$c49 = "emission",
peg$c50 = { type: "literal", value: "emission", description: "\"emission\"" },
peg$c51 = "union",
peg$c52 = { type: "literal", value: "union", description: "\"union\"" },
peg$c53 = "intersection",
peg$c54 = { type: "literal", value: "intersection", description: "\"intersection\"" },
peg$c55 = "complement",
peg$c56 = { type: "literal", value: "complement", description: "\"complement\"" },
peg$c57 = { type: "other", description: "the specification of an atomic interfac" },
peg$c58 = function(data, direction) {return {type:'InterfaceAtomic',data:data,direction:direction};},
peg$c59 = { type: "other", description: "the specification of a composite interfac" },
peg$c60 = "{",
peg$c61 = { type: "literal", value: "{", description: "\"{\"" },
peg$c62 = function(key, value) {return {type:'InterfaceCompositeElement',key:key,value:value}},
peg$c63 = function(first, key, value) {return {type:'InterfaceCompositeElement',key:key,value:value}},
peg$c64 = function(first, content) {return content;},
peg$c65 = "}",
peg$c66 = { type: "literal", value: "}", description: "\"}\"" },
peg$c67 = function(first, rest) {return {type:'InterfaceComposite',element:mergeElements(first,rest)};},
peg$c68 = { type: "other", description: "the direction of a data flow" },
peg$c69 = "out",
peg$c70 = { type: "literal", value: "out", description: "\"out\"" },
peg$c71 = "in",
peg$c72 = { type: "literal", value: "in", description: "\"in\"" },
peg$c73 = "ref",
peg$c74 = { type: "literal", value: "ref", description: "\"ref\"" },
peg$c75 = { type: "other", description: "the specification of a data type" },
peg$c76 = { type: "other", description: "the specification of an data type using operators" },
peg$c77 = function(operator, first, rest) { return {type:"DataOperation",operator:operator,operand:mergeElements(first,rest)}},
peg$c78 = { type: "other", description: "an data type operator (union,intersection,complement)" },
peg$c79 = { type: "other", description: "the specification of an atomic data type" },
peg$c80 = function(name) {return {type:'DataAtomic',name:name}},
peg$c81 = { type: "other", description: "the specification of a composite data type" },
peg$c82 = function(key, value) {return {type:'DataCompositeElement',key:key,value:value}},
peg$c83 = function(first, key, value) {return {type:'DataCompositeElement',key:key,value:value}},
peg$c84 = function(first, rest) {return {type:'DataComposite',element:mergeElements(first,rest)};},
peg$c85 = { type: "other", description: "the specification of an array type" },
peg$c86 = "[",
peg$c87 = { type: "literal", value: "[", description: "\"[\"" },
peg$c88 = "]",
peg$c89 = { type: "literal", value: "]", description: "\"]\"" },
peg$c90 = function(element) {return {type:'DataArray',element:element};},
peg$c91 = { type: "other", description: "the specification of a function type" },
peg$c92 = "\u2192",
peg$c93 = { type: "literal", value: "\u2192", description: "\"\\u2192\"" },
peg$c94 = "->",
peg$c95 = { type: "literal", value: "->", description: "\"->\"" },
peg$c96 = function(domain, codomain) {return {type:'DataFunction',domain:domain,codomain:codomain};},
peg$c97 = { type: "other", description: "an operator identifier" },
peg$c98 = /^[^ \t\r\n$()]/,
peg$c99 = { type: "class", value: "[^ \\t\\r\\n$\\(\\)]", description: "[^ \\t\\r\\n$\\(\\)]" },
peg$c100 = function(val) { return val.join(''); },
peg$c101 = { type: "other", description: "an interfac identifier" },
peg$c102 = /^[A-Z]/,
peg$c103 = { type: "class", value: "[A-Z]", description: "[A-Z]" },
peg$c104 = /^[a-zA-Z0-9]/,
peg$c105 = { type: "class", value: "[a-zA-Z0-9]", description: "[a-zA-Z0-9]" },
peg$c106 = function(first, rest) { return mergeElements(first,rest).join(''); },
peg$c107 = { type: "other", description: "a data identifier" },
peg$c108 = { type: "other", description: "a variable identifier" },
peg$c109 = /^[a-z]/,
peg$c110 = { type: "class", value: "[a-z]", description: "[a-z]" },
peg$c111 = { type: "other", description: "a key identifier" },
peg$c112 = /^[a-z0-9]/,
peg$c113 = { type: "class", value: "[a-z0-9]", description: "[a-z0-9]" },
peg$c114 = { type: "other", description: "a C-compatible function identifier" },
peg$c115 = /^[a-zA-Z_]/,
peg$c116 = { type: "class", value: "[a-zA-Z_]", description: "[a-zA-Z_]" },
peg$c117 = /^[a-zA-Z0-9_]/,
peg$c118 = { type: "class", value: "[a-zA-Z0-9_]", description: "[a-zA-Z0-9_]" },
peg$c119 = { type: "other", description: "white space" },
peg$c120 = /^[ \t\r\n]/,
peg$c121 = { type: "class", value: "[ \\t\\r\\n]", description: "[ \\t\\r\\n]" },
peg$currPos = 0,
peg$savedPos = 0,
peg$posDetailsCache = [{ line: 1, column: 1, seenCR: false }],
peg$maxFailPos = 0,
peg$maxFailExpected = [],
peg$silentFails = 0,
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 location() {
return peg$computeLocation(peg$savedPos, peg$currPos);
}
function expected(description) {
throw peg$buildException(
null,
[{ type: "other", description: description }],
input.substring(peg$savedPos, peg$currPos),
peg$computeLocation(peg$savedPos, peg$currPos)
);
}
function error(message) {
throw peg$buildException(
message,
null,
input.substring(peg$savedPos, peg$currPos),
peg$computeLocation(peg$savedPos, peg$currPos)
);
}
function peg$computePosDetails(pos) {
var details = peg$posDetailsCache[pos],
p, ch;
if (details) {
return details;
} else {
p = pos - 1;
while (!peg$posDetailsCache[p]) {
p--;
}
details = peg$posDetailsCache[p];
details = {
line: details.line,
column: details.column,
seenCR: details.seenCR
};
while (p < pos) {
ch = input.charAt(p);
if (ch === "\n") {
if (!details.seenCR) { details.line++; }
details.column = 1;
details.seenCR = false;
} else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") {
details.line++;
details.column = 1;
details.seenCR = true;
} else {
details.column++;
details.seenCR = false;
}
p++;
}
peg$posDetailsCache[pos] = details;
return details;
}
}
function peg$computeLocation(startPos, endPos) {
var startPosDetails = peg$computePosDetails(startPos),
endPosDetails = peg$computePosDetails(endPos);
return {
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$buildException(message, expected, found, location) {
function cleanupExpected(expected) {
var i = 1;
expected.sort(function(a, b) {
if (a.description < b.description) {
return -1;
} else if (a.description > b.description) {
return 1;
} else {
return 0;
}
});
while (i < expected.length) {
if (expected[i - 1] === expected[i]) {
expected.splice(i, 1);
} else {
i++;
}
}
}
function buildMessage(expected, found) {
function stringEscape(s) {
function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); }
return s
.replace(/\\/g, '\\\\')
.replace(/"/g, '\\"')
.replace(/\x08/g, '\\b')
.replace(/\t/g, '\\t')
.replace(/\n/g, '\\n')
.replace(/\f/g, '\\f')
.replace(/\r/g, '\\r')
.replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
.replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); })
.replace(/[\u0100-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); })
.replace(/[\u1000-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); });
}
var expectedDescs = new Array(expected.length),
expectedDesc, foundDesc, i;
for (i = 0; i < expected.length; i++) {
expectedDescs[i] = expected[i].description;
}
expectedDesc = expected.length > 1
? expectedDescs.slice(0, -1).join(", ")
+ " or "
+ expectedDescs[expected.length - 1]
: expectedDescs[0];
foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input";
return "Expected " + expectedDesc + " but " + foundDesc + " found.";
}
if (expected !== null) {
cleanupExpected(expected);
}
return new peg$SyntaxError(
message !== null ? message : buildMessage(expected, found),
expected,
found,
location
);
}
function peg$parsestart() {
var s0, s1, s2, s3;
s0 = peg$currPos;
s1 = peg$parse_();
if (s1 !== peg$FAILED) {
s2 = peg$parsedefinitions();
if (s2 !== peg$FAILED) {
s3 = peg$parse_();
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c0(s2);
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$parsedefinitions() {
var s0, s1, s2, s3;
peg$silentFails++;
s0 = peg$currPos;
s1 = peg$parse_();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$parsecontent();
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$parsecontent();
}
if (s2 !== peg$FAILED) {
s3 = peg$parse_();
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c2(s2);
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$c1); }
}
return s0;
}
function peg$parsecontent() {
var s0, s1, s2, s3, s4, s5;
peg$silentFails++;
s0 = peg$currPos;
s1 = peg$parse_();
if (s1 !== peg$FAILED) {
s2 = peg$parseinteractionDefinition();
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c4(s2);
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) {
if (input.substr(peg$currPos, 6) === peg$c5) {
s2 = peg$c5;
peg$currPos += 6;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c6); }
}
if (s2 !== peg$FAILED) {
s3 = peg$parse_();
if (s3 !== peg$FAILED) {
s4 = [];
if (peg$c7.test(input.charAt(peg$currPos))) {
s5 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c8); }
}
while (s5 !== peg$FAILED) {
s4.push(s5);
if (peg$c7.test(input.charAt(peg$currPos))) {
s5 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c8); }
}
}
if (s4 !== peg$FAILED) {
s5 = peg$parse_();
if (s5 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c9(s4);
s0 = s1;
} 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$c3); }
}
return s0;
}
function peg$parseinteractionDefinition() {
var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11;
peg$silentFails++;
s0 = peg$currPos;
s1 = peg$parse_();
if (s1 !== peg$FAILED) {
if (input.substr(peg$currPos, 11) === peg$c11) {
s2 = peg$c11;
peg$currPos += 11;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c12); }
}
if (s2 !== peg$FAILED) {
s3 = peg$parse_();
if (s3 !== peg$FAILED) {
s4 = peg$parseinteractionSignature();
if (s4 !== peg$FAILED) {
s5 = peg$parse_();
if (s5 !== peg$FAILED) {
s6 = peg$currPos;
s7 = peg$parse_();
if (s7 !== peg$FAILED) {
if (input.substr(peg$currPos, 4) === peg$c13) {
s8 = peg$c13;
peg$currPos += 4;
} else {
s8 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c14); }
}
if (s8 !== peg$FAILED) {
s9 = peg$parse_();
if (s9 !== peg$FAILED) {
s10 = peg$parsedefinitions();
if (s10 !== peg$FAILED) {
peg$savedPos = s6;
s7 = peg$c15(s4, s10);
s6 = s7;
} else {
peg$currPos = s6;
s6 = peg$FAILED;
}
} else {
peg$currPos = s6;
s6 = peg$FAILED;
}
} else {
peg$currPos = s6;
s6 = peg$FAILED;
}
} else {
peg$currPos = s6;
s6 = peg$FAILED;
}
if (s6 === peg$FAILED) {
s6 = null;
}
if (s6 !== peg$FAILED) {
s7 = peg$parse_();
if (s7 !== peg$FAILED) {
if (input.substr(peg$currPos, 2) === peg$c16) {
s8 = peg$c16;
peg$currPos += 2;
} else {
s8 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c17); }
}
if (s8 !== peg$FAILED) {
s9 = peg$parse_();
if (s9 !== peg$FAILED) {
s10 = peg$parseinteraction();
if (s10 !== peg$FAILED) {
s11 = peg$parse_();
if (s11 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c18(s4, s6, s10);
s0 = s1;
} 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;
}
} 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$c10); }
}
return s0;
}
function peg$parseinteractionSignature() {
var s0, s1, s2, s3, s4, s5, s6, s7, s8;
peg$silentFails++;
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 40) {
s1 = peg$c20;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c21); }
}
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$parseinteractionSignatureElement();
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$parseinteractionSignatureElement();
}
if (s2 !== peg$FAILED) {
s3 = peg$parse_();
if (s3 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 41) {
s4 = peg$c22;
peg$currPos++;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c23); }
}
if (s4 !== peg$FAILED) {
s5 = peg$parse_();
if (s5 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 58) {
s6 = peg$c24;
peg$currPos++;
} else {
s6 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c25); }
}
if (s6 !== peg$FAILED) {
s7 = peg$parse_();
if (s7 !== peg$FAILED) {
s8 = peg$parseinterfac();
if (s8 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c26(s2, s8);
s0 = s1;
} 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;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
peg$silentFails--;
if (s0 === peg$FAILED) {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c19); }
}
return s0;
}
function peg$parseinteractionSignatureElement() {
var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10;
peg$silentFails++;
s0 = peg$currPos;
s1 = peg$parse_();
if (s1 !== peg$FAILED) {
s2 = peg$parseoperatorIdentifier();
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c28(s2);
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) {
if (input.charCodeAt(peg$currPos) === 40) {
s2 = peg$c20;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c21); }
}
if (s2 !== peg$FAILED) {
s3 = peg$parse_();
if (s3 !== peg$FAILED) {
s4 = peg$parsevariableIdentifier();
if (s4 !== peg$FAILED) {
s5 = peg$parse_();
if (s5 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 58) {
s6 = peg$c24;
peg$currPos++;
} else {
s6 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c25); }
}
if (s6 !== peg$FAILED) {
s7 = peg$parse_();
if (s7 !== peg$FAILED) {
s8 = peg$parseinterfac();
if (s8 !== peg$FAILED) {
s9 = peg$parse_();
if (s9 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 41) {
s10 = peg$c22;
peg$currPos++;
} else {
s10 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c23); }
}
if (s10 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c29(s4, s8);
s0 = s1;
} 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;
}
} 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$c27); }
}
return s0;
}
function peg$parseinteraction() {
var s0, s1, s2, s3, s4;
peg$silentFails++;
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 40) {
s1 = peg$c20;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c21); }
}
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$parseinteractionElement();
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$parseinteractionElement();
}
if (s2 !== peg$FAILED) {
s3 = peg$parse_();
if (s3 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 41) {
s4 = peg$c22;
peg$currPos++;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c23); }
}
if (s4 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c31(s2);
s0 = s1;
} 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$c30); }
}
return s0;
}
function peg$parseinteractionElement() {
var s0, s1, s2;
peg$silentFails++;
s0 = peg$currPos;
s1 = peg$parse_();
if (s1 !== peg$FAILED) {
s2 = peg$parseinteraction();
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c33(s2);
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) {
s2 = peg$parseoperatorIdentifier();
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c28(s2);
s0 = 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$c32); }
}
return s0;
}
function peg$parseinterfac() {
var s0, s1;
peg$silentFails++;
s0 = peg$parseinterfaceAtomic();
if (s0 === peg$FAILED) {
s0 = peg$parseinterfaceComposite();
if (s0 === peg$FAILED) {
s0 = peg$parseinterfaceOperation();
}
}
peg$silentFails--;
if (s0 === peg$FAILED) {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c34); }
}
return s0;
}
function peg$parseinterfaceOperation() {
var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11;
peg$silentFails++;
s0 = peg$currPos;
s1 = peg$parseinterfaceOperator();
if (s1 !== peg$FAILED) {
s2 = peg$parse_();
if (s2 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 40) {
s3 = peg$c20;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c21); }
}
if (s3 !== peg$FAILED) {
s4 = peg$parse_();
if (s4 !== peg$FAILED) {
s5 = peg$parseinterfac();
if (s5 !== peg$FAILED) {
s6 = [];
s7 = peg$currPos;
s8 = peg$parse_();
if (s8 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 44) {
s9 = peg$c36;
peg$currPos++;
} else {
s9 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c37); }
}
if (s9 !== peg$FAILED) {
s10 = peg$parse_();
if (s10 !== peg$FAILED) {
s11 = peg$parseinterfac();
if (s11 !== peg$FAILED) {
peg$savedPos = s7;
s8 = peg$c38(s1, s5, s11);
s7 = s8;
} else {
peg$currPos = s7;
s7 = peg$FAILED;
}
} else {
peg$currPos = s7;
s7 = peg$FAILED;
}
} else {
peg$currPos = s7;
s7 = peg$FAILED;
}
} else {
peg$currPos = s7;
s7 = peg$FAILED;
}
while (s7 !== peg$FAILED) {
s6.push(s7);
s7 = peg$currPos;
s8 = peg$parse_();
if (s8 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 44) {
s9 = peg$c36;
peg$currPos++;
} else {
s9 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c37); }
}
if (s9 !== peg$FAILED) {
s10 = peg$parse_();
if (s10 !== peg$FAILED) {
s11 = peg$parseinterfac();
if (s11 !== peg$FAILED) {
peg$savedPos = s7;
s8 = peg$c38(s1, s5, s11);
s7 = s8;
} else {
peg$currPos = s7;
s7 = peg$FAILED;
}
} else {
peg$currPos = s7;
s7 = peg$FAILED;
}
} else {
peg$currPos = s7;
s7 = peg$FAILED;
}
} else {
peg$currPos = s7;
s7 = peg$FAILED;
}
}
if (s6 !== peg$FAILED) {
s7 = peg$parse_();
if (s7 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 41) {
s8 = peg$c22;
peg$currPos++;
} else {
s8 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c23); }
}
if (s8 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c39(s1, s5, s6);
s0 = s1;
} 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;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
peg$silentFails--;
if (s0 === peg$FAILED) {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c35); }
}
return s0;
}
function peg$parseinterfaceOperator() {
var s0, s1;
peg$silentFails++;
if (input.substr(peg$currPos, 11) === peg$c41) {
s0 = peg$c41;
peg$currPos += 11;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c42); }
}
if (s0 === peg$FAILED) {
if (input.substr(peg$currPos, 13) === peg$c43) {
s0 = peg$c43;
peg$currPos += 13;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c44); }
}
if (s0 === peg$FAILED) {
if (input.substr(peg$currPos, 12) === peg$c45) {
s0 = peg$c45;
peg$currPos += 12;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c46); }
}
if (s0 === peg$FAILED) {
if (input.substr(peg$currPos, 9) === peg$c47) {
s0 = peg$c47;
peg$currPos += 9;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c48); }
}
if (s0 === peg$FAILED) {
if (input.substr(peg$currPos, 8) === peg$c49) {
s0 = peg$c49;
peg$currPos += 8;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c50); }
}
if (s0 === peg$FAILED) {
if (input.substr(peg$currPos, 5) === peg$c51) {
s0 = peg$c51;
peg$currPos += 5;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c52); }
}
if (s0 === peg$FAILED) {
if (input.substr(peg$currPos, 12) === peg$c53) {
s0 = peg$c53;
peg$currPos += 12;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c54); }
}
if (s0 === peg$FAILED) {
if (input.substr(peg$currPos, 10) === peg$c55) {
s0 = peg$c55;
peg$currPos += 10;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c56); }
}
}
}
}
}
}
}
}
peg$silentFails--;
if (s0 === peg$FAILED) {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c40); }
}
return s0;
}
function peg$parseinterfaceAtomic() {
var s0, s1, s2, s3;
peg$silentFails++;
s0 = peg$currPos;
s1 = peg$parsedata();
if (s1 !== peg$FAILED) {
s2 = peg$parse_();
if (s2 !== peg$FAILED) {
s3 = peg$parsedirection();
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c58(s1, 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$c57); }
}
return s0;
}
function peg$parseinterfaceComposite() {
var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14;
peg$silentFails++;
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 123) {
s1 = peg$c60;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c61); }
}
if (s1 !== peg$FAILED) {
s2 = peg$parse_();
if (s2 !== peg$FAILED) {
s3 = peg$currPos;
s4 = peg$parsekeyIdentifier();
if (s4 !== peg$FAILED) {
s5 = peg$parse_();
if (s5 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 58) {
s6 = peg$c24;
peg$currPos++;
} else {
s6 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c25); }
}
if (s6 !== peg$FAILED) {
s7 = peg$parse_();
if (s7 !== peg$FAILED) {
s8 = peg$parseinterfac();
if (s8 !== peg$FAILED) {
peg$savedPos = s3;
s4 = peg$c62(s4, s8);
s3 = s4;
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
if (s3 !== peg$FAILED) {
s4 = peg$parse_();
if (s4 !== peg$FAILED) {
s5 = [];
s6 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 44) {
s7 = peg$c36;
peg$currPos++;
} else {
s7 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c37); }
}
if (s7 !== peg$FAILED) {
s8 = peg$parse_();
if (s8 !== peg$FAILED) {
s9 = peg$currPos;
s10 = peg$parsekeyIdentifier();
if (s10 !== peg$FAILED) {
s11 = peg$parse_();
if (s11 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 58) {
s12 = peg$c24;
peg$currPos++;
} else {
s12 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c25); }
}
if (s12 !== peg$FAILED) {
s13 = peg$parse_();
if (s13 !== peg$FAILED) {
s14 = peg$parseinterfac();
if (s14 !== peg$FAILED) {
peg$savedPos = s9;
s10 = peg$c63(s3, s10, s14);
s9 = s10;
} else {
peg$currPos = s9;
s9 = peg$FAILED;
}
} else {
peg$currPos = s9;
s9 = peg$FAILED;
}
} else {
peg$currPos = s9;
s9 = peg$FAILED;
}
} else {
peg$currPos = s9;
s9 = peg$FAILED;
}
} else {
peg$currPos = s9;
s9 = peg$FAILED;
}
if (s9 !== peg$FAILED) {
s10 = peg$parse_();
if (s10 !== peg$FAILED) {
peg$savedPos = s6;
s7 = peg$c64(s3, s9);
s6 = s7;
} else {
peg$currPos = s6;
s6 = peg$FAILED;
}
} else {
peg$currPos = s6;
s6 = peg$FAILED;
}
} else {
peg$currPos = s6;
s6 = peg$FAILED;
}
} else {
peg$currPos = s6;
s6 = peg$FAILED;
}
while (s6 !== peg$FAILED) {
s5.push(s6);
s6 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 44) {
s7 = peg$c36;
peg$currPos++;
} else {
s7 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c37); }
}
if (s7 !== peg$FAILED) {
s8 = peg$parse_();
if (s8 !== peg$FAILED) {
s9 = peg$currPos;
s10 = peg$parsekeyIdentifier();
if (s10 !== peg$FAILED) {
s11 = peg$parse_();
if (s11 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 58) {
s12 = peg$c24;
peg$currPos++;
} else {
s12 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c25); }
}
if (s12 !== peg$FAILED) {
s13 = peg$parse_();
if (s13 !== peg$FAILED) {
s14 = peg$parseinterfac();
if (s14 !== peg$FAILED) {
peg$savedPos = s9;
s10 = peg$c63(s3, s10, s14);
s9 = s10;
} else {
peg$currPos = s9;
s9 = peg$FAILED;
}
} else {
peg$currPos = s9;
s9 = peg$FAILED;
}
} else {
peg$currPos = s9;
s9 = peg$FAILED;
}
} else {
peg$currPos = s9;
s9 = peg$FAILED;
}
} else {
peg$currPos = s9;
s9 = peg$FAILED;
}
if (s9 !== peg$FAILED) {
s10 = peg$parse_();
if (s10 !== peg$FAILED) {
peg$savedPos = s6;
s7 = peg$c64(s3, s9);
s6 = s7;
} else {
peg$currPos = s6;
s6 = peg$FAILED;
}
} else {
peg$currPos = s6;
s6 = peg$FAILED;
}
} else {
peg$currPos = s6;
s6 = peg$FAILED;
}
} else {
peg$currPos = s6;
s6 = peg$FAILED;
}
}
if (s5 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 125) {
s6 = peg$c65;
peg$currPos++;
} else {
s6 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c66); }
}
if (s6 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c67(s3, s5);
s0 = s1;
} 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 {