Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fbp

Package Overview
Dependencies
Maintainers
2
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fbp - npm Package Compare versions

Comparing version 1.1.2 to 1.1.3

appveyor.yml

2

component.json
{
"name": "fbp",
"description": "Parser for the .fbp flow definition language",
"version": "1.0.0",
"version": "1.1.3",
"scripts": [

@@ -6,0 +6,0 @@ "lib/fbp.js"

@@ -1,665 +0,766 @@

module.exports = (function(){
module.exports = (function() {
/*
* Generated by PEG.js 0.7.0.
* Generated by PEG.js 0.8.0.
*
* http://pegjs.majda.cz/
*/
function quote(s) {
/*
* ECMA-262, 5th ed., 7.8.4: All characters may appear literally in a
* string literal except for the closing quote character, backslash,
* carriage return, line separator, paragraph separator, and line feed.
* Any character may appear in the form of an escape sequence.
*
* For portability, we also escape escape all control and non-ASCII
* characters. Note that "\0" and "\v" escape sequences are not used
* because JSHint does not like the first and IE the second.
*/
return '"' + s
.replace(/\\/g, '\\\\') // backslash
.replace(/"/g, '\\"') // closing quote character
.replace(/\x08/g, '\\b') // backspace
.replace(/\t/g, '\\t') // horizontal tab
.replace(/\n/g, '\\n') // line feed
.replace(/\f/g, '\\f') // form feed
.replace(/\r/g, '\\r') // carriage return
.replace(/[\x00-\x07\x0B\x0E-\x1F\x80-\uFFFF]/g, escape)
+ '"';
function peg$subclass(child, parent) {
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
child.prototype = new ctor();
}
var result = {
/*
* Parses the input with a generated parser. If the parsing is successfull,
* returns a value explicitly or implicitly specified by the grammar from
* which the parser was generated (see |PEG.buildParser|). If the parsing is
* unsuccessful, throws |PEG.parser.SyntaxError| describing the error.
*/
parse: function(input, startRule) {
var parseFunctions = {
"start": parse_start,
"line": parse_line,
"LineTerminator": parse_LineTerminator,
"comment": parse_comment,
"connection": parse_connection,
"bridge": parse_bridge,
"leftlet": parse_leftlet,
"iip": parse_iip,
"rightlet": parse_rightlet,
"node": parse_node,
"component": parse_component,
"compMeta": parse_compMeta,
"port": parse_port,
"portWithIndex": parse_portWithIndex,
"anychar": parse_anychar,
"iipchar": parse_iipchar,
"_": parse__,
"__": parse___
};
if (startRule !== undefined) {
if (parseFunctions[startRule] === undefined) {
throw new Error("Invalid rule name: " + quote(startRule) + ".");
function SyntaxError(message, expected, found, offset, line, column) {
this.message = message;
this.expected = expected;
this.found = found;
this.offset = offset;
this.line = line;
this.column = column;
this.name = "SyntaxError";
}
peg$subclass(SyntaxError, Error);
function parse(input) {
var options = arguments.length > 1 ? arguments[1] : {},
peg$FAILED = {},
peg$startRuleFunctions = { start: peg$parsestart },
peg$startRuleFunction = peg$parsestart,
peg$c0 = [],
peg$c1 = function() { return parser.getResult(); },
peg$c2 = peg$FAILED,
peg$c3 = "EXPORT=",
peg$c4 = { type: "literal", value: "EXPORT=", description: "\"EXPORT=\"" },
peg$c5 = /^[A-Za-z.0-9_]/,
peg$c6 = { type: "class", value: "[A-Za-z.0-9_]", description: "[A-Za-z.0-9_]" },
peg$c7 = ":",
peg$c8 = { type: "literal", value: ":", description: "\":\"" },
peg$c9 = /^[A-Z0-9_]/,
peg$c10 = { type: "class", value: "[A-Z0-9_]", description: "[A-Z0-9_]" },
peg$c11 = null,
peg$c12 = function(priv, pub) {return parser.registerExports(priv.join(""),pub.join(""))},
peg$c13 = "INPORT=",
peg$c14 = { type: "literal", value: "INPORT=", description: "\"INPORT=\"" },
peg$c15 = /^[A-Za-z0-9_]/,
peg$c16 = { type: "class", value: "[A-Za-z0-9_]", description: "[A-Za-z0-9_]" },
peg$c17 = ".",
peg$c18 = { type: "literal", value: ".", description: "\".\"" },
peg$c19 = function(node, port, pub) {return parser.registerInports(node.join(""),port.join(""),pub.join(""))},
peg$c20 = "OUTPORT=",
peg$c21 = { type: "literal", value: "OUTPORT=", description: "\"OUTPORT=\"" },
peg$c22 = function(node, port, pub) {return parser.registerOutports(node.join(""),port.join(""),pub.join(""))},
peg$c23 = /^[\n\r\u2028\u2029]/,
peg$c24 = { type: "class", value: "[\\n\\r\\u2028\\u2029]", description: "[\\n\\r\\u2028\\u2029]" },
peg$c25 = function(edges) {return parser.registerEdges(edges);},
peg$c26 = ",",
peg$c27 = { type: "literal", value: ",", description: "\",\"" },
peg$c28 = "#",
peg$c29 = { type: "literal", value: "#", description: "\"#\"" },
peg$c30 = "->",
peg$c31 = { type: "literal", value: "->", description: "\"->\"" },
peg$c32 = function(x, y) { return [x,y]; },
peg$c33 = function(x, proc, y) { return [{"tgt":{process:proc, port:x}},{"src":{process:proc, port:y}}]; },
peg$c34 = function(proc, port) { return {"src":{process:proc, port:port}} },
peg$c35 = function(proc, port) { return {"src":{process:proc, port:port.port, index: port.index}} },
peg$c36 = "'",
peg$c37 = { type: "literal", value: "'", description: "\"'\"" },
peg$c38 = function(iip) { return {"data":iip.join("")} },
peg$c39 = function(port, proc) { return {"tgt":{process:proc, port:port}} },
peg$c40 = function(port, proc) { return {"tgt":{process:proc, port:port.port, index: port.index}} },
peg$c41 = /^[a-zA-Z0-9_]/,
peg$c42 = { type: "class", value: "[a-zA-Z0-9_]", description: "[a-zA-Z0-9_]" },
peg$c43 = function(node, comp) { if(comp){parser.addNode(node.join(""),comp);}; return node.join("")},
peg$c44 = "(",
peg$c45 = { type: "literal", value: "(", description: "\"(\"" },
peg$c46 = /^[a-zA-Z\/\-0-9_]/,
peg$c47 = { type: "class", value: "[a-zA-Z\\/\\-0-9_]", description: "[a-zA-Z\\/\\-0-9_]" },
peg$c48 = ")",
peg$c49 = { type: "literal", value: ")", description: "\")\"" },
peg$c50 = function(comp, meta) { var o = {}; comp ? o.comp = comp.join("") : o.comp = ''; meta ? o.meta = meta.join("").split(',') : null; return o; },
peg$c51 = /^[a-zA-Z\/=_,0-9]/,
peg$c52 = { type: "class", value: "[a-zA-Z\\/=_,0-9]", description: "[a-zA-Z\\/=_,0-9]" },
peg$c53 = function(meta) {return meta},
peg$c54 = /^[A-Z.0-9_]/,
peg$c55 = { type: "class", value: "[A-Z.0-9_]", description: "[A-Z.0-9_]" },
peg$c56 = function(portname) {return portname.join("").toLowerCase()},
peg$c57 = "[",
peg$c58 = { type: "literal", value: "[", description: "\"[\"" },
peg$c59 = /^[0-9]/,
peg$c60 = { type: "class", value: "[0-9]", description: "[0-9]" },
peg$c61 = "]",
peg$c62 = { type: "literal", value: "]", description: "\"]\"" },
peg$c63 = function(portname, portindex) {return { port: portname.join("").toLowerCase(), index: parseInt(portindex.join('')) }},
peg$c64 = /^[^\n\r\u2028\u2029]/,
peg$c65 = { type: "class", value: "[^\\n\\r\\u2028\\u2029]", description: "[^\\n\\r\\u2028\\u2029]" },
peg$c66 = /^[\\]/,
peg$c67 = { type: "class", value: "[\\\\]", description: "[\\\\]" },
peg$c68 = /^[']/,
peg$c69 = { type: "class", value: "[']", description: "[']" },
peg$c70 = function() { return "'"; },
peg$c71 = /^[^']/,
peg$c72 = { type: "class", value: "[^']", description: "[^']" },
peg$c73 = " ",
peg$c74 = { type: "literal", value: " ", description: "\" \"" },
peg$currPos = 0,
peg$reportedPos = 0,
peg$cachedPos = 0,
peg$cachedPosDetails = { 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$reportedPos, peg$currPos);
}
function offset() {
return peg$reportedPos;
}
function line() {
return peg$computePosDetails(peg$reportedPos).line;
}
function column() {
return peg$computePosDetails(peg$reportedPos).column;
}
function expected(description) {
throw peg$buildException(
null,
[{ type: "other", description: description }],
peg$reportedPos
);
}
function error(message) {
throw peg$buildException(message, null, peg$reportedPos);
}
function peg$computePosDetails(pos) {
function advance(details, startPos, endPos) {
var p, ch;
for (p = startPos; p < endPos; p++) {
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;
}
}
} else {
startRule = "start";
}
var pos = 0;
var reportFailures = 0;
var rightmostFailuresPos = 0;
var rightmostFailuresExpected = [];
function padLeft(input, padding, length) {
var result = input;
var padLength = length - input.length;
for (var i = 0; i < padLength; i++) {
result = padding + result;
if (peg$cachedPos !== pos) {
if (peg$cachedPos > pos) {
peg$cachedPos = 0;
peg$cachedPosDetails = { line: 1, column: 1, seenCR: false };
}
return result;
advance(peg$cachedPosDetails, peg$cachedPos, pos);
peg$cachedPos = pos;
}
function escape(ch) {
var charCode = ch.charCodeAt(0);
var escapeChar;
var length;
if (charCode <= 0xFF) {
escapeChar = 'x';
length = 2;
} else {
escapeChar = 'u';
length = 4;
return peg$cachedPosDetails;
}
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, pos) {
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++;
}
}
return '\\' + escapeChar + padLeft(charCode.toString(16).toUpperCase(), '0', length);
}
function matchFailed(failure) {
if (pos < rightmostFailuresPos) {
return;
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(/[\u0180-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); })
.replace(/[\u1080-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); });
}
if (pos > rightmostFailuresPos) {
rightmostFailuresPos = pos;
rightmostFailuresExpected = [];
var expectedDescs = new Array(expected.length),
expectedDesc, foundDesc, i;
for (i = 0; i < expected.length; i++) {
expectedDescs[i] = expected[i].description;
}
rightmostFailuresExpected.push(failure);
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.";
}
function parse_start() {
var result0, result1;
var pos0;
pos0 = pos;
result0 = [];
result1 = parse_line();
while (result1 !== null) {
result0.push(result1);
result1 = parse_line();
var posDetails = peg$computePosDetails(pos),
found = pos < input.length ? input.charAt(pos) : null;
if (expected !== null) {
cleanupExpected(expected);
}
return new SyntaxError(
message !== null ? message : buildMessage(expected, found),
expected,
found,
pos,
posDetails.line,
posDetails.column
);
}
function peg$parsestart() {
var s0, s1, s2;
s0 = peg$currPos;
s1 = [];
s2 = peg$parseline();
while (s2 !== peg$FAILED) {
s1.push(s2);
s2 = peg$parseline();
}
if (s1 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c1();
}
s0 = s1;
return s0;
}
function peg$parseline() {
var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9;
s0 = peg$currPos;
s1 = peg$parse_();
if (s1 !== peg$FAILED) {
if (input.substr(peg$currPos, 7) === peg$c3) {
s2 = peg$c3;
peg$currPos += 7;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c4); }
}
if (result0 !== null) {
result0 = (function(offset) { return parser.getResult(); })(pos0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_line() {
var result0, result1, result2, result3, result4, result5, result6, result7, result8;
var pos0, pos1;
pos0 = pos;
pos1 = pos;
result0 = parse__();
if (result0 !== null) {
if (input.substr(pos, 7) === "EXPORT=") {
result1 = "EXPORT=";
pos += 7;
if (s2 !== peg$FAILED) {
s3 = [];
if (peg$c5.test(input.charAt(peg$currPos))) {
s4 = input.charAt(peg$currPos);
peg$currPos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"EXPORT=\"");
}
s4 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c6); }
}
if (result1 !== null) {
if (/^[A-Za-z.0-9_]/.test(input.charAt(pos))) {
result3 = input.charAt(pos);
pos++;
} else {
result3 = null;
if (reportFailures === 0) {
matchFailed("[A-Za-z.0-9_]");
if (s4 !== peg$FAILED) {
while (s4 !== peg$FAILED) {
s3.push(s4);
if (peg$c5.test(input.charAt(peg$currPos))) {
s4 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c6); }
}
}
if (result3 !== null) {
result2 = [];
while (result3 !== null) {
result2.push(result3);
if (/^[A-Za-z.0-9_]/.test(input.charAt(pos))) {
result3 = input.charAt(pos);
pos++;
} else {
result3 = null;
if (reportFailures === 0) {
matchFailed("[A-Za-z.0-9_]");
}
}
}
} else {
s3 = peg$c2;
}
if (s3 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 58) {
s4 = peg$c7;
peg$currPos++;
} else {
result2 = null;
s4 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c8); }
}
if (result2 !== null) {
if (input.charCodeAt(pos) === 58) {
result3 = ":";
pos++;
if (s4 !== peg$FAILED) {
s5 = [];
if (peg$c9.test(input.charAt(peg$currPos))) {
s6 = input.charAt(peg$currPos);
peg$currPos++;
} else {
result3 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
s6 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c10); }
}
if (result3 !== null) {
if (/^[A-Z0-9_]/.test(input.charAt(pos))) {
result5 = input.charAt(pos);
pos++;
} else {
result5 = null;
if (reportFailures === 0) {
matchFailed("[A-Z0-9_]");
if (s6 !== peg$FAILED) {
while (s6 !== peg$FAILED) {
s5.push(s6);
if (peg$c9.test(input.charAt(peg$currPos))) {
s6 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s6 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c10); }
}
}
if (result5 !== null) {
result4 = [];
while (result5 !== null) {
result4.push(result5);
if (/^[A-Z0-9_]/.test(input.charAt(pos))) {
result5 = input.charAt(pos);
pos++;
} else {
result5 = null;
if (reportFailures === 0) {
matchFailed("[A-Z0-9_]");
}
}
} else {
s5 = peg$c2;
}
if (s5 !== peg$FAILED) {
s6 = peg$parse_();
if (s6 !== peg$FAILED) {
s7 = peg$parseLineTerminator();
if (s7 === peg$FAILED) {
s7 = peg$c11;
}
} else {
result4 = null;
}
if (result4 !== null) {
result5 = parse__();
if (result5 !== null) {
result6 = parse_LineTerminator();
result6 = result6 !== null ? result6 : "";
if (result6 !== null) {
result0 = [result0, result1, result2, result3, result4, result5, result6];
} else {
result0 = null;
pos = pos1;
}
if (s7 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c12(s3, s5);
s0 = s1;
} else {
result0 = null;
pos = pos1;
peg$currPos = s0;
s0 = peg$c2;
}
} else {
result0 = null;
pos = pos1;
peg$currPos = s0;
s0 = peg$c2;
}
} else {
result0 = null;
pos = pos1;
peg$currPos = s0;
s0 = peg$c2;
}
} else {
result0 = null;
pos = pos1;
peg$currPos = s0;
s0 = peg$c2;
}
} else {
result0 = null;
pos = pos1;
peg$currPos = s0;
s0 = peg$c2;
}
} else {
result0 = null;
pos = pos1;
peg$currPos = s0;
s0 = peg$c2;
}
if (result0 !== null) {
result0 = (function(offset, priv, pub) {return parser.registerExports(priv.join(""),pub.join(""))})(pos0, result0[2], result0[4]);
}
if (result0 === null) {
pos = pos0;
}
if (result0 === null) {
pos0 = pos;
pos1 = pos;
result0 = parse__();
if (result0 !== null) {
if (input.substr(pos, 7) === "INPORT=") {
result1 = "INPORT=";
pos += 7;
} else {
peg$currPos = s0;
s0 = peg$c2;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parse_();
if (s1 !== peg$FAILED) {
if (input.substr(peg$currPos, 7) === peg$c13) {
s2 = peg$c13;
peg$currPos += 7;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c14); }
}
if (s2 !== peg$FAILED) {
s3 = [];
if (peg$c15.test(input.charAt(peg$currPos))) {
s4 = input.charAt(peg$currPos);
peg$currPos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"INPORT=\"");
}
s4 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c16); }
}
if (result1 !== null) {
if (/^[A-Za-z0-9_]/.test(input.charAt(pos))) {
result3 = input.charAt(pos);
pos++;
} else {
result3 = null;
if (reportFailures === 0) {
matchFailed("[A-Za-z0-9_]");
if (s4 !== peg$FAILED) {
while (s4 !== peg$FAILED) {
s3.push(s4);
if (peg$c15.test(input.charAt(peg$currPos))) {
s4 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c16); }
}
}
if (result3 !== null) {
result2 = [];
while (result3 !== null) {
result2.push(result3);
if (/^[A-Za-z0-9_]/.test(input.charAt(pos))) {
result3 = input.charAt(pos);
pos++;
} else {
result3 = null;
if (reportFailures === 0) {
matchFailed("[A-Za-z0-9_]");
}
}
}
} else {
s3 = peg$c2;
}
if (s3 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 46) {
s4 = peg$c17;
peg$currPos++;
} else {
result2 = null;
s4 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c18); }
}
if (result2 !== null) {
if (input.charCodeAt(pos) === 46) {
result3 = ".";
pos++;
if (s4 !== peg$FAILED) {
s5 = [];
if (peg$c9.test(input.charAt(peg$currPos))) {
s6 = input.charAt(peg$currPos);
peg$currPos++;
} else {
result3 = null;
if (reportFailures === 0) {
matchFailed("\".\"");
}
s6 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c10); }
}
if (result3 !== null) {
if (/^[A-Z0-9_]/.test(input.charAt(pos))) {
result5 = input.charAt(pos);
pos++;
} else {
result5 = null;
if (reportFailures === 0) {
matchFailed("[A-Z0-9_]");
if (s6 !== peg$FAILED) {
while (s6 !== peg$FAILED) {
s5.push(s6);
if (peg$c9.test(input.charAt(peg$currPos))) {
s6 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s6 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c10); }
}
}
if (result5 !== null) {
result4 = [];
while (result5 !== null) {
result4.push(result5);
if (/^[A-Z0-9_]/.test(input.charAt(pos))) {
result5 = input.charAt(pos);
pos++;
} else {
result5 = null;
if (reportFailures === 0) {
matchFailed("[A-Z0-9_]");
}
}
}
} else {
s5 = peg$c2;
}
if (s5 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 58) {
s6 = peg$c7;
peg$currPos++;
} else {
result4 = null;
s6 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c8); }
}
if (result4 !== null) {
if (input.charCodeAt(pos) === 58) {
result5 = ":";
pos++;
if (s6 !== peg$FAILED) {
s7 = [];
if (peg$c9.test(input.charAt(peg$currPos))) {
s8 = input.charAt(peg$currPos);
peg$currPos++;
} else {
result5 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
s8 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c10); }
}
if (result5 !== null) {
if (/^[A-Z0-9_]/.test(input.charAt(pos))) {
result7 = input.charAt(pos);
pos++;
} else {
result7 = null;
if (reportFailures === 0) {
matchFailed("[A-Z0-9_]");
if (s8 !== peg$FAILED) {
while (s8 !== peg$FAILED) {
s7.push(s8);
if (peg$c9.test(input.charAt(peg$currPos))) {
s8 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s8 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c10); }
}
}
if (result7 !== null) {
result6 = [];
while (result7 !== null) {
result6.push(result7);
if (/^[A-Z0-9_]/.test(input.charAt(pos))) {
result7 = input.charAt(pos);
pos++;
} else {
result7 = null;
if (reportFailures === 0) {
matchFailed("[A-Z0-9_]");
}
}
} else {
s7 = peg$c2;
}
if (s7 !== peg$FAILED) {
s8 = peg$parse_();
if (s8 !== peg$FAILED) {
s9 = peg$parseLineTerminator();
if (s9 === peg$FAILED) {
s9 = peg$c11;
}
} else {
result6 = null;
}
if (result6 !== null) {
result7 = parse__();
if (result7 !== null) {
result8 = parse_LineTerminator();
result8 = result8 !== null ? result8 : "";
if (result8 !== null) {
result0 = [result0, result1, result2, result3, result4, result5, result6, result7, result8];
} else {
result0 = null;
pos = pos1;
}
if (s9 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c19(s3, s5, s7);
s0 = s1;
} else {
result0 = null;
pos = pos1;
peg$currPos = s0;
s0 = peg$c2;
}
} else {
result0 = null;
pos = pos1;
peg$currPos = s0;
s0 = peg$c2;
}
} else {
result0 = null;
pos = pos1;
peg$currPos = s0;
s0 = peg$c2;
}
} else {
result0 = null;
pos = pos1;
peg$currPos = s0;
s0 = peg$c2;
}
} else {
result0 = null;
pos = pos1;
peg$currPos = s0;
s0 = peg$c2;
}
} else {
result0 = null;
pos = pos1;
peg$currPos = s0;
s0 = peg$c2;
}
} else {
result0 = null;
pos = pos1;
peg$currPos = s0;
s0 = peg$c2;
}
} else {
result0 = null;
pos = pos1;
peg$currPos = s0;
s0 = peg$c2;
}
if (result0 !== null) {
result0 = (function(offset, node, port, pub) {return parser.registerInports(node.join(""),port.join(""),pub.join(""))})(pos0, result0[2], result0[4], result0[6]);
}
if (result0 === null) {
pos = pos0;
}
if (result0 === null) {
pos0 = pos;
pos1 = pos;
result0 = parse__();
if (result0 !== null) {
if (input.substr(pos, 8) === "OUTPORT=") {
result1 = "OUTPORT=";
pos += 8;
} else {
peg$currPos = s0;
s0 = peg$c2;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parse_();
if (s1 !== peg$FAILED) {
if (input.substr(peg$currPos, 8) === peg$c20) {
s2 = peg$c20;
peg$currPos += 8;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c21); }
}
if (s2 !== peg$FAILED) {
s3 = [];
if (peg$c15.test(input.charAt(peg$currPos))) {
s4 = input.charAt(peg$currPos);
peg$currPos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"OUTPORT=\"");
}
s4 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c16); }
}
if (result1 !== null) {
if (/^[A-Za-z0-9_]/.test(input.charAt(pos))) {
result3 = input.charAt(pos);
pos++;
} else {
result3 = null;
if (reportFailures === 0) {
matchFailed("[A-Za-z0-9_]");
if (s4 !== peg$FAILED) {
while (s4 !== peg$FAILED) {
s3.push(s4);
if (peg$c15.test(input.charAt(peg$currPos))) {
s4 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c16); }
}
}
if (result3 !== null) {
result2 = [];
while (result3 !== null) {
result2.push(result3);
if (/^[A-Za-z0-9_]/.test(input.charAt(pos))) {
result3 = input.charAt(pos);
pos++;
} else {
result3 = null;
if (reportFailures === 0) {
matchFailed("[A-Za-z0-9_]");
}
}
}
} else {
s3 = peg$c2;
}
if (s3 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 46) {
s4 = peg$c17;
peg$currPos++;
} else {
result2 = null;
s4 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c18); }
}
if (result2 !== null) {
if (input.charCodeAt(pos) === 46) {
result3 = ".";
pos++;
if (s4 !== peg$FAILED) {
s5 = [];
if (peg$c9.test(input.charAt(peg$currPos))) {
s6 = input.charAt(peg$currPos);
peg$currPos++;
} else {
result3 = null;
if (reportFailures === 0) {
matchFailed("\".\"");
}
s6 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c10); }
}
if (result3 !== null) {
if (/^[A-Z0-9_]/.test(input.charAt(pos))) {
result5 = input.charAt(pos);
pos++;
} else {
result5 = null;
if (reportFailures === 0) {
matchFailed("[A-Z0-9_]");
if (s6 !== peg$FAILED) {
while (s6 !== peg$FAILED) {
s5.push(s6);
if (peg$c9.test(input.charAt(peg$currPos))) {
s6 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s6 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c10); }
}
}
if (result5 !== null) {
result4 = [];
while (result5 !== null) {
result4.push(result5);
if (/^[A-Z0-9_]/.test(input.charAt(pos))) {
result5 = input.charAt(pos);
pos++;
} else {
result5 = null;
if (reportFailures === 0) {
matchFailed("[A-Z0-9_]");
}
}
}
} else {
s5 = peg$c2;
}
if (s5 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 58) {
s6 = peg$c7;
peg$currPos++;
} else {
result4 = null;
s6 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c8); }
}
if (result4 !== null) {
if (input.charCodeAt(pos) === 58) {
result5 = ":";
pos++;
if (s6 !== peg$FAILED) {
s7 = [];
if (peg$c9.test(input.charAt(peg$currPos))) {
s8 = input.charAt(peg$currPos);
peg$currPos++;
} else {
result5 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
s8 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c10); }
}
if (result5 !== null) {
if (/^[A-Z0-9_]/.test(input.charAt(pos))) {
result7 = input.charAt(pos);
pos++;
} else {
result7 = null;
if (reportFailures === 0) {
matchFailed("[A-Z0-9_]");
if (s8 !== peg$FAILED) {
while (s8 !== peg$FAILED) {
s7.push(s8);
if (peg$c9.test(input.charAt(peg$currPos))) {
s8 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s8 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c10); }
}
}
if (result7 !== null) {
result6 = [];
while (result7 !== null) {
result6.push(result7);
if (/^[A-Z0-9_]/.test(input.charAt(pos))) {
result7 = input.charAt(pos);
pos++;
} else {
result7 = null;
if (reportFailures === 0) {
matchFailed("[A-Z0-9_]");
}
}
} else {
s7 = peg$c2;
}
if (s7 !== peg$FAILED) {
s8 = peg$parse_();
if (s8 !== peg$FAILED) {
s9 = peg$parseLineTerminator();
if (s9 === peg$FAILED) {
s9 = peg$c11;
}
} else {
result6 = null;
}
if (result6 !== null) {
result7 = parse__();
if (result7 !== null) {
result8 = parse_LineTerminator();
result8 = result8 !== null ? result8 : "";
if (result8 !== null) {
result0 = [result0, result1, result2, result3, result4, result5, result6, result7, result8];
} else {
result0 = null;
pos = pos1;
}
if (s9 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c22(s3, s5, s7);
s0 = s1;
} else {
result0 = null;
pos = pos1;
peg$currPos = s0;
s0 = peg$c2;
}
} else {
result0 = null;
pos = pos1;
peg$currPos = s0;
s0 = peg$c2;
}
} else {
result0 = null;
pos = pos1;
peg$currPos = s0;
s0 = peg$c2;
}
} else {
result0 = null;
pos = pos1;
peg$currPos = s0;
s0 = peg$c2;
}
} else {
result0 = null;
pos = pos1;
peg$currPos = s0;
s0 = peg$c2;
}
} else {
result0 = null;
pos = pos1;
peg$currPos = s0;
s0 = peg$c2;
}
} else {
result0 = null;
pos = pos1;
peg$currPos = s0;
s0 = peg$c2;
}
} else {
result0 = null;
pos = pos1;
peg$currPos = s0;
s0 = peg$c2;
}
if (result0 !== null) {
result0 = (function(offset, node, port, pub) {return parser.registerOutports(node.join(""),port.join(""),pub.join(""))})(pos0, result0[2], result0[4], result0[6]);
} else {
peg$currPos = s0;
s0 = peg$c2;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parsecomment();
if (s1 !== peg$FAILED) {
if (peg$c23.test(input.charAt(peg$currPos))) {
s2 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c24); }
}
if (s2 === peg$FAILED) {
s2 = peg$c11;
}
if (s2 !== peg$FAILED) {
s1 = [s1, s2];
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c2;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
}
if (result0 === null) {
pos = pos0;
}
if (result0 === null) {
pos0 = pos;
result0 = parse_comment();
if (result0 !== null) {
if (/^[\n\r\u2028\u2029]/.test(input.charAt(pos))) {
result1 = input.charAt(pos);
pos++;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parse_();
if (s1 !== peg$FAILED) {
if (peg$c23.test(input.charAt(peg$currPos))) {
s2 = input.charAt(peg$currPos);
peg$currPos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("[\\n\\r\\u2028\\u2029]");
}
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c24); }
}
result1 = result1 !== null ? result1 : "";
if (result1 !== null) {
result0 = [result0, result1];
if (s2 !== peg$FAILED) {
s1 = [s1, s2];
s0 = s1;
} else {
result0 = null;
pos = pos0;
peg$currPos = s0;
s0 = peg$c2;
}
} else {
result0 = null;
pos = pos0;
peg$currPos = s0;
s0 = peg$c2;
}
if (result0 === null) {
pos0 = pos;
result0 = parse__();
if (result0 !== null) {
if (/^[\n\r\u2028\u2029]/.test(input.charAt(pos))) {
result1 = input.charAt(pos);
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("[\\n\\r\\u2028\\u2029]");
}
}
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
if (result0 === null) {
pos0 = pos;
pos1 = pos;
result0 = parse__();
if (result0 !== null) {
result1 = parse_connection();
if (result1 !== null) {
result2 = parse__();
if (result2 !== null) {
result3 = parse_LineTerminator();
result3 = result3 !== null ? result3 : "";
if (result3 !== null) {
result0 = [result0, result1, result2, result3];
} else {
result0 = null;
pos = pos1;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parse_();
if (s1 !== peg$FAILED) {
s2 = peg$parseconnection();
if (s2 !== peg$FAILED) {
s3 = peg$parse_();
if (s3 !== peg$FAILED) {
s4 = peg$parseLineTerminator();
if (s4 === peg$FAILED) {
s4 = peg$c11;
}
if (s4 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c25(s2);
s0 = s1;
} else {
result0 = null;
pos = pos1;
peg$currPos = s0;
s0 = peg$c2;
}
} else {
result0 = null;
pos = pos1;
peg$currPos = s0;
s0 = peg$c2;
}
} else {
result0 = null;
pos = pos1;
peg$currPos = s0;
s0 = peg$c2;
}
if (result0 !== null) {
result0 = (function(offset, edges) {return parser.registerEdges(edges);})(pos0, result0[1]);
}
if (result0 === null) {
pos = pos0;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
}

@@ -670,1111 +771,898 @@ }

}
return result0;
}
function parse_LineTerminator() {
var result0, result1, result2, result3;
var pos0;
pos0 = pos;
result0 = parse__();
if (result0 !== null) {
if (input.charCodeAt(pos) === 44) {
result1 = ",";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\",\"");
}
return s0;
}
function peg$parseLineTerminator() {
var s0, s1, s2, s3, s4;
s0 = peg$currPos;
s1 = peg$parse_();
if (s1 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 44) {
s2 = peg$c26;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c27); }
}
if (s2 === peg$FAILED) {
s2 = peg$c11;
}
if (s2 !== peg$FAILED) {
s3 = peg$parsecomment();
if (s3 === peg$FAILED) {
s3 = peg$c11;
}
result1 = result1 !== null ? result1 : "";
if (result1 !== null) {
result2 = parse_comment();
result2 = result2 !== null ? result2 : "";
if (result2 !== null) {
if (/^[\n\r\u2028\u2029]/.test(input.charAt(pos))) {
result3 = input.charAt(pos);
pos++;
} else {
result3 = null;
if (reportFailures === 0) {
matchFailed("[\\n\\r\\u2028\\u2029]");
}
}
result3 = result3 !== null ? result3 : "";
if (result3 !== null) {
result0 = [result0, result1, result2, result3];
} else {
result0 = null;
pos = pos0;
}
if (s3 !== peg$FAILED) {
if (peg$c23.test(input.charAt(peg$currPos))) {
s4 = input.charAt(peg$currPos);
peg$currPos++;
} else {
result0 = null;
pos = pos0;
s4 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c24); }
}
if (s4 === peg$FAILED) {
s4 = peg$c11;
}
if (s4 !== peg$FAILED) {
s1 = [s1, s2, s3, s4];
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c2;
}
} else {
result0 = null;
pos = pos0;
peg$currPos = s0;
s0 = peg$c2;
}
} else {
result0 = null;
pos = pos0;
peg$currPos = s0;
s0 = peg$c2;
}
return result0;
} else {
peg$currPos = s0;
s0 = peg$c2;
}
function parse_comment() {
var result0, result1, result2, result3;
var pos0;
pos0 = pos;
result0 = parse__();
if (result0 !== null) {
if (input.charCodeAt(pos) === 35) {
result1 = "#";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"#\"");
}
return s0;
}
function peg$parsecomment() {
var s0, s1, s2, s3, s4;
s0 = peg$currPos;
s1 = peg$parse_();
if (s1 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 35) {
s2 = peg$c28;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c29); }
}
if (s2 !== peg$FAILED) {
s3 = [];
s4 = peg$parseanychar();
while (s4 !== peg$FAILED) {
s3.push(s4);
s4 = peg$parseanychar();
}
if (result1 !== null) {
result2 = [];
result3 = parse_anychar();
while (result3 !== null) {
result2.push(result3);
result3 = parse_anychar();
}
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = pos0;
}
if (s3 !== peg$FAILED) {
s1 = [s1, s2, s3];
s0 = s1;
} else {
result0 = null;
pos = pos0;
peg$currPos = s0;
s0 = peg$c2;
}
} else {
result0 = null;
pos = pos0;
peg$currPos = s0;
s0 = peg$c2;
}
return result0;
} else {
peg$currPos = s0;
s0 = peg$c2;
}
function parse_connection() {
var result0, result1, result2, result3, result4;
var pos0, pos1;
pos0 = pos;
pos1 = pos;
result0 = parse_bridge();
if (result0 !== null) {
result1 = parse__();
if (result1 !== null) {
if (input.substr(pos, 2) === "->") {
result2 = "->";
pos += 2;
} else {
result2 = null;
if (reportFailures === 0) {
matchFailed("\"->\"");
}
}
if (result2 !== null) {
result3 = parse__();
if (result3 !== null) {
result4 = parse_connection();
if (result4 !== null) {
result0 = [result0, result1, result2, result3, result4];
} else {
result0 = null;
pos = pos1;
}
return s0;
}
function peg$parseconnection() {
var s0, s1, s2, s3, s4, s5;
s0 = peg$currPos;
s1 = peg$parsebridge();
if (s1 !== peg$FAILED) {
s2 = peg$parse_();
if (s2 !== peg$FAILED) {
if (input.substr(peg$currPos, 2) === peg$c30) {
s3 = peg$c30;
peg$currPos += 2;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c31); }
}
if (s3 !== peg$FAILED) {
s4 = peg$parse_();
if (s4 !== peg$FAILED) {
s5 = peg$parseconnection();
if (s5 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c32(s1, s5);
s0 = s1;
} else {
result0 = null;
pos = pos1;
peg$currPos = s0;
s0 = peg$c2;
}
} else {
result0 = null;
pos = pos1;
peg$currPos = s0;
s0 = peg$c2;
}
} else {
result0 = null;
pos = pos1;
peg$currPos = s0;
s0 = peg$c2;
}
} else {
result0 = null;
pos = pos1;
peg$currPos = s0;
s0 = peg$c2;
}
if (result0 !== null) {
result0 = (function(offset, x, y) { return [x,y]; })(pos0, result0[0], result0[4]);
}
if (result0 === null) {
pos = pos0;
}
if (result0 === null) {
result0 = parse_bridge();
}
return result0;
} else {
peg$currPos = s0;
s0 = peg$c2;
}
function parse_bridge() {
var result0, result1, result2, result3, result4;
var pos0, pos1;
pos0 = pos;
pos1 = pos;
result0 = parse_port();
if (result0 !== null) {
result1 = parse__();
if (result1 !== null) {
result2 = parse_node();
if (result2 !== null) {
result3 = parse__();
if (result3 !== null) {
result4 = parse_port();
if (result4 !== null) {
result0 = [result0, result1, result2, result3, result4];
} else {
result0 = null;
pos = pos1;
}
if (s0 === peg$FAILED) {
s0 = peg$parsebridge();
}
return s0;
}
function peg$parsebridge() {
var s0, s1, s2, s3, s4, s5;
s0 = peg$currPos;
s1 = peg$parseport();
if (s1 !== peg$FAILED) {
s2 = peg$parse_();
if (s2 !== peg$FAILED) {
s3 = peg$parsenode();
if (s3 !== peg$FAILED) {
s4 = peg$parse_();
if (s4 !== peg$FAILED) {
s5 = peg$parseport();
if (s5 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c33(s1, s3, s5);
s0 = s1;
} else {
result0 = null;
pos = pos1;
peg$currPos = s0;
s0 = peg$c2;
}
} else {
result0 = null;
pos = pos1;
peg$currPos = s0;
s0 = peg$c2;
}
} else {
result0 = null;
pos = pos1;
peg$currPos = s0;
s0 = peg$c2;
}
} else {
result0 = null;
pos = pos1;
peg$currPos = s0;
s0 = peg$c2;
}
if (result0 !== null) {
result0 = (function(offset, x, proc, y) { return [{"tgt":{process:proc, port:x}},{"src":{process:proc, port:y}}]; })(pos0, result0[0], result0[2], result0[4]);
}
if (result0 === null) {
pos = pos0;
}
if (result0 === null) {
result0 = parse_iip();
if (result0 === null) {
result0 = parse_rightlet();
if (result0 === null) {
result0 = parse_leftlet();
}
} else {
peg$currPos = s0;
s0 = peg$c2;
}
if (s0 === peg$FAILED) {
s0 = peg$parseiip();
if (s0 === peg$FAILED) {
s0 = peg$parserightlet();
if (s0 === peg$FAILED) {
s0 = peg$parseleftlet();
}
}
return result0;
}
function parse_leftlet() {
var result0, result1, result2;
var pos0, pos1;
pos0 = pos;
pos1 = pos;
result0 = parse_node();
if (result0 !== null) {
result1 = parse__();
if (result1 !== null) {
result2 = parse_port();
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = pos1;
}
return s0;
}
function peg$parseleftlet() {
var s0, s1, s2, s3;
s0 = peg$currPos;
s1 = peg$parsenode();
if (s1 !== peg$FAILED) {
s2 = peg$parse_();
if (s2 !== peg$FAILED) {
s3 = peg$parseport();
if (s3 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c34(s1, s3);
s0 = s1;
} else {
result0 = null;
pos = pos1;
peg$currPos = s0;
s0 = peg$c2;
}
} else {
result0 = null;
pos = pos1;
peg$currPos = s0;
s0 = peg$c2;
}
if (result0 !== null) {
result0 = (function(offset, proc, port) { return {"src":{process:proc, port:port}} })(pos0, result0[0], result0[2]);
}
if (result0 === null) {
pos = pos0;
}
if (result0 === null) {
pos0 = pos;
pos1 = pos;
result0 = parse_node();
if (result0 !== null) {
result1 = parse__();
if (result1 !== null) {
result2 = parse_portWithIndex();
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = pos1;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parsenode();
if (s1 !== peg$FAILED) {
s2 = peg$parse_();
if (s2 !== peg$FAILED) {
s3 = peg$parseportWithIndex();
if (s3 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c35(s1, s3);
s0 = s1;
} else {
result0 = null;
pos = pos1;
peg$currPos = s0;
s0 = peg$c2;
}
} else {
result0 = null;
pos = pos1;
peg$currPos = s0;
s0 = peg$c2;
}
if (result0 !== null) {
result0 = (function(offset, proc, port) { return {"src":{process:proc, port:port.port, index: port.index}} })(pos0, result0[0], result0[2]);
}
if (result0 === null) {
pos = pos0;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
}
return result0;
}
function parse_iip() {
var result0, result1, result2;
var pos0, pos1;
pos0 = pos;
pos1 = pos;
if (input.charCodeAt(pos) === 39) {
result0 = "'";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"'\"");
}
return s0;
}
function peg$parseiip() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 39) {
s1 = peg$c36;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c37); }
}
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$parseiipchar();
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$parseiipchar();
}
if (result0 !== null) {
result1 = [];
result2 = parse_iipchar();
while (result2 !== null) {
result1.push(result2);
result2 = parse_iipchar();
if (s2 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 39) {
s3 = peg$c36;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c37); }
}
if (result1 !== null) {
if (input.charCodeAt(pos) === 39) {
result2 = "'";
pos++;
} else {
result2 = null;
if (reportFailures === 0) {
matchFailed("\"'\"");
}
}
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = pos1;
}
if (s3 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c38(s2);
s0 = s1;
} else {
result0 = null;
pos = pos1;
peg$currPos = s0;
s0 = peg$c2;
}
} else {
result0 = null;
pos = pos1;
peg$currPos = s0;
s0 = peg$c2;
}
if (result0 !== null) {
result0 = (function(offset, iip) { return {"data":iip.join("")} })(pos0, result0[1]);
}
if (result0 === null) {
pos = pos0;
}
return result0;
} else {
peg$currPos = s0;
s0 = peg$c2;
}
function parse_rightlet() {
var result0, result1, result2;
var pos0, pos1;
pos0 = pos;
pos1 = pos;
result0 = parse_port();
if (result0 !== null) {
result1 = parse__();
if (result1 !== null) {
result2 = parse_node();
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = pos1;
}
return s0;
}
function peg$parserightlet() {
var s0, s1, s2, s3;
s0 = peg$currPos;
s1 = peg$parseport();
if (s1 !== peg$FAILED) {
s2 = peg$parse_();
if (s2 !== peg$FAILED) {
s3 = peg$parsenode();
if (s3 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c39(s1, s3);
s0 = s1;
} else {
result0 = null;
pos = pos1;
peg$currPos = s0;
s0 = peg$c2;
}
} else {
result0 = null;
pos = pos1;
peg$currPos = s0;
s0 = peg$c2;
}
if (result0 !== null) {
result0 = (function(offset, port, proc) { return {"tgt":{process:proc, port:port}} })(pos0, result0[0], result0[2]);
}
if (result0 === null) {
pos = pos0;
}
if (result0 === null) {
pos0 = pos;
pos1 = pos;
result0 = parse_portWithIndex();
if (result0 !== null) {
result1 = parse__();
if (result1 !== null) {
result2 = parse_node();
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = pos1;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseportWithIndex();
if (s1 !== peg$FAILED) {
s2 = peg$parse_();
if (s2 !== peg$FAILED) {
s3 = peg$parsenode();
if (s3 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c40(s1, s3);
s0 = s1;
} else {
result0 = null;
pos = pos1;
peg$currPos = s0;
s0 = peg$c2;
}
} else {
result0 = null;
pos = pos1;
peg$currPos = s0;
s0 = peg$c2;
}
if (result0 !== null) {
result0 = (function(offset, port, proc) { return {"tgt":{process:proc, port:port.port, index: port.index}} })(pos0, result0[0], result0[2]);
}
if (result0 === null) {
pos = pos0;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
}
return result0;
}
function parse_node() {
var result0, result1;
var pos0, pos1;
pos0 = pos;
pos1 = pos;
if (/^[a-zA-Z0-9_]/.test(input.charAt(pos))) {
result1 = input.charAt(pos);
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("[a-zA-Z0-9_]");
return s0;
}
function peg$parsenode() {
var s0, s1, s2;
s0 = peg$currPos;
s1 = [];
if (peg$c41.test(input.charAt(peg$currPos))) {
s2 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c42); }
}
if (s2 !== peg$FAILED) {
while (s2 !== peg$FAILED) {
s1.push(s2);
if (peg$c41.test(input.charAt(peg$currPos))) {
s2 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c42); }
}
}
if (result1 !== null) {
result0 = [];
while (result1 !== null) {
result0.push(result1);
if (/^[a-zA-Z0-9_]/.test(input.charAt(pos))) {
result1 = input.charAt(pos);
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("[a-zA-Z0-9_]");
}
}
}
} else {
result0 = null;
} else {
s1 = peg$c2;
}
if (s1 !== peg$FAILED) {
s2 = peg$parsecomponent();
if (s2 === peg$FAILED) {
s2 = peg$c11;
}
if (result0 !== null) {
result1 = parse_component();
result1 = result1 !== null ? result1 : "";
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos1;
}
if (s2 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c43(s1, s2);
s0 = s1;
} else {
result0 = null;
pos = pos1;
peg$currPos = s0;
s0 = peg$c2;
}
if (result0 !== null) {
result0 = (function(offset, node, comp) { if(comp){parser.addNode(node.join(""),comp);}; return node.join("")})(pos0, result0[0], result0[1]);
}
if (result0 === null) {
pos = pos0;
}
return result0;
} else {
peg$currPos = s0;
s0 = peg$c2;
}
function parse_component() {
var result0, result1, result2, result3;
var pos0, pos1;
pos0 = pos;
pos1 = pos;
if (input.charCodeAt(pos) === 40) {
result0 = "(";
pos++;
return s0;
}
function peg$parsecomponent() {
var s0, s1, s2, s3, s4;
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 40) {
s1 = peg$c44;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c45); }
}
if (s1 !== peg$FAILED) {
s2 = [];
if (peg$c46.test(input.charAt(peg$currPos))) {
s3 = input.charAt(peg$currPos);
peg$currPos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"(\"");
}
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c47); }
}
if (result0 !== null) {
if (/^[a-zA-Z\/\-0-9_]/.test(input.charAt(pos))) {
result2 = input.charAt(pos);
pos++;
} else {
result2 = null;
if (reportFailures === 0) {
matchFailed("[a-zA-Z\\/\\-0-9_]");
}
}
if (result2 !== null) {
result1 = [];
while (result2 !== null) {
result1.push(result2);
if (/^[a-zA-Z\/\-0-9_]/.test(input.charAt(pos))) {
result2 = input.charAt(pos);
pos++;
} else {
result2 = null;
if (reportFailures === 0) {
matchFailed("[a-zA-Z\\/\\-0-9_]");
}
}
}
} else {
result1 = null;
}
result1 = result1 !== null ? result1 : "";
if (result1 !== null) {
result2 = parse_compMeta();
result2 = result2 !== null ? result2 : "";
if (result2 !== null) {
if (input.charCodeAt(pos) === 41) {
result3 = ")";
pos++;
} else {
result3 = null;
if (reportFailures === 0) {
matchFailed("\")\"");
}
}
if (result3 !== null) {
result0 = [result0, result1, result2, result3];
} else {
result0 = null;
pos = pos1;
}
if (s3 !== peg$FAILED) {
while (s3 !== peg$FAILED) {
s2.push(s3);
if (peg$c46.test(input.charAt(peg$currPos))) {
s3 = input.charAt(peg$currPos);
peg$currPos++;
} else {
result0 = null;
pos = pos1;
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c47); }
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
s2 = peg$c2;
}
if (result0 !== null) {
result0 = (function(offset, comp, meta) { var o = {}; comp ? o.comp = comp.join("") : o.comp = ''; meta ? o.meta = meta.join("").split(',') : null; return o; })(pos0, result0[1], result0[2]);
if (s2 === peg$FAILED) {
s2 = peg$c11;
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_compMeta() {
var result0, result1, result2;
var pos0, pos1;
pos0 = pos;
pos1 = pos;
if (input.charCodeAt(pos) === 58) {
result0 = ":";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
if (s2 !== peg$FAILED) {
s3 = peg$parsecompMeta();
if (s3 === peg$FAILED) {
s3 = peg$c11;
}
}
if (result0 !== null) {
if (/^[a-zA-Z\/=_,0-9]/.test(input.charAt(pos))) {
result2 = input.charAt(pos);
pos++;
} else {
result2 = null;
if (reportFailures === 0) {
matchFailed("[a-zA-Z\\/=_,0-9]");
if (s3 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 41) {
s4 = peg$c48;
peg$currPos++;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c49); }
}
}
if (result2 !== null) {
result1 = [];
while (result2 !== null) {
result1.push(result2);
if (/^[a-zA-Z\/=_,0-9]/.test(input.charAt(pos))) {
result2 = input.charAt(pos);
pos++;
} else {
result2 = null;
if (reportFailures === 0) {
matchFailed("[a-zA-Z\\/=_,0-9]");
}
}
if (s4 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c50(s2, s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c2;
}
} else {
result1 = null;
peg$currPos = s0;
s0 = peg$c2;
}
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
peg$currPos = s0;
s0 = peg$c2;
}
if (result0 !== null) {
result0 = (function(offset, meta) {return meta})(pos0, result0[1]);
}
if (result0 === null) {
pos = pos0;
}
return result0;
} else {
peg$currPos = s0;
s0 = peg$c2;
}
function parse_port() {
var result0, result1;
var pos0, pos1;
pos0 = pos;
pos1 = pos;
if (/^[A-Z.0-9_]/.test(input.charAt(pos))) {
result1 = input.charAt(pos);
pos++;
return s0;
}
function peg$parsecompMeta() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 58) {
s1 = peg$c7;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c8); }
}
if (s1 !== peg$FAILED) {
s2 = [];
if (peg$c51.test(input.charAt(peg$currPos))) {
s3 = input.charAt(peg$currPos);
peg$currPos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("[A-Z.0-9_]");
}
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c52); }
}
if (result1 !== null) {
result0 = [];
while (result1 !== null) {
result0.push(result1);
if (/^[A-Z.0-9_]/.test(input.charAt(pos))) {
result1 = input.charAt(pos);
pos++;
if (s3 !== peg$FAILED) {
while (s3 !== peg$FAILED) {
s2.push(s3);
if (peg$c51.test(input.charAt(peg$currPos))) {
s3 = input.charAt(peg$currPos);
peg$currPos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("[A-Z.0-9_]");
}
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c52); }
}
}
} else {
result0 = null;
s2 = peg$c2;
}
if (result0 !== null) {
result1 = parse___();
if (result1 !== null) {
result0 = [result0, result1];
if (s2 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c53(s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c2;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
}
return s0;
}
function peg$parseport() {
var s0, s1, s2;
s0 = peg$currPos;
s1 = [];
if (peg$c54.test(input.charAt(peg$currPos))) {
s2 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c55); }
}
if (s2 !== peg$FAILED) {
while (s2 !== peg$FAILED) {
s1.push(s2);
if (peg$c54.test(input.charAt(peg$currPos))) {
s2 = input.charAt(peg$currPos);
peg$currPos++;
} else {
result0 = null;
pos = pos1;
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c55); }
}
}
} else {
s1 = peg$c2;
}
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c56(s1);
s0 = s1;
} else {
result0 = null;
pos = pos1;
peg$currPos = s0;
s0 = peg$c2;
}
if (result0 !== null) {
result0 = (function(offset, portname) {return portname.join("").toLowerCase()})(pos0, result0[0]);
}
if (result0 === null) {
pos = pos0;
}
return result0;
} else {
peg$currPos = s0;
s0 = peg$c2;
}
function parse_portWithIndex() {
var result0, result1, result2, result3, result4;
var pos0, pos1;
pos0 = pos;
pos1 = pos;
if (/^[A-Z.0-9_]/.test(input.charAt(pos))) {
result1 = input.charAt(pos);
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("[A-Z.0-9_]");
return s0;
}
function peg$parseportWithIndex() {
var s0, s1, s2, s3, s4, s5;
s0 = peg$currPos;
s1 = [];
if (peg$c54.test(input.charAt(peg$currPos))) {
s2 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c55); }
}
if (s2 !== peg$FAILED) {
while (s2 !== peg$FAILED) {
s1.push(s2);
if (peg$c54.test(input.charAt(peg$currPos))) {
s2 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c55); }
}
}
if (result1 !== null) {
result0 = [];
while (result1 !== null) {
result0.push(result1);
if (/^[A-Z.0-9_]/.test(input.charAt(pos))) {
result1 = input.charAt(pos);
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("[A-Z.0-9_]");
}
}
}
} else {
s1 = peg$c2;
}
if (s1 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 91) {
s2 = peg$c57;
peg$currPos++;
} else {
result0 = null;
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c58); }
}
if (result0 !== null) {
if (input.charCodeAt(pos) === 91) {
result1 = "[";
pos++;
if (s2 !== peg$FAILED) {
s3 = [];
if (peg$c59.test(input.charAt(peg$currPos))) {
s4 = input.charAt(peg$currPos);
peg$currPos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"[\"");
}
s4 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c60); }
}
if (result1 !== null) {
if (/^[0-9]/.test(input.charAt(pos))) {
result3 = input.charAt(pos);
pos++;
} else {
result3 = null;
if (reportFailures === 0) {
matchFailed("[0-9]");
if (s4 !== peg$FAILED) {
while (s4 !== peg$FAILED) {
s3.push(s4);
if (peg$c59.test(input.charAt(peg$currPos))) {
s4 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c60); }
}
}
if (result3 !== null) {
result2 = [];
while (result3 !== null) {
result2.push(result3);
if (/^[0-9]/.test(input.charAt(pos))) {
result3 = input.charAt(pos);
pos++;
} else {
result3 = null;
if (reportFailures === 0) {
matchFailed("[0-9]");
}
}
}
} else {
s3 = peg$c2;
}
if (s3 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 93) {
s4 = peg$c61;
peg$currPos++;
} else {
result2 = null;
s4 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c62); }
}
if (result2 !== null) {
if (input.charCodeAt(pos) === 93) {
result3 = "]";
pos++;
if (s4 !== peg$FAILED) {
s5 = peg$parse__();
if (s5 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c63(s1, s3);
s0 = s1;
} else {
result3 = null;
if (reportFailures === 0) {
matchFailed("\"]\"");
}
peg$currPos = s0;
s0 = peg$c2;
}
if (result3 !== null) {
result4 = parse___();
if (result4 !== null) {
result0 = [result0, result1, result2, result3, result4];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
peg$currPos = s0;
s0 = peg$c2;
}
} else {
result0 = null;
pos = pos1;
peg$currPos = s0;
s0 = peg$c2;
}
} else {
result0 = null;
pos = pos1;
peg$currPos = s0;
s0 = peg$c2;
}
if (result0 !== null) {
result0 = (function(offset, portname, portindex) {return { port: portname.join("").toLowerCase(), index: parseInt(portindex.join('')) }})(pos0, result0[0], result0[2]);
} else {
peg$currPos = s0;
s0 = peg$c2;
}
return s0;
}
function peg$parseanychar() {
var s0;
if (peg$c64.test(input.charAt(peg$currPos))) {
s0 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c65); }
}
return s0;
}
function peg$parseiipchar() {
var s0, s1, s2;
s0 = peg$currPos;
if (peg$c66.test(input.charAt(peg$currPos))) {
s1 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c67); }
}
if (s1 !== peg$FAILED) {
if (peg$c68.test(input.charAt(peg$currPos))) {
s2 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c69); }
}
if (result0 === null) {
pos = pos0;
if (s2 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c70();
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c2;
}
return result0;
} else {
peg$currPos = s0;
s0 = peg$c2;
}
function parse_anychar() {
var result0;
if (/^[^\n\r\u2028\u2029]/.test(input.charAt(pos))) {
result0 = input.charAt(pos);
pos++;
if (s0 === peg$FAILED) {
if (peg$c71.test(input.charAt(peg$currPos))) {
s0 = input.charAt(peg$currPos);
peg$currPos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("[^\\n\\r\\u2028\\u2029]");
}
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c72); }
}
return result0;
}
function parse_iipchar() {
var result0, result1;
var pos0, pos1;
pos0 = pos;
pos1 = pos;
if (/^[\\]/.test(input.charAt(pos))) {
result0 = input.charAt(pos);
pos++;
return s0;
}
function peg$parse_() {
var s0, s1;
s0 = [];
if (input.charCodeAt(peg$currPos) === 32) {
s1 = peg$c73;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c74); }
}
while (s1 !== peg$FAILED) {
s0.push(s1);
if (input.charCodeAt(peg$currPos) === 32) {
s1 = peg$c73;
peg$currPos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("[\\\\]");
}
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c74); }
}
if (result0 !== null) {
if (/^[']/.test(input.charAt(pos))) {
result1 = input.charAt(pos);
pos++;
}
if (s0 === peg$FAILED) {
s0 = peg$c11;
}
return s0;
}
function peg$parse__() {
var s0, s1;
s0 = [];
if (input.charCodeAt(peg$currPos) === 32) {
s1 = peg$c73;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c74); }
}
if (s1 !== peg$FAILED) {
while (s1 !== peg$FAILED) {
s0.push(s1);
if (input.charCodeAt(peg$currPos) === 32) {
s1 = peg$c73;
peg$currPos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("[']");
}
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c74); }
}
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset) { return "'"; })(pos0);
} else {
s0 = peg$c2;
}
return s0;
}
var parser, edges, nodes;
parser = this;
delete parser.exports;
delete parser.inports;
delete parser.outports;
edges = parser.edges = [];
nodes = {};
parser.addNode = function (nodeName, comp) {
if (!nodes[nodeName]) {
nodes[nodeName] = {}
}
if (result0 === null) {
pos = pos0;
if (!!comp.comp) {
nodes[nodeName].component = comp.comp;
}
if (result0 === null) {
if (/^[^']/.test(input.charAt(pos))) {
result0 = input.charAt(pos);
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("[^']");
if (!!comp.meta) {
var metadata = {};
for (var i = 0; i < comp.meta.length; i++) {
var item = comp.meta[i].split('=');
if (item.length === 1) {
item = ['routes', item[0]];
}
var key = item[0];
var value = item[1];
if (key==='x' || key==='y') {
value = parseFloat(value);
}
metadata[key] = value;
}
nodes[nodeName].metadata=metadata;
}
return result0;
}
function parse__() {
var result0, result1;
result0 = [];
if (input.charCodeAt(pos) === 32) {
result1 = " ";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\" \"");
parser.getResult = function () {
return {processes:nodes, connections:parser.processEdges(), exports:parser.exports, inports: parser.inports, outports: parser.outports};
}
var flatten = function (array, isShallow) {
var index = -1,
length = array ? array.length : 0,
result = [];
while (++index < length) {
var value = array[index];
if (value instanceof Array) {
Array.prototype.push.apply(result, isShallow ? value : flatten(value));
}
}
while (result1 !== null) {
result0.push(result1);
if (input.charCodeAt(pos) === 32) {
result1 = " ";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\" \"");
}
else {
result.push(value);
}
}
result0 = result0 !== null ? result0 : "";
return result0;
return result;
}
function parse___() {
var result0, result1;
if (input.charCodeAt(pos) === 32) {
result1 = " ";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\" \"");
}
parser.registerExports = function (priv, pub) {
if (!parser.exports) {
parser.exports = [];
}
if (result1 !== null) {
result0 = [];
while (result1 !== null) {
result0.push(result1);
if (input.charCodeAt(pos) === 32) {
result1 = " ";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\" \"");
}
}
}
} else {
result0 = null;
}
return result0;
parser.exports.push({private:priv.toLowerCase(), public:pub.toLowerCase()})
}
function cleanupExpected(expected) {
expected.sort();
var lastExpected = null;
var cleanExpected = [];
for (var i = 0; i < expected.length; i++) {
if (expected[i] !== lastExpected) {
cleanExpected.push(expected[i]);
lastExpected = expected[i];
}
parser.registerInports = function (node, port, pub) {
if (!parser.inports) {
parser.inports = {};
}
return cleanExpected;
parser.inports[pub.toLowerCase()] = {process:node, port:port.toLowerCase()}
}
function computeErrorPosition() {
/*
* The first idea was to use |String.split| to break the input up to the
* error position along newlines and derive the line and column from
* there. However IE's |split| implementation is so broken that it was
* enough to prevent it.
*/
var line = 1;
var column = 1;
var seenCR = false;
for (var i = 0; i < Math.max(pos, rightmostFailuresPos); i++) {
var ch = input.charAt(i);
if (ch === "\n") {
if (!seenCR) { line++; }
column = 1;
seenCR = false;
} else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") {
line++;
column = 1;
seenCR = true;
} else {
column++;
seenCR = false;
}
parser.registerOutports = function (node, port, pub) {
if (!parser.outports) {
parser.outports = {};
}
return { line: line, column: column };
parser.outports[pub.toLowerCase()] = {process:node, port:port.toLowerCase()}
}
var parser, edges, nodes;
parser = this;
delete parser.exports;
delete parser.inports;
delete parser.outports;
edges = parser.edges = [];
nodes = {};
parser.addNode = function (nodeName, comp) {
if (!nodes[nodeName]) {
nodes[nodeName] = {}
parser.registerEdges = function (edges) {
edges.forEach(function (o, i) {
parser.edges.push(o);
});
}
parser.processEdges = function () {
var flats, grouped;
flats = flatten(parser.edges);
grouped = [];
var current = {};
flats.forEach(function (o, i) {
if (i % 2 !== 0) {
var pair = grouped[grouped.length - 1];
pair.tgt = o.tgt;
return;
}
if (!!comp.comp) {
nodes[nodeName].component = comp.comp;
}
if (!!comp.meta) {
var metadata = {};
for (var i = 0; i < comp.meta.length; i++) {
var item = comp.meta[i].split('=');
if (item.length === 1) {
item = ['routes', item[0]];
}
metadata[item[0]] = item[1];
}
nodes[nodeName].metadata=metadata;
}
}
parser.getResult = function () {
return {processes:nodes, connections:parser.processEdges(), exports:parser.exports, inports: parser.inports, outports: parser.outports};
}
var flatten = function (array, isShallow) {
var index = -1,
length = array ? array.length : 0,
result = [];
while (++index < length) {
var value = array[index];
if (value instanceof Array) {
Array.prototype.push.apply(result, isShallow ? value : flatten(value));
}
else {
result.push(value);
}
}
return result;
}
parser.registerExports = function (priv, pub) {
if (!parser.exports) {
parser.exports = [];
}
parser.exports.push({private:priv.toLowerCase(), public:pub.toLowerCase()})
}
parser.registerInports = function (node, port, pub) {
if (!parser.inports) {
parser.inports = {};
}
parser.inports[pub.toLowerCase()] = {process:node, port:port.toLowerCase()}
}
parser.registerOutports = function (node, port, pub) {
if (!parser.outports) {
parser.outports = {};
}
parser.outports[pub.toLowerCase()] = {process:node, port:port.toLowerCase()}
}
parser.registerEdges = function (edges) {
edges.forEach(function (o, i) {
parser.edges.push(o);
});
}
parser.processEdges = function () {
var flats, grouped;
flats = flatten(parser.edges);
grouped = [];
var current = {};
flats.forEach(function (o, i) {
if (i % 2 !== 0) {
var pair = grouped[grouped.length - 1];
pair.tgt = o.tgt;
return;
}
grouped.push(o);
});
return grouped;
}
var result = parseFunctions[startRule]();
/*
* The parser is now in one of the following three states:
*
* 1. The parser successfully parsed the whole input.
*
* - |result !== null|
* - |pos === input.length|
* - |rightmostFailuresExpected| may or may not contain something
*
* 2. The parser successfully parsed only a part of the input.
*
* - |result !== null|
* - |pos < input.length|
* - |rightmostFailuresExpected| may or may not contain something
*
* 3. The parser did not successfully parse any part of the input.
*
* - |result === null|
* - |pos === 0|
* - |rightmostFailuresExpected| contains at least one failure
*
* All code following this comment (including called functions) must
* handle these states.
*/
if (result === null || pos !== input.length) {
var offset = Math.max(pos, rightmostFailuresPos);
var found = offset < input.length ? input.charAt(offset) : null;
var errorPosition = computeErrorPosition();
throw new this.SyntaxError(
cleanupExpected(rightmostFailuresExpected),
found,
offset,
errorPosition.line,
errorPosition.column
);
grouped.push(o);
});
return grouped;
}
return result;
},
/* Returns the parser source code. */
toSource: function() { return this._source; }
};
/* Thrown when a parser encounters a syntax error. */
result.SyntaxError = function(expected, found, offset, line, column) {
function buildMessage(expected, found) {
var expectedHumanized, foundHumanized;
switch (expected.length) {
case 0:
expectedHumanized = "end of input";
break;
case 1:
expectedHumanized = expected[0];
break;
default:
expectedHumanized = expected.slice(0, expected.length - 1).join(", ")
+ " or "
+ expected[expected.length - 1];
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({ type: "end", description: "end of input" });
}
foundHumanized = found ? quote(found) : "end of input";
return "Expected " + expectedHumanized + " but " + foundHumanized + " found.";
throw peg$buildException(null, peg$maxFailExpected, peg$maxFailPos);
}
this.name = "SyntaxError";
this.expected = expected;
this.found = found;
this.message = buildMessage(expected, found);
this.offset = offset;
this.line = line;
this.column = column;
}
return {
SyntaxError: SyntaxError,
parse: parse
};
result.SyntaxError.prototype = Error.prototype;
return result;
})();
{
"name": "fbp",
"description": "Parser for the .fbp flow definition language",
"version": "1.1.2",
"version": "1.1.3",
"repository": {

@@ -11,12 +11,12 @@ "type": "git",

"devDependencies": {
"chai": "~1.9.0",
"grunt": "~0.4.1",
"grunt-cafe-mocha": "~0.1.2",
"chai": "~1.5.0",
"mocha": "~1.9.0",
"grunt-contrib-watch": "~0.3.1",
"grunt-peg": "~0.1.0",
"grunt-component-build": "~0.2.7",
"grunt-mocha-phantomjs": "~0.2.8",
"grunt-contrib-uglify": "~0.2.1",
"grunt-contrib-coffee": "~0.7.0"
"grunt-component-build": "~0.5.0",
"grunt-contrib-coffee": "~0.11.0",
"grunt-contrib-watch": "~0.6.1",
"grunt-mocha-phantomjs": "~0.6.0",
"grunt-noflo-browser": "^0.1.3",
"grunt-peg": "~1.5.0",
"mocha": "~1.21.0"
},

@@ -23,0 +23,0 @@ "keywords": [],

@@ -1,2 +0,2 @@

FBP flow definition language parser [![Build Status](https://travis-ci.org/noflo/fbp.png?branch=master)](https://travis-ci.org/noflo/fbp)
FBP flow definition language parser [![Build Status](https://travis-ci.org/noflo/fbp.png?branch=master)](https://travis-ci.org/noflo/fbp) [![Build status](https://ci.appveyor.com/api/projects/status/cye5ylmhfybnb8t9)](https://ci.appveyor.com/project/bergie/fbp)
===================================

@@ -37,3 +37,3 @@

Components only have to be specified the first time you mention a new process. Afterwards, simply append empty parentheses (`()`) after the process name.
Components only have to be specified the first time you mention a new process. Afterwards, simply use the process name.

@@ -44,4 +44,4 @@ Example:

'somefile.txt' -> SOURCE Read(ReadFile) OUT -> IN Split(SplitStr)
Split() OUT -> IN Count(Counter) COUNT -> IN Display(Output)
Read() ERROR -> IN Display()
Split OUT -> IN Count(Counter) COUNT -> IN Display(Output)
Read ERROR -> IN Display
```

@@ -48,0 +48,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc