|
|
@@ -1,2986 +0,0 @@
|
|
|
-modellangParser = (function() {
|
|
|
- /*
|
|
|
- * Generated by PEG.js 0.8.0.
|
|
|
- *
|
|
|
- * http://pegjs.majda.cz/
|
|
|
- */
|
|
|
-
|
|
|
- function peg$subclass(child, parent) {
|
|
|
- function ctor() { this.constructor = child; }
|
|
|
- ctor.prototype = parent.prototype;
|
|
|
- child.prototype = new ctor();
|
|
|
- }
|
|
|
-
|
|
|
- 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(s) { return model(s); },
|
|
|
- peg$c2 = peg$FAILED,
|
|
|
- peg$c3 = function(s) { return s; },
|
|
|
- peg$c4 = { type: "other", description: "System" },
|
|
|
- peg$c5 = function(id) { ast.toplevelname = id; ast.localrefs = []; },
|
|
|
- peg$c6 = void 0,
|
|
|
- peg$c7 = function(id, body) { return new ast.System(id, body, ast.localrefs); },
|
|
|
- peg$c8 = { type: "other", description: "Behavior" },
|
|
|
- peg$c9 = function(id, body) { return new ast.Behavior(id, body, ast.localrefs); },
|
|
|
- peg$c10 = { type: "other", description: "Interaction" },
|
|
|
- peg$c11 = function(interaction) { return interaction; },
|
|
|
- peg$c12 = function(a) { return a; },
|
|
|
- peg$c13 = function(first, type, second, rest) { return new ast.Interaction(type, [first, second].concat(rest)); },
|
|
|
- peg$c14 = function(t) { return t; },
|
|
|
- peg$c15 = { type: "other", description: "Selector" },
|
|
|
- peg$c16 = function() { ast.selector = true; },
|
|
|
- peg$c17 = null,
|
|
|
- peg$c18 = "{",
|
|
|
- peg$c19 = { type: "literal", value: "{", description: "\"{\"" },
|
|
|
- peg$c20 = "}",
|
|
|
- peg$c21 = { type: "literal", value: "}", description: "\"}\"" },
|
|
|
- peg$c22 = function(c) { return c; },
|
|
|
- peg$c23 = ":",
|
|
|
- peg$c24 = { type: "literal", value: ":", description: "\":\"" },
|
|
|
- peg$c25 = function(pre, sys, pattern, post) { ast.selector = false; return new ast.Selector(sys, pattern, pre, post); },
|
|
|
- peg$c26 = function(sys, pattern) { ast.selector = false; return new ast.Selector(sys, pattern); },
|
|
|
- peg$c27 = { type: "other", description: "Behavior Pattern" },
|
|
|
- peg$c28 = function(item) { return item; },
|
|
|
- peg$c29 = function(head, tail) {
|
|
|
- var body = [head].concat(tail);
|
|
|
- for (var i = 0; i < body.length; i++) {
|
|
|
- if (body[i].scope.max && body[i].scope.min > body[i].scope.max)
|
|
|
- ast.errors.push(err(2,` (${body[i].id})`));
|
|
|
- }
|
|
|
- return new ast.Alternation(body);
|
|
|
- },
|
|
|
- peg$c30 = function(body) {
|
|
|
- for (var i = 0; i < body.length; i++) {
|
|
|
- if (body[i].scope.max && body[i].scope.min > body[i].scope.max)
|
|
|
- ast.errors.push(err(2,` (${body[i].id})`));
|
|
|
- }
|
|
|
- return new ast.Sequence(body);
|
|
|
- },
|
|
|
- peg$c31 = function(i, q) { return scopify(i, q); },
|
|
|
- peg$c32 = function(i, q) { if (ast.localrefs.indexOf(i.id) === -1 && !ast.selector) { ast.localrefs.push(i.id); } return scopify(i, q); },
|
|
|
- peg$c33 = { type: "other", description: "Group" },
|
|
|
- peg$c34 = "(",
|
|
|
- peg$c35 = { type: "literal", value: "(", description: "\"(\"" },
|
|
|
- peg$c36 = ")",
|
|
|
- peg$c37 = { type: "literal", value: ")", description: "\")\"" },
|
|
|
- peg$c38 = function(async, body) { return new ast.Group(async, body); },
|
|
|
- peg$c39 = { type: "other", description: "Quantifier" },
|
|
|
- peg$c40 = "+",
|
|
|
- peg$c41 = { type: "literal", value: "+", description: "\"+\"" },
|
|
|
- peg$c42 = function() { return {min:1, max:null}; },
|
|
|
- peg$c43 = "*",
|
|
|
- peg$c44 = { type: "literal", value: "*", description: "\"*\"" },
|
|
|
- peg$c45 = function() { return {min:0, max:null}; },
|
|
|
- peg$c46 = "?",
|
|
|
- peg$c47 = { type: "literal", value: "?", description: "\"?\"" },
|
|
|
- peg$c48 = function() { return {min:0, max:1}; },
|
|
|
- peg$c49 = function(u, v) { return {u:u, v:v}; },
|
|
|
- peg$c50 = function(lo, hi) { return minmaxify(lo, hi); },
|
|
|
- peg$c51 = { type: "other", description: "Trigger" },
|
|
|
- peg$c52 = function(selector, body) { return new ast.Trigger(selector, body); },
|
|
|
- peg$c53 = { type: "other", description: "Init Block" },
|
|
|
- peg$c54 = function(system, body) { return new ast.Init(system, body); },
|
|
|
- peg$c55 = /^[^{}]/,
|
|
|
- peg$c56 = { type: "class", value: "[^{}]", description: "[^{}]" },
|
|
|
- peg$c57 = function() { return text().trim(); },
|
|
|
- peg$c58 = function(id) { return id; },
|
|
|
- peg$c59 = function(id) {
|
|
|
- if (!ast.selector) {
|
|
|
- if (id === ast.toplevelname) {
|
|
|
- ast.errors.push(err(3, ` (${id})`));
|
|
|
- ast.toplevelname = null;
|
|
|
- } else ast.references.push(id);
|
|
|
- }
|
|
|
- return { type: "Behavior", id:id };
|
|
|
- },
|
|
|
- peg$c60 = "SYSTEM",
|
|
|
- peg$c61 = { type: "literal", value: "SYSTEM", description: "\"SYSTEM\"" },
|
|
|
- peg$c62 = "BEHAVIOR",
|
|
|
- peg$c63 = { type: "literal", value: "BEHAVIOR", description: "\"BEHAVIOR\"" },
|
|
|
- peg$c64 = "INTERACTION",
|
|
|
- peg$c65 = { type: "literal", value: "INTERACTION", description: "\"INTERACTION\"" },
|
|
|
- peg$c66 = "WHEN",
|
|
|
- peg$c67 = { type: "literal", value: "WHEN", description: "\"WHEN\"" },
|
|
|
- peg$c68 = "INIT",
|
|
|
- peg$c69 = { type: "literal", value: "INIT", description: "\"INIT\"" },
|
|
|
- peg$c70 = "ASYNC",
|
|
|
- peg$c71 = { type: "literal", value: "ASYNC", description: "\"ASYNC\"" },
|
|
|
- peg$c72 = "->",
|
|
|
- peg$c73 = { type: "literal", value: "->", description: "\"->\"" },
|
|
|
- peg$c74 = function() { return "Then"; },
|
|
|
- peg$c75 = "==",
|
|
|
- peg$c76 = { type: "literal", value: "==", description: "\"==\"" },
|
|
|
- peg$c77 = function() { return "Join"; },
|
|
|
- peg$c78 = "=",
|
|
|
- peg$c79 = { type: "literal", value: "=", description: "\"=\"" },
|
|
|
- peg$c80 = ",",
|
|
|
- peg$c81 = { type: "literal", value: ",", description: "\",\"" },
|
|
|
- peg$c82 = "|",
|
|
|
- peg$c83 = { type: "literal", value: "|", description: "\"|\"" },
|
|
|
- peg$c84 = ";",
|
|
|
- peg$c85 = { type: "literal", value: ";", description: "\";\"" },
|
|
|
- peg$c86 = { type: "other", description: "Identifier" },
|
|
|
- peg$c87 = /^[A-Za-z]/,
|
|
|
- peg$c88 = { type: "class", value: "[A-Za-z]", description: "[A-Za-z]" },
|
|
|
- peg$c89 = /^[a-zA-Z0-9_]/,
|
|
|
- peg$c90 = { type: "class", value: "[a-zA-Z0-9_]", description: "[a-zA-Z0-9_]" },
|
|
|
- peg$c91 = function() { return text(); },
|
|
|
- peg$c92 = { type: "other", description: "Integer" },
|
|
|
- peg$c93 = /^[0-9]/,
|
|
|
- peg$c94 = { type: "class", value: "[0-9]", description: "[0-9]" },
|
|
|
- peg$c95 = function() { return parseInt(text()); },
|
|
|
- peg$c96 = { type: "other", description: "Integer > 0" },
|
|
|
- peg$c97 = /^[1-9]/,
|
|
|
- peg$c98 = { type: "class", value: "[1-9]", description: "[1-9]" },
|
|
|
- peg$c99 = { type: "other", description: "Integer >= 0" },
|
|
|
- peg$c100 = "0",
|
|
|
- peg$c101 = { type: "literal", value: "0", description: "\"0\"" },
|
|
|
- peg$c102 = function() { return 0; },
|
|
|
- peg$c103 = { type: "other", description: "Optional Whitespace" },
|
|
|
- peg$c104 = /^[ \t\n\r]/,
|
|
|
- peg$c105 = { type: "class", value: "[ \\t\\n\\r]", description: "[ \\t\\n\\r]" },
|
|
|
- peg$c106 = function() { return null; },
|
|
|
- peg$c107 = { type: "other", description: "Required Whitespace" },
|
|
|
- peg$c108 = { type: "other", description: "Newline" },
|
|
|
- peg$c109 = /^[\n]/,
|
|
|
- peg$c110 = { type: "class", value: "[\\n]", description: "[\\n]" },
|
|
|
- peg$c111 = { type: "other", description: "Comment Line" },
|
|
|
- peg$c112 = "//",
|
|
|
- peg$c113 = { type: "literal", value: "//", description: "\"//\"" },
|
|
|
- peg$c114 = /^[^\n]/,
|
|
|
- peg$c115 = { type: "class", value: "[^\\n]", description: "[^\\n]" },
|
|
|
- peg$c116 = function(c) { return new ast.Comment(false, c.join("")); },
|
|
|
- peg$c117 = { type: "other", description: "Comment Block" },
|
|
|
- peg$c118 = "/*",
|
|
|
- peg$c119 = { type: "literal", value: "/*", description: "\"/*\"" },
|
|
|
- peg$c120 = "*/",
|
|
|
- peg$c121 = { type: "literal", value: "*/", description: "\"*/\"" },
|
|
|
- peg$c122 = { type: "any", description: "any character" },
|
|
|
- peg$c123 = function(c) {return c},
|
|
|
- peg$c124 = function(c) { return new ast.Comment(true, c.join("")); },
|
|
|
-
|
|
|
- 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;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (peg$cachedPos !== pos) {
|
|
|
- if (peg$cachedPos > pos) {
|
|
|
- peg$cachedPos = 0;
|
|
|
- peg$cachedPosDetails = { line: 1, column: 1, seenCR: false };
|
|
|
- }
|
|
|
- advance(peg$cachedPosDetails, peg$cachedPos, pos);
|
|
|
- peg$cachedPos = pos;
|
|
|
- }
|
|
|
-
|
|
|
- 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++;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- 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); });
|
|
|
- }
|
|
|
-
|
|
|
- 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.";
|
|
|
- }
|
|
|
-
|
|
|
- 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$parsestatement();
|
|
|
- while (s2 !== peg$FAILED) {
|
|
|
- s1.push(s2);
|
|
|
- s2 = peg$parsestatement();
|
|
|
- }
|
|
|
- if (s1 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s0;
|
|
|
- s1 = peg$c1(s1);
|
|
|
- }
|
|
|
- s0 = s1;
|
|
|
-
|
|
|
- return s0;
|
|
|
- }
|
|
|
-
|
|
|
- function peg$parsestatement() {
|
|
|
- var s0, s1, s2;
|
|
|
-
|
|
|
- s0 = peg$currPos;
|
|
|
- s1 = peg$parsesystem_statement();
|
|
|
- if (s1 === peg$FAILED) {
|
|
|
- s1 = peg$parsebehavior_statement();
|
|
|
- if (s1 === peg$FAILED) {
|
|
|
- s1 = peg$parseinteraction_statement();
|
|
|
- if (s1 === peg$FAILED) {
|
|
|
- s1 = peg$parsetrigger();
|
|
|
- if (s1 === peg$FAILED) {
|
|
|
- s1 = peg$parseinit();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if (s1 !== peg$FAILED) {
|
|
|
- s2 = peg$parse_SEMI_();
|
|
|
- if (s2 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s0;
|
|
|
- s1 = peg$c3(s1);
|
|
|
- s0 = s1;
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
-
|
|
|
- return s0;
|
|
|
- }
|
|
|
-
|
|
|
- function peg$parsesystem_statement() {
|
|
|
- var s0, s1, s2, s3, s4, s5, s6;
|
|
|
-
|
|
|
- peg$silentFails++;
|
|
|
- s0 = peg$currPos;
|
|
|
- s1 = peg$parse_SYSTEM_();
|
|
|
- if (s1 !== peg$FAILED) {
|
|
|
- s2 = peg$parse_COLON_();
|
|
|
- if (s2 !== peg$FAILED) {
|
|
|
- s3 = peg$parsesystem_id();
|
|
|
- if (s3 !== peg$FAILED) {
|
|
|
- peg$reportedPos = peg$currPos;
|
|
|
- s4 = peg$c5(s3);
|
|
|
- if (s4) {
|
|
|
- s4 = peg$c2;
|
|
|
- } else {
|
|
|
- s4 = peg$c6;
|
|
|
- }
|
|
|
- if (s4 !== peg$FAILED) {
|
|
|
- s5 = peg$parse_EQ_();
|
|
|
- if (s5 !== peg$FAILED) {
|
|
|
- s6 = peg$parsebehavior_pattern();
|
|
|
- if (s6 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s0;
|
|
|
- s1 = peg$c7(s3, s6);
|
|
|
- s0 = s1;
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- peg$silentFails--;
|
|
|
- if (s0 === peg$FAILED) {
|
|
|
- s1 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c4); }
|
|
|
- }
|
|
|
-
|
|
|
- return s0;
|
|
|
- }
|
|
|
-
|
|
|
- function peg$parsebehavior_statement() {
|
|
|
- var s0, s1, s2, s3, s4, s5, s6;
|
|
|
-
|
|
|
- peg$silentFails++;
|
|
|
- s0 = peg$currPos;
|
|
|
- s1 = peg$parse_BEHAVIOR_();
|
|
|
- if (s1 !== peg$FAILED) {
|
|
|
- s2 = peg$parse_COLON_();
|
|
|
- if (s2 !== peg$FAILED) {
|
|
|
- s3 = peg$parsebehavior_id();
|
|
|
- if (s3 !== peg$FAILED) {
|
|
|
- peg$reportedPos = peg$currPos;
|
|
|
- s4 = peg$c5(s3);
|
|
|
- if (s4) {
|
|
|
- s4 = peg$c2;
|
|
|
- } else {
|
|
|
- s4 = peg$c6;
|
|
|
- }
|
|
|
- if (s4 !== peg$FAILED) {
|
|
|
- s5 = peg$parse_EQ_();
|
|
|
- if (s5 !== peg$FAILED) {
|
|
|
- s6 = peg$parsebehavior_pattern();
|
|
|
- if (s6 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s0;
|
|
|
- s1 = peg$c9(s3, s6);
|
|
|
- s0 = s1;
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- peg$silentFails--;
|
|
|
- if (s0 === peg$FAILED) {
|
|
|
- s1 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c8); }
|
|
|
- }
|
|
|
-
|
|
|
- return s0;
|
|
|
- }
|
|
|
-
|
|
|
- function peg$parseinteraction_statement() {
|
|
|
- var s0, s1, s2, s3;
|
|
|
-
|
|
|
- peg$silentFails++;
|
|
|
- s0 = peg$currPos;
|
|
|
- s1 = peg$parse_INTERACTION_();
|
|
|
- if (s1 !== peg$FAILED) {
|
|
|
- s2 = peg$parse_COLON_();
|
|
|
- if (s2 !== peg$FAILED) {
|
|
|
- s3 = peg$parseinteraction_body();
|
|
|
- if (s3 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s0;
|
|
|
- s1 = peg$c11(s3);
|
|
|
- s0 = s1;
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- peg$silentFails--;
|
|
|
- if (s0 === peg$FAILED) {
|
|
|
- s1 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c10); }
|
|
|
- }
|
|
|
-
|
|
|
- return s0;
|
|
|
- }
|
|
|
-
|
|
|
- function peg$parseinteraction_body() {
|
|
|
- var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11;
|
|
|
-
|
|
|
- s0 = peg$currPos;
|
|
|
- s1 = peg$parseselector_pattern();
|
|
|
- if (s1 !== peg$FAILED) {
|
|
|
- s2 = peg$parse_();
|
|
|
- if (s2 !== peg$FAILED) {
|
|
|
- s3 = peg$parseTHEN();
|
|
|
- if (s3 !== peg$FAILED) {
|
|
|
- s4 = peg$parse_();
|
|
|
- if (s4 !== peg$FAILED) {
|
|
|
- s5 = peg$parseselector_pattern();
|
|
|
- if (s5 !== peg$FAILED) {
|
|
|
- s6 = [];
|
|
|
- s7 = peg$currPos;
|
|
|
- s8 = peg$parse_();
|
|
|
- if (s8 !== peg$FAILED) {
|
|
|
- s9 = peg$parseTHEN();
|
|
|
- if (s9 !== peg$FAILED) {
|
|
|
- s10 = peg$parse_();
|
|
|
- if (s10 !== peg$FAILED) {
|
|
|
- s11 = peg$parseselector_pattern();
|
|
|
- if (s11 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s7;
|
|
|
- s8 = peg$c12(s11);
|
|
|
- s7 = s8;
|
|
|
- } else {
|
|
|
- peg$currPos = s7;
|
|
|
- s7 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s7;
|
|
|
- s7 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s7;
|
|
|
- s7 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s7;
|
|
|
- s7 = peg$c2;
|
|
|
- }
|
|
|
- while (s7 !== peg$FAILED) {
|
|
|
- s6.push(s7);
|
|
|
- s7 = peg$currPos;
|
|
|
- s8 = peg$parse_();
|
|
|
- if (s8 !== peg$FAILED) {
|
|
|
- s9 = peg$parseTHEN();
|
|
|
- if (s9 !== peg$FAILED) {
|
|
|
- s10 = peg$parse_();
|
|
|
- if (s10 !== peg$FAILED) {
|
|
|
- s11 = peg$parseselector_pattern();
|
|
|
- if (s11 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s7;
|
|
|
- s8 = peg$c12(s11);
|
|
|
- s7 = s8;
|
|
|
- } else {
|
|
|
- peg$currPos = s7;
|
|
|
- s7 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s7;
|
|
|
- s7 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s7;
|
|
|
- s7 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s7;
|
|
|
- s7 = peg$c2;
|
|
|
- }
|
|
|
- }
|
|
|
- if (s6 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s0;
|
|
|
- s1 = peg$c13(s1, s3, s5, s6);
|
|
|
- s0 = s1;
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- if (s0 === peg$FAILED) {
|
|
|
- s0 = peg$currPos;
|
|
|
- s1 = peg$parseselector_pattern_sans();
|
|
|
- if (s1 !== peg$FAILED) {
|
|
|
- s2 = peg$parse_();
|
|
|
- if (s2 !== peg$FAILED) {
|
|
|
- s3 = peg$parseJOIN();
|
|
|
- if (s3 !== peg$FAILED) {
|
|
|
- s4 = peg$parse_();
|
|
|
- if (s4 !== peg$FAILED) {
|
|
|
- s5 = peg$parseselector_pattern_sans();
|
|
|
- if (s5 !== peg$FAILED) {
|
|
|
- s6 = [];
|
|
|
- s7 = peg$currPos;
|
|
|
- s8 = peg$parse_();
|
|
|
- if (s8 !== peg$FAILED) {
|
|
|
- s9 = peg$parseJOIN();
|
|
|
- if (s9 !== peg$FAILED) {
|
|
|
- s10 = peg$parse_();
|
|
|
- if (s10 !== peg$FAILED) {
|
|
|
- s11 = peg$parseselector_pattern_sans();
|
|
|
- if (s11 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s7;
|
|
|
- s8 = peg$c12(s11);
|
|
|
- s7 = s8;
|
|
|
- } else {
|
|
|
- peg$currPos = s7;
|
|
|
- s7 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s7;
|
|
|
- s7 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s7;
|
|
|
- s7 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s7;
|
|
|
- s7 = peg$c2;
|
|
|
- }
|
|
|
- while (s7 !== peg$FAILED) {
|
|
|
- s6.push(s7);
|
|
|
- s7 = peg$currPos;
|
|
|
- s8 = peg$parse_();
|
|
|
- if (s8 !== peg$FAILED) {
|
|
|
- s9 = peg$parseJOIN();
|
|
|
- if (s9 !== peg$FAILED) {
|
|
|
- s10 = peg$parse_();
|
|
|
- if (s10 !== peg$FAILED) {
|
|
|
- s11 = peg$parseselector_pattern_sans();
|
|
|
- if (s11 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s7;
|
|
|
- s8 = peg$c12(s11);
|
|
|
- s7 = s8;
|
|
|
- } else {
|
|
|
- peg$currPos = s7;
|
|
|
- s7 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s7;
|
|
|
- s7 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s7;
|
|
|
- s7 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s7;
|
|
|
- s7 = peg$c2;
|
|
|
- }
|
|
|
- }
|
|
|
- if (s6 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s0;
|
|
|
- s1 = peg$c13(s1, s3, s5, s6);
|
|
|
- s0 = s1;
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return s0;
|
|
|
- }
|
|
|
-
|
|
|
- function peg$parseinteraction_type() {
|
|
|
- var s0, s1, s2, s3;
|
|
|
-
|
|
|
- s0 = peg$currPos;
|
|
|
- s1 = peg$parse_();
|
|
|
- if (s1 !== peg$FAILED) {
|
|
|
- s2 = peg$parseTHEN();
|
|
|
- if (s2 === peg$FAILED) {
|
|
|
- s2 = peg$parseJOIN();
|
|
|
- }
|
|
|
- if (s2 !== peg$FAILED) {
|
|
|
- s3 = peg$parse_();
|
|
|
- if (s3 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s0;
|
|
|
- s1 = peg$c14(s2);
|
|
|
- s0 = s1;
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
-
|
|
|
- return s0;
|
|
|
- }
|
|
|
-
|
|
|
- function peg$parseselector_pattern() {
|
|
|
- var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13;
|
|
|
-
|
|
|
- peg$silentFails++;
|
|
|
- s0 = peg$currPos;
|
|
|
- peg$reportedPos = peg$currPos;
|
|
|
- s1 = peg$c16();
|
|
|
- if (s1) {
|
|
|
- s1 = peg$c2;
|
|
|
- } else {
|
|
|
- s1 = peg$c6;
|
|
|
- }
|
|
|
- if (s1 !== peg$FAILED) {
|
|
|
- s2 = peg$parse_();
|
|
|
- if (s2 !== peg$FAILED) {
|
|
|
- s3 = peg$currPos;
|
|
|
- if (input.charCodeAt(peg$currPos) === 123) {
|
|
|
- s4 = peg$c18;
|
|
|
- peg$currPos++;
|
|
|
- } else {
|
|
|
- s4 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c19); }
|
|
|
- }
|
|
|
- if (s4 !== peg$FAILED) {
|
|
|
- s5 = peg$parsecode_block();
|
|
|
- if (s5 !== peg$FAILED) {
|
|
|
- if (input.charCodeAt(peg$currPos) === 125) {
|
|
|
- s6 = peg$c20;
|
|
|
- peg$currPos++;
|
|
|
- } else {
|
|
|
- s6 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c21); }
|
|
|
- }
|
|
|
- if (s6 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s3;
|
|
|
- s4 = peg$c22(s5);
|
|
|
- s3 = s4;
|
|
|
- } else {
|
|
|
- peg$currPos = s3;
|
|
|
- s3 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s3;
|
|
|
- s3 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s3;
|
|
|
- s3 = peg$c2;
|
|
|
- }
|
|
|
- if (s3 === peg$FAILED) {
|
|
|
- s3 = peg$c17;
|
|
|
- }
|
|
|
- if (s3 !== peg$FAILED) {
|
|
|
- s4 = peg$parse_();
|
|
|
- if (s4 !== peg$FAILED) {
|
|
|
- s5 = peg$parsesystem_id();
|
|
|
- if (s5 !== peg$FAILED) {
|
|
|
- if (input.charCodeAt(peg$currPos) === 58) {
|
|
|
- s6 = peg$c23;
|
|
|
- peg$currPos++;
|
|
|
- } else {
|
|
|
- s6 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c24); }
|
|
|
- }
|
|
|
- if (s6 !== peg$FAILED) {
|
|
|
- s7 = peg$parse_();
|
|
|
- if (s7 !== peg$FAILED) {
|
|
|
- s8 = peg$parsebehavior_pattern();
|
|
|
- if (s8 !== peg$FAILED) {
|
|
|
- s9 = peg$parse_();
|
|
|
- if (s9 !== peg$FAILED) {
|
|
|
- s10 = peg$currPos;
|
|
|
- if (input.charCodeAt(peg$currPos) === 123) {
|
|
|
- s11 = peg$c18;
|
|
|
- peg$currPos++;
|
|
|
- } else {
|
|
|
- s11 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c19); }
|
|
|
- }
|
|
|
- if (s11 !== peg$FAILED) {
|
|
|
- s12 = peg$parsecode_block();
|
|
|
- if (s12 !== peg$FAILED) {
|
|
|
- if (input.charCodeAt(peg$currPos) === 125) {
|
|
|
- s13 = peg$c20;
|
|
|
- peg$currPos++;
|
|
|
- } else {
|
|
|
- s13 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c21); }
|
|
|
- }
|
|
|
- if (s13 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s10;
|
|
|
- s11 = peg$c22(s12);
|
|
|
- s10 = s11;
|
|
|
- } else {
|
|
|
- peg$currPos = s10;
|
|
|
- s10 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s10;
|
|
|
- s10 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s10;
|
|
|
- s10 = peg$c2;
|
|
|
- }
|
|
|
- if (s10 === peg$FAILED) {
|
|
|
- s10 = peg$c17;
|
|
|
- }
|
|
|
- if (s10 !== peg$FAILED) {
|
|
|
- s11 = peg$parse_();
|
|
|
- if (s11 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s0;
|
|
|
- s1 = peg$c25(s3, s5, s8, s10);
|
|
|
- s0 = s1;
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- peg$silentFails--;
|
|
|
- if (s0 === peg$FAILED) {
|
|
|
- s1 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c15); }
|
|
|
- }
|
|
|
-
|
|
|
- return s0;
|
|
|
- }
|
|
|
-
|
|
|
- function peg$parseselector_pattern_sans() {
|
|
|
- var s0, s1, s2, s3, s4, s5, s6, s7;
|
|
|
-
|
|
|
- peg$silentFails++;
|
|
|
- s0 = peg$currPos;
|
|
|
- peg$reportedPos = peg$currPos;
|
|
|
- s1 = peg$c16();
|
|
|
- if (s1) {
|
|
|
- s1 = peg$c2;
|
|
|
- } else {
|
|
|
- s1 = peg$c6;
|
|
|
- }
|
|
|
- if (s1 !== peg$FAILED) {
|
|
|
- s2 = peg$parse_();
|
|
|
- if (s2 !== peg$FAILED) {
|
|
|
- s3 = peg$parsesystem_id();
|
|
|
- if (s3 !== peg$FAILED) {
|
|
|
- if (input.charCodeAt(peg$currPos) === 58) {
|
|
|
- s4 = peg$c23;
|
|
|
- peg$currPos++;
|
|
|
- } else {
|
|
|
- s4 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c24); }
|
|
|
- }
|
|
|
- if (s4 !== peg$FAILED) {
|
|
|
- s5 = peg$parse_();
|
|
|
- if (s5 !== peg$FAILED) {
|
|
|
- s6 = peg$parsebehavior_pattern();
|
|
|
- if (s6 !== peg$FAILED) {
|
|
|
- s7 = peg$parse_();
|
|
|
- if (s7 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s0;
|
|
|
- s1 = peg$c26(s3, s6);
|
|
|
- s0 = s1;
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- peg$silentFails--;
|
|
|
- if (s0 === peg$FAILED) {
|
|
|
- s1 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c15); }
|
|
|
- }
|
|
|
-
|
|
|
- return s0;
|
|
|
- }
|
|
|
-
|
|
|
- function peg$parsebehavior_pattern() {
|
|
|
- var s0, s1;
|
|
|
-
|
|
|
- peg$silentFails++;
|
|
|
- s0 = [];
|
|
|
- s1 = peg$parsealternation();
|
|
|
- if (s1 === peg$FAILED) {
|
|
|
- s1 = peg$parsesequence();
|
|
|
- }
|
|
|
- if (s1 !== peg$FAILED) {
|
|
|
- while (s1 !== peg$FAILED) {
|
|
|
- s0.push(s1);
|
|
|
- s1 = peg$parsealternation();
|
|
|
- if (s1 === peg$FAILED) {
|
|
|
- s1 = peg$parsesequence();
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- peg$silentFails--;
|
|
|
- if (s0 === peg$FAILED) {
|
|
|
- s1 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c27); }
|
|
|
- }
|
|
|
-
|
|
|
- return s0;
|
|
|
- }
|
|
|
-
|
|
|
- function peg$parsealternation() {
|
|
|
- var s0, s1, s2, s3, s4, s5;
|
|
|
-
|
|
|
- s0 = peg$currPos;
|
|
|
- s1 = peg$parsepattern_element();
|
|
|
- if (s1 !== peg$FAILED) {
|
|
|
- s2 = [];
|
|
|
- s3 = peg$currPos;
|
|
|
- s4 = peg$parse_PIPE_();
|
|
|
- if (s4 !== peg$FAILED) {
|
|
|
- s5 = peg$parsepattern_element();
|
|
|
- if (s5 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s3;
|
|
|
- s4 = peg$c28(s5);
|
|
|
- s3 = s4;
|
|
|
- } else {
|
|
|
- peg$currPos = s3;
|
|
|
- s3 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s3;
|
|
|
- s3 = peg$c2;
|
|
|
- }
|
|
|
- if (s3 !== peg$FAILED) {
|
|
|
- while (s3 !== peg$FAILED) {
|
|
|
- s2.push(s3);
|
|
|
- s3 = peg$currPos;
|
|
|
- s4 = peg$parse_PIPE_();
|
|
|
- if (s4 !== peg$FAILED) {
|
|
|
- s5 = peg$parsepattern_element();
|
|
|
- if (s5 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s3;
|
|
|
- s4 = peg$c28(s5);
|
|
|
- s3 = s4;
|
|
|
- } else {
|
|
|
- peg$currPos = s3;
|
|
|
- s3 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s3;
|
|
|
- s3 = peg$c2;
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- s2 = peg$c2;
|
|
|
- }
|
|
|
- if (s2 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s0;
|
|
|
- s1 = peg$c29(s1, s2);
|
|
|
- s0 = s1;
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
-
|
|
|
- return s0;
|
|
|
- }
|
|
|
-
|
|
|
- function peg$parsesequence() {
|
|
|
- var s0, s1, s2;
|
|
|
-
|
|
|
- s0 = peg$currPos;
|
|
|
- s1 = [];
|
|
|
- s2 = peg$parsepattern_element();
|
|
|
- if (s2 !== peg$FAILED) {
|
|
|
- while (s2 !== peg$FAILED) {
|
|
|
- s1.push(s2);
|
|
|
- s2 = peg$parsepattern_element();
|
|
|
- }
|
|
|
- } else {
|
|
|
- s1 = peg$c2;
|
|
|
- }
|
|
|
- if (s1 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s0;
|
|
|
- s1 = peg$c30(s1);
|
|
|
- }
|
|
|
- s0 = s1;
|
|
|
-
|
|
|
- return s0;
|
|
|
- }
|
|
|
-
|
|
|
- function peg$parsepattern_element() {
|
|
|
- var s0, s1, s2, s3, s4;
|
|
|
-
|
|
|
- s0 = peg$currPos;
|
|
|
- s1 = peg$parse_();
|
|
|
- if (s1 !== peg$FAILED) {
|
|
|
- s2 = peg$parsegroup();
|
|
|
- if (s2 !== peg$FAILED) {
|
|
|
- s3 = peg$parsequantifier();
|
|
|
- if (s3 === peg$FAILED) {
|
|
|
- s3 = peg$c17;
|
|
|
- }
|
|
|
- if (s3 !== peg$FAILED) {
|
|
|
- s4 = peg$parse_();
|
|
|
- if (s4 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s0;
|
|
|
- s1 = peg$c31(s2, s3);
|
|
|
- s0 = s1;
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- if (s0 === peg$FAILED) {
|
|
|
- s0 = peg$currPos;
|
|
|
- s1 = peg$parse_();
|
|
|
- if (s1 !== peg$FAILED) {
|
|
|
- s2 = peg$parseevent_ref();
|
|
|
- if (s2 !== peg$FAILED) {
|
|
|
- s3 = peg$parsequantifier();
|
|
|
- if (s3 === peg$FAILED) {
|
|
|
- s3 = peg$c17;
|
|
|
- }
|
|
|
- if (s3 !== peg$FAILED) {
|
|
|
- s4 = peg$parse_();
|
|
|
- if (s4 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s0;
|
|
|
- s1 = peg$c32(s2, s3);
|
|
|
- s0 = s1;
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return s0;
|
|
|
- }
|
|
|
-
|
|
|
- function peg$parsegroup() {
|
|
|
- var s0, s1, s2, s3, s4, s5, s6, s7;
|
|
|
-
|
|
|
- peg$silentFails++;
|
|
|
- s0 = peg$currPos;
|
|
|
- s1 = peg$parse_();
|
|
|
- if (s1 !== peg$FAILED) {
|
|
|
- s2 = peg$parseASYNC();
|
|
|
- if (s2 === peg$FAILED) {
|
|
|
- s2 = peg$c17;
|
|
|
- }
|
|
|
- if (s2 !== peg$FAILED) {
|
|
|
- if (input.charCodeAt(peg$currPos) === 40) {
|
|
|
- s3 = peg$c34;
|
|
|
- peg$currPos++;
|
|
|
- } else {
|
|
|
- s3 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c35); }
|
|
|
- }
|
|
|
- if (s3 !== peg$FAILED) {
|
|
|
- s4 = peg$parse_();
|
|
|
- if (s4 !== peg$FAILED) {
|
|
|
- s5 = peg$parsebehavior_pattern();
|
|
|
- if (s5 !== peg$FAILED) {
|
|
|
- s6 = peg$parse_();
|
|
|
- if (s6 !== peg$FAILED) {
|
|
|
- if (input.charCodeAt(peg$currPos) === 41) {
|
|
|
- s7 = peg$c36;
|
|
|
- peg$currPos++;
|
|
|
- } else {
|
|
|
- s7 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c37); }
|
|
|
- }
|
|
|
- if (s7 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s0;
|
|
|
- s1 = peg$c38(s2, s5);
|
|
|
- s0 = s1;
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- peg$silentFails--;
|
|
|
- if (s0 === peg$FAILED) {
|
|
|
- s1 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c33); }
|
|
|
- }
|
|
|
-
|
|
|
- return s0;
|
|
|
- }
|
|
|
-
|
|
|
- function peg$parsequantifier() {
|
|
|
- var s0, s1, s2;
|
|
|
-
|
|
|
- peg$silentFails++;
|
|
|
- s0 = peg$currPos;
|
|
|
- if (input.charCodeAt(peg$currPos) === 43) {
|
|
|
- s1 = peg$c40;
|
|
|
- peg$currPos++;
|
|
|
- } else {
|
|
|
- s1 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c41); }
|
|
|
- }
|
|
|
- if (s1 !== peg$FAILED) {
|
|
|
- s2 = peg$parse_();
|
|
|
- if (s2 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s0;
|
|
|
- s1 = peg$c42();
|
|
|
- s0 = s1;
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- if (s0 === peg$FAILED) {
|
|
|
- s0 = peg$currPos;
|
|
|
- if (input.charCodeAt(peg$currPos) === 42) {
|
|
|
- s1 = peg$c43;
|
|
|
- peg$currPos++;
|
|
|
- } else {
|
|
|
- s1 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c44); }
|
|
|
- }
|
|
|
- if (s1 !== peg$FAILED) {
|
|
|
- s2 = peg$parse_();
|
|
|
- if (s2 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s0;
|
|
|
- s1 = peg$c45();
|
|
|
- s0 = s1;
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- if (s0 === peg$FAILED) {
|
|
|
- s0 = peg$currPos;
|
|
|
- if (input.charCodeAt(peg$currPos) === 63) {
|
|
|
- s1 = peg$c46;
|
|
|
- peg$currPos++;
|
|
|
- } else {
|
|
|
- s1 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c47); }
|
|
|
- }
|
|
|
- if (s1 !== peg$FAILED) {
|
|
|
- s2 = peg$parse_();
|
|
|
- if (s2 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s0;
|
|
|
- s1 = peg$c48();
|
|
|
- s0 = s1;
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- if (s0 === peg$FAILED) {
|
|
|
- s0 = peg$parsequantifier_range();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- peg$silentFails--;
|
|
|
- if (s0 === peg$FAILED) {
|
|
|
- s1 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c39); }
|
|
|
- }
|
|
|
-
|
|
|
- return s0;
|
|
|
- }
|
|
|
-
|
|
|
- function peg$parsequantifier_range() {
|
|
|
- var s0, s1, s2, s3, s4, s5, s6, s7;
|
|
|
-
|
|
|
- s0 = peg$currPos;
|
|
|
- if (input.charCodeAt(peg$currPos) === 123) {
|
|
|
- s1 = peg$c18;
|
|
|
- peg$currPos++;
|
|
|
- } else {
|
|
|
- s1 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c19); }
|
|
|
- }
|
|
|
- if (s1 !== peg$FAILED) {
|
|
|
- s2 = peg$parse_();
|
|
|
- if (s2 !== peg$FAILED) {
|
|
|
- s3 = peg$parseINT_GTE0();
|
|
|
- if (s3 !== peg$FAILED) {
|
|
|
- s4 = peg$currPos;
|
|
|
- s5 = peg$parse_COMMA_();
|
|
|
- if (s5 !== peg$FAILED) {
|
|
|
- s6 = peg$parseINT_GT0();
|
|
|
- if (s6 === peg$FAILED) {
|
|
|
- s6 = peg$c17;
|
|
|
- }
|
|
|
- if (s6 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s4;
|
|
|
- s5 = peg$c49(s5, s6);
|
|
|
- s4 = s5;
|
|
|
- } else {
|
|
|
- peg$currPos = s4;
|
|
|
- s4 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s4;
|
|
|
- s4 = peg$c2;
|
|
|
- }
|
|
|
- if (s4 === peg$FAILED) {
|
|
|
- s4 = peg$c17;
|
|
|
- }
|
|
|
- if (s4 !== peg$FAILED) {
|
|
|
- s5 = peg$parse_();
|
|
|
- if (s5 !== peg$FAILED) {
|
|
|
- if (input.charCodeAt(peg$currPos) === 125) {
|
|
|
- s6 = peg$c20;
|
|
|
- peg$currPos++;
|
|
|
- } else {
|
|
|
- s6 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c21); }
|
|
|
- }
|
|
|
- if (s6 !== peg$FAILED) {
|
|
|
- s7 = peg$parse_();
|
|
|
- if (s7 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s0;
|
|
|
- s1 = peg$c50(s3, s4);
|
|
|
- s0 = s1;
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
-
|
|
|
- return s0;
|
|
|
- }
|
|
|
-
|
|
|
- function peg$parsetrigger() {
|
|
|
- var s0, s1, s2, s3, s4, s5, s6;
|
|
|
-
|
|
|
- peg$silentFails++;
|
|
|
- s0 = peg$currPos;
|
|
|
- s1 = peg$parse_WHEN_();
|
|
|
- if (s1 !== peg$FAILED) {
|
|
|
- s2 = peg$parse_COLON_();
|
|
|
- if (s2 !== peg$FAILED) {
|
|
|
- s3 = peg$parseselector_pattern_sans();
|
|
|
- if (s3 !== peg$FAILED) {
|
|
|
- if (input.charCodeAt(peg$currPos) === 123) {
|
|
|
- s4 = peg$c18;
|
|
|
- peg$currPos++;
|
|
|
- } else {
|
|
|
- s4 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c19); }
|
|
|
- }
|
|
|
- if (s4 !== peg$FAILED) {
|
|
|
- s5 = peg$parsecode_block();
|
|
|
- if (s5 !== peg$FAILED) {
|
|
|
- if (input.charCodeAt(peg$currPos) === 125) {
|
|
|
- s6 = peg$c20;
|
|
|
- peg$currPos++;
|
|
|
- } else {
|
|
|
- s6 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c21); }
|
|
|
- }
|
|
|
- if (s6 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s0;
|
|
|
- s1 = peg$c52(s3, s5);
|
|
|
- s0 = s1;
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- peg$silentFails--;
|
|
|
- if (s0 === peg$FAILED) {
|
|
|
- s1 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c51); }
|
|
|
- }
|
|
|
-
|
|
|
- return s0;
|
|
|
- }
|
|
|
-
|
|
|
- function peg$parseinit() {
|
|
|
- var s0, s1, s2, s3, s4, s5, s6, s7;
|
|
|
-
|
|
|
- peg$silentFails++;
|
|
|
- s0 = peg$currPos;
|
|
|
- s1 = peg$parse_INIT_();
|
|
|
- if (s1 !== peg$FAILED) {
|
|
|
- s2 = peg$parse_COLON_();
|
|
|
- if (s2 !== peg$FAILED) {
|
|
|
- s3 = peg$parsesystem_id();
|
|
|
- if (s3 === peg$FAILED) {
|
|
|
- s3 = peg$c17;
|
|
|
- }
|
|
|
- if (s3 !== peg$FAILED) {
|
|
|
- s4 = peg$parse_();
|
|
|
- if (s4 !== peg$FAILED) {
|
|
|
- if (input.charCodeAt(peg$currPos) === 123) {
|
|
|
- s5 = peg$c18;
|
|
|
- peg$currPos++;
|
|
|
- } else {
|
|
|
- s5 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c19); }
|
|
|
- }
|
|
|
- if (s5 !== peg$FAILED) {
|
|
|
- s6 = peg$parsecode_block();
|
|
|
- if (s6 !== peg$FAILED) {
|
|
|
- if (input.charCodeAt(peg$currPos) === 125) {
|
|
|
- s7 = peg$c20;
|
|
|
- peg$currPos++;
|
|
|
- } else {
|
|
|
- s7 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c21); }
|
|
|
- }
|
|
|
- if (s7 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s0;
|
|
|
- s1 = peg$c54(s3, s6);
|
|
|
- s0 = s1;
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- peg$silentFails--;
|
|
|
- if (s0 === peg$FAILED) {
|
|
|
- s1 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c53); }
|
|
|
- }
|
|
|
-
|
|
|
- return s0;
|
|
|
- }
|
|
|
-
|
|
|
- function peg$parsecode_block() {
|
|
|
- var s0, s1, s2, s3, s4, s5;
|
|
|
-
|
|
|
- s0 = peg$currPos;
|
|
|
- s1 = [];
|
|
|
- if (peg$c55.test(input.charAt(peg$currPos))) {
|
|
|
- s2 = input.charAt(peg$currPos);
|
|
|
- peg$currPos++;
|
|
|
- } else {
|
|
|
- s2 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c56); }
|
|
|
- }
|
|
|
- while (s2 !== peg$FAILED) {
|
|
|
- s1.push(s2);
|
|
|
- if (peg$c55.test(input.charAt(peg$currPos))) {
|
|
|
- s2 = input.charAt(peg$currPos);
|
|
|
- peg$currPos++;
|
|
|
- } else {
|
|
|
- s2 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c56); }
|
|
|
- }
|
|
|
- }
|
|
|
- if (s1 !== peg$FAILED) {
|
|
|
- s2 = peg$currPos;
|
|
|
- if (input.charCodeAt(peg$currPos) === 123) {
|
|
|
- s3 = peg$c18;
|
|
|
- peg$currPos++;
|
|
|
- } else {
|
|
|
- s3 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c19); }
|
|
|
- }
|
|
|
- if (s3 !== peg$FAILED) {
|
|
|
- s4 = peg$parsecode_block();
|
|
|
- if (s4 !== peg$FAILED) {
|
|
|
- if (input.charCodeAt(peg$currPos) === 125) {
|
|
|
- s5 = peg$c20;
|
|
|
- peg$currPos++;
|
|
|
- } else {
|
|
|
- s5 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c21); }
|
|
|
- }
|
|
|
- if (s5 !== peg$FAILED) {
|
|
|
- s3 = [s3, s4, s5];
|
|
|
- s2 = s3;
|
|
|
- } else {
|
|
|
- peg$currPos = s2;
|
|
|
- s2 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s2;
|
|
|
- s2 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s2;
|
|
|
- s2 = peg$c2;
|
|
|
- }
|
|
|
- if (s2 === peg$FAILED) {
|
|
|
- s2 = peg$c17;
|
|
|
- }
|
|
|
- if (s2 !== peg$FAILED) {
|
|
|
- s3 = [];
|
|
|
- if (peg$c55.test(input.charAt(peg$currPos))) {
|
|
|
- s4 = input.charAt(peg$currPos);
|
|
|
- peg$currPos++;
|
|
|
- } else {
|
|
|
- s4 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c56); }
|
|
|
- }
|
|
|
- while (s4 !== peg$FAILED) {
|
|
|
- s3.push(s4);
|
|
|
- if (peg$c55.test(input.charAt(peg$currPos))) {
|
|
|
- s4 = input.charAt(peg$currPos);
|
|
|
- peg$currPos++;
|
|
|
- } else {
|
|
|
- s4 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c56); }
|
|
|
- }
|
|
|
- }
|
|
|
- if (s3 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s0;
|
|
|
- s1 = peg$c57();
|
|
|
- s0 = s1;
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
-
|
|
|
- return s0;
|
|
|
- }
|
|
|
-
|
|
|
- function peg$parsebehavior_id() {
|
|
|
- var s0, s1;
|
|
|
-
|
|
|
- s0 = peg$currPos;
|
|
|
- s1 = peg$parseID();
|
|
|
- if (s1 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s0;
|
|
|
- s1 = peg$c58(s1);
|
|
|
- }
|
|
|
- s0 = s1;
|
|
|
-
|
|
|
- return s0;
|
|
|
- }
|
|
|
-
|
|
|
- function peg$parsesystem_id() {
|
|
|
- var s0, s1;
|
|
|
-
|
|
|
- s0 = peg$currPos;
|
|
|
- s1 = peg$parseID();
|
|
|
- if (s1 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s0;
|
|
|
- s1 = peg$c58(s1);
|
|
|
- }
|
|
|
- s0 = s1;
|
|
|
-
|
|
|
- return s0;
|
|
|
- }
|
|
|
-
|
|
|
- function peg$parseevent_ref() {
|
|
|
- var s0, s1;
|
|
|
-
|
|
|
- s0 = peg$currPos;
|
|
|
- s1 = peg$parseID();
|
|
|
- if (s1 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s0;
|
|
|
- s1 = peg$c59(s1);
|
|
|
- }
|
|
|
- s0 = s1;
|
|
|
-
|
|
|
- return s0;
|
|
|
- }
|
|
|
-
|
|
|
- function peg$parseKEYWORD() {
|
|
|
- var s0;
|
|
|
-
|
|
|
- s0 = peg$parseSYSTEM();
|
|
|
- if (s0 === peg$FAILED) {
|
|
|
- s0 = peg$parseBEHAVIOR();
|
|
|
- if (s0 === peg$FAILED) {
|
|
|
- s0 = peg$parseINTERACTION();
|
|
|
- if (s0 === peg$FAILED) {
|
|
|
- s0 = peg$parseASYNC();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return s0;
|
|
|
- }
|
|
|
-
|
|
|
- function peg$parseSYSTEM() {
|
|
|
- var s0, s1;
|
|
|
-
|
|
|
- s0 = peg$currPos;
|
|
|
- if (input.substr(peg$currPos, 6) === peg$c60) {
|
|
|
- s1 = peg$c60;
|
|
|
- peg$currPos += 6;
|
|
|
- } else {
|
|
|
- s1 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c61); }
|
|
|
- }
|
|
|
- if (s1 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s0;
|
|
|
- s1 = peg$c14(s1);
|
|
|
- }
|
|
|
- s0 = s1;
|
|
|
-
|
|
|
- return s0;
|
|
|
- }
|
|
|
-
|
|
|
- function peg$parseBEHAVIOR() {
|
|
|
- var s0, s1;
|
|
|
-
|
|
|
- s0 = peg$currPos;
|
|
|
- if (input.substr(peg$currPos, 8) === peg$c62) {
|
|
|
- s1 = peg$c62;
|
|
|
- peg$currPos += 8;
|
|
|
- } else {
|
|
|
- s1 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c63); }
|
|
|
- }
|
|
|
- if (s1 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s0;
|
|
|
- s1 = peg$c14(s1);
|
|
|
- }
|
|
|
- s0 = s1;
|
|
|
-
|
|
|
- return s0;
|
|
|
- }
|
|
|
-
|
|
|
- function peg$parseINTERACTION() {
|
|
|
- var s0, s1;
|
|
|
-
|
|
|
- s0 = peg$currPos;
|
|
|
- if (input.substr(peg$currPos, 11) === peg$c64) {
|
|
|
- s1 = peg$c64;
|
|
|
- peg$currPos += 11;
|
|
|
- } else {
|
|
|
- s1 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c65); }
|
|
|
- }
|
|
|
- if (s1 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s0;
|
|
|
- s1 = peg$c14(s1);
|
|
|
- }
|
|
|
- s0 = s1;
|
|
|
-
|
|
|
- return s0;
|
|
|
- }
|
|
|
-
|
|
|
- function peg$parseWHEN() {
|
|
|
- var s0, s1;
|
|
|
-
|
|
|
- s0 = peg$currPos;
|
|
|
- if (input.substr(peg$currPos, 4) === peg$c66) {
|
|
|
- s1 = peg$c66;
|
|
|
- peg$currPos += 4;
|
|
|
- } else {
|
|
|
- s1 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c67); }
|
|
|
- }
|
|
|
- if (s1 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s0;
|
|
|
- s1 = peg$c14(s1);
|
|
|
- }
|
|
|
- s0 = s1;
|
|
|
-
|
|
|
- return s0;
|
|
|
- }
|
|
|
-
|
|
|
- function peg$parseINIT() {
|
|
|
- var s0, s1;
|
|
|
-
|
|
|
- s0 = peg$currPos;
|
|
|
- if (input.substr(peg$currPos, 4) === peg$c68) {
|
|
|
- s1 = peg$c68;
|
|
|
- peg$currPos += 4;
|
|
|
- } else {
|
|
|
- s1 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c69); }
|
|
|
- }
|
|
|
- if (s1 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s0;
|
|
|
- s1 = peg$c14(s1);
|
|
|
- }
|
|
|
- s0 = s1;
|
|
|
-
|
|
|
- return s0;
|
|
|
- }
|
|
|
-
|
|
|
- function peg$parseASYNC() {
|
|
|
- var s0, s1;
|
|
|
-
|
|
|
- s0 = peg$currPos;
|
|
|
- if (input.substr(peg$currPos, 5) === peg$c70) {
|
|
|
- s1 = peg$c70;
|
|
|
- peg$currPos += 5;
|
|
|
- } else {
|
|
|
- s1 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c71); }
|
|
|
- }
|
|
|
- if (s1 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s0;
|
|
|
- s1 = peg$c14(s1);
|
|
|
- }
|
|
|
- s0 = s1;
|
|
|
-
|
|
|
- return s0;
|
|
|
- }
|
|
|
-
|
|
|
- function peg$parseTHEN() {
|
|
|
- var s0, s1;
|
|
|
-
|
|
|
- s0 = peg$currPos;
|
|
|
- if (input.substr(peg$currPos, 2) === peg$c72) {
|
|
|
- s1 = peg$c72;
|
|
|
- peg$currPos += 2;
|
|
|
- } else {
|
|
|
- s1 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c73); }
|
|
|
- }
|
|
|
- if (s1 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s0;
|
|
|
- s1 = peg$c74();
|
|
|
- }
|
|
|
- s0 = s1;
|
|
|
-
|
|
|
- return s0;
|
|
|
- }
|
|
|
-
|
|
|
- function peg$parseJOIN() {
|
|
|
- var s0, s1;
|
|
|
-
|
|
|
- s0 = peg$currPos;
|
|
|
- if (input.substr(peg$currPos, 2) === peg$c75) {
|
|
|
- s1 = peg$c75;
|
|
|
- peg$currPos += 2;
|
|
|
- } else {
|
|
|
- s1 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c76); }
|
|
|
- }
|
|
|
- if (s1 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s0;
|
|
|
- s1 = peg$c77();
|
|
|
- }
|
|
|
- s0 = s1;
|
|
|
-
|
|
|
- return s0;
|
|
|
- }
|
|
|
-
|
|
|
- function peg$parse_SYSTEM_() {
|
|
|
- var s0, s1, s2, s3;
|
|
|
-
|
|
|
- s0 = peg$currPos;
|
|
|
- s1 = peg$parse_();
|
|
|
- if (s1 !== peg$FAILED) {
|
|
|
- s2 = peg$parseSYSTEM();
|
|
|
- if (s2 !== peg$FAILED) {
|
|
|
- s3 = peg$parse_();
|
|
|
- if (s3 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s0;
|
|
|
- s1 = peg$c14(s2);
|
|
|
- s0 = s1;
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
-
|
|
|
- return s0;
|
|
|
- }
|
|
|
-
|
|
|
- function peg$parse_BEHAVIOR_() {
|
|
|
- var s0, s1, s2, s3;
|
|
|
-
|
|
|
- s0 = peg$currPos;
|
|
|
- s1 = peg$parse_();
|
|
|
- if (s1 !== peg$FAILED) {
|
|
|
- s2 = peg$parseBEHAVIOR();
|
|
|
- if (s2 !== peg$FAILED) {
|
|
|
- s3 = peg$parse_();
|
|
|
- if (s3 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s0;
|
|
|
- s1 = peg$c14(s2);
|
|
|
- s0 = s1;
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
-
|
|
|
- return s0;
|
|
|
- }
|
|
|
-
|
|
|
- function peg$parse_INTERACTION_() {
|
|
|
- var s0, s1, s2, s3;
|
|
|
-
|
|
|
- s0 = peg$currPos;
|
|
|
- s1 = peg$parse_();
|
|
|
- if (s1 !== peg$FAILED) {
|
|
|
- s2 = peg$parseINTERACTION();
|
|
|
- if (s2 !== peg$FAILED) {
|
|
|
- s3 = peg$parse_();
|
|
|
- if (s3 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s0;
|
|
|
- s1 = peg$c14(s2);
|
|
|
- s0 = s1;
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
-
|
|
|
- return s0;
|
|
|
- }
|
|
|
-
|
|
|
- function peg$parse_WHEN_() {
|
|
|
- var s0, s1, s2, s3;
|
|
|
-
|
|
|
- s0 = peg$currPos;
|
|
|
- s1 = peg$parse_();
|
|
|
- if (s1 !== peg$FAILED) {
|
|
|
- s2 = peg$parseWHEN();
|
|
|
- if (s2 !== peg$FAILED) {
|
|
|
- s3 = peg$parse_();
|
|
|
- if (s3 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s0;
|
|
|
- s1 = peg$c14(s2);
|
|
|
- s0 = s1;
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
-
|
|
|
- return s0;
|
|
|
- }
|
|
|
-
|
|
|
- function peg$parse_INIT_() {
|
|
|
- var s0, s1, s2, s3;
|
|
|
-
|
|
|
- s0 = peg$currPos;
|
|
|
- s1 = peg$parse_();
|
|
|
- if (s1 !== peg$FAILED) {
|
|
|
- s2 = peg$parseINIT();
|
|
|
- if (s2 !== peg$FAILED) {
|
|
|
- s3 = peg$parse_();
|
|
|
- if (s3 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s0;
|
|
|
- s1 = peg$c14(s2);
|
|
|
- s0 = s1;
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
-
|
|
|
- return s0;
|
|
|
- }
|
|
|
-
|
|
|
- function peg$parse_EQ_() {
|
|
|
- var s0, s1, s2, s3;
|
|
|
-
|
|
|
- s0 = peg$currPos;
|
|
|
- s1 = peg$parse_();
|
|
|
- if (s1 !== peg$FAILED) {
|
|
|
- if (input.charCodeAt(peg$currPos) === 61) {
|
|
|
- s2 = peg$c78;
|
|
|
- peg$currPos++;
|
|
|
- } else {
|
|
|
- s2 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c79); }
|
|
|
- }
|
|
|
- if (s2 !== peg$FAILED) {
|
|
|
- s3 = peg$parse_();
|
|
|
- if (s3 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s0;
|
|
|
- s1 = peg$c14(s2);
|
|
|
- s0 = s1;
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
-
|
|
|
- return s0;
|
|
|
- }
|
|
|
-
|
|
|
- function peg$parse_COMMA_() {
|
|
|
- var s0, s1, s2, s3;
|
|
|
-
|
|
|
- s0 = peg$currPos;
|
|
|
- s1 = peg$parse_();
|
|
|
- if (s1 !== peg$FAILED) {
|
|
|
- if (input.charCodeAt(peg$currPos) === 44) {
|
|
|
- s2 = peg$c80;
|
|
|
- peg$currPos++;
|
|
|
- } else {
|
|
|
- s2 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c81); }
|
|
|
- }
|
|
|
- if (s2 !== peg$FAILED) {
|
|
|
- s3 = peg$parse_();
|
|
|
- if (s3 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s0;
|
|
|
- s1 = peg$c14(s2);
|
|
|
- s0 = s1;
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
-
|
|
|
- return s0;
|
|
|
- }
|
|
|
-
|
|
|
- function peg$parse_PIPE_() {
|
|
|
- var s0, s1, s2, s3;
|
|
|
-
|
|
|
- s0 = peg$currPos;
|
|
|
- s1 = peg$parse_();
|
|
|
- if (s1 !== peg$FAILED) {
|
|
|
- if (input.charCodeAt(peg$currPos) === 124) {
|
|
|
- s2 = peg$c82;
|
|
|
- peg$currPos++;
|
|
|
- } else {
|
|
|
- s2 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c83); }
|
|
|
- }
|
|
|
- if (s2 !== peg$FAILED) {
|
|
|
- s3 = peg$parse_();
|
|
|
- if (s3 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s0;
|
|
|
- s1 = peg$c14(s2);
|
|
|
- s0 = s1;
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
-
|
|
|
- return s0;
|
|
|
- }
|
|
|
-
|
|
|
- function peg$parse_COLON_() {
|
|
|
- var s0, s1, s2, s3;
|
|
|
-
|
|
|
- s0 = peg$currPos;
|
|
|
- s1 = peg$parse_();
|
|
|
- if (s1 !== peg$FAILED) {
|
|
|
- if (input.charCodeAt(peg$currPos) === 58) {
|
|
|
- s2 = peg$c23;
|
|
|
- peg$currPos++;
|
|
|
- } else {
|
|
|
- s2 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c24); }
|
|
|
- }
|
|
|
- if (s2 !== peg$FAILED) {
|
|
|
- s3 = peg$parse_();
|
|
|
- if (s3 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s0;
|
|
|
- s1 = peg$c14(s2);
|
|
|
- s0 = s1;
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
-
|
|
|
- return s0;
|
|
|
- }
|
|
|
-
|
|
|
- function peg$parse_SEMI_() {
|
|
|
- var s0, s1, s2, s3;
|
|
|
-
|
|
|
- s0 = peg$currPos;
|
|
|
- s1 = peg$parse_();
|
|
|
- if (s1 !== peg$FAILED) {
|
|
|
- if (input.charCodeAt(peg$currPos) === 59) {
|
|
|
- s2 = peg$c84;
|
|
|
- peg$currPos++;
|
|
|
- } else {
|
|
|
- s2 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c85); }
|
|
|
- }
|
|
|
- if (s2 !== peg$FAILED) {
|
|
|
- s3 = peg$parse_();
|
|
|
- if (s3 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s0;
|
|
|
- s1 = peg$c14(s2);
|
|
|
- s0 = s1;
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
-
|
|
|
- return s0;
|
|
|
- }
|
|
|
-
|
|
|
- function peg$parseID() {
|
|
|
- var s0, s1, s2, s3, s4;
|
|
|
-
|
|
|
- peg$silentFails++;
|
|
|
- s0 = peg$currPos;
|
|
|
- s1 = peg$currPos;
|
|
|
- peg$silentFails++;
|
|
|
- s2 = peg$parseKEYWORD();
|
|
|
- peg$silentFails--;
|
|
|
- if (s2 === peg$FAILED) {
|
|
|
- s1 = peg$c6;
|
|
|
- } else {
|
|
|
- peg$currPos = s1;
|
|
|
- s1 = peg$c2;
|
|
|
- }
|
|
|
- if (s1 !== peg$FAILED) {
|
|
|
- if (peg$c87.test(input.charAt(peg$currPos))) {
|
|
|
- s2 = input.charAt(peg$currPos);
|
|
|
- peg$currPos++;
|
|
|
- } else {
|
|
|
- s2 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c88); }
|
|
|
- }
|
|
|
- if (s2 !== peg$FAILED) {
|
|
|
- s3 = [];
|
|
|
- if (peg$c89.test(input.charAt(peg$currPos))) {
|
|
|
- s4 = input.charAt(peg$currPos);
|
|
|
- peg$currPos++;
|
|
|
- } else {
|
|
|
- s4 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c90); }
|
|
|
- }
|
|
|
- while (s4 !== peg$FAILED) {
|
|
|
- s3.push(s4);
|
|
|
- if (peg$c89.test(input.charAt(peg$currPos))) {
|
|
|
- s4 = input.charAt(peg$currPos);
|
|
|
- peg$currPos++;
|
|
|
- } else {
|
|
|
- s4 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c90); }
|
|
|
- }
|
|
|
- }
|
|
|
- if (s3 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s0;
|
|
|
- s1 = peg$c91();
|
|
|
- s0 = s1;
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- peg$silentFails--;
|
|
|
- if (s0 === peg$FAILED) {
|
|
|
- s1 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c86); }
|
|
|
- }
|
|
|
-
|
|
|
- return s0;
|
|
|
- }
|
|
|
-
|
|
|
- function peg$parseINT() {
|
|
|
- var s0, s1, s2;
|
|
|
-
|
|
|
- peg$silentFails++;
|
|
|
- s0 = peg$currPos;
|
|
|
- s1 = [];
|
|
|
- if (peg$c93.test(input.charAt(peg$currPos))) {
|
|
|
- s2 = input.charAt(peg$currPos);
|
|
|
- peg$currPos++;
|
|
|
- } else {
|
|
|
- s2 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c94); }
|
|
|
- }
|
|
|
- if (s2 !== peg$FAILED) {
|
|
|
- while (s2 !== peg$FAILED) {
|
|
|
- s1.push(s2);
|
|
|
- if (peg$c93.test(input.charAt(peg$currPos))) {
|
|
|
- s2 = input.charAt(peg$currPos);
|
|
|
- peg$currPos++;
|
|
|
- } else {
|
|
|
- s2 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c94); }
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- s1 = peg$c2;
|
|
|
- }
|
|
|
- if (s1 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s0;
|
|
|
- s1 = peg$c95();
|
|
|
- }
|
|
|
- s0 = s1;
|
|
|
- peg$silentFails--;
|
|
|
- if (s0 === peg$FAILED) {
|
|
|
- s1 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c92); }
|
|
|
- }
|
|
|
-
|
|
|
- return s0;
|
|
|
- }
|
|
|
-
|
|
|
- function peg$parseINT_GT0() {
|
|
|
- var s0, s1, s2, s3;
|
|
|
-
|
|
|
- peg$silentFails++;
|
|
|
- s0 = peg$currPos;
|
|
|
- if (peg$c97.test(input.charAt(peg$currPos))) {
|
|
|
- s1 = input.charAt(peg$currPos);
|
|
|
- peg$currPos++;
|
|
|
- } else {
|
|
|
- s1 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c98); }
|
|
|
- }
|
|
|
- if (s1 !== peg$FAILED) {
|
|
|
- s2 = [];
|
|
|
- if (peg$c93.test(input.charAt(peg$currPos))) {
|
|
|
- s3 = input.charAt(peg$currPos);
|
|
|
- peg$currPos++;
|
|
|
- } else {
|
|
|
- s3 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c94); }
|
|
|
- }
|
|
|
- while (s3 !== peg$FAILED) {
|
|
|
- s2.push(s3);
|
|
|
- if (peg$c93.test(input.charAt(peg$currPos))) {
|
|
|
- s3 = input.charAt(peg$currPos);
|
|
|
- peg$currPos++;
|
|
|
- } else {
|
|
|
- s3 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c94); }
|
|
|
- }
|
|
|
- }
|
|
|
- if (s2 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s0;
|
|
|
- s1 = peg$c95();
|
|
|
- s0 = s1;
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- peg$silentFails--;
|
|
|
- if (s0 === peg$FAILED) {
|
|
|
- s1 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c96); }
|
|
|
- }
|
|
|
-
|
|
|
- return s0;
|
|
|
- }
|
|
|
-
|
|
|
- function peg$parseINT_GTE0() {
|
|
|
- var s0, s1;
|
|
|
-
|
|
|
- peg$silentFails++;
|
|
|
- s0 = peg$currPos;
|
|
|
- if (input.charCodeAt(peg$currPos) === 48) {
|
|
|
- s1 = peg$c100;
|
|
|
- peg$currPos++;
|
|
|
- } else {
|
|
|
- s1 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c101); }
|
|
|
- }
|
|
|
- if (s1 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s0;
|
|
|
- s1 = peg$c102();
|
|
|
- }
|
|
|
- s0 = s1;
|
|
|
- if (s0 === peg$FAILED) {
|
|
|
- s0 = peg$parseINT_GT0();
|
|
|
- }
|
|
|
- peg$silentFails--;
|
|
|
- if (s0 === peg$FAILED) {
|
|
|
- s1 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c99); }
|
|
|
- }
|
|
|
-
|
|
|
- return s0;
|
|
|
- }
|
|
|
-
|
|
|
- function peg$parse_() {
|
|
|
- var s0, s1, s2;
|
|
|
-
|
|
|
- peg$silentFails++;
|
|
|
- s0 = peg$currPos;
|
|
|
- s1 = [];
|
|
|
- if (peg$c104.test(input.charAt(peg$currPos))) {
|
|
|
- s2 = input.charAt(peg$currPos);
|
|
|
- peg$currPos++;
|
|
|
- } else {
|
|
|
- s2 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c105); }
|
|
|
- }
|
|
|
- if (s2 === peg$FAILED) {
|
|
|
- s2 = peg$parseCOMMENT();
|
|
|
- }
|
|
|
- while (s2 !== peg$FAILED) {
|
|
|
- s1.push(s2);
|
|
|
- if (peg$c104.test(input.charAt(peg$currPos))) {
|
|
|
- s2 = input.charAt(peg$currPos);
|
|
|
- peg$currPos++;
|
|
|
- } else {
|
|
|
- s2 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c105); }
|
|
|
- }
|
|
|
- if (s2 === peg$FAILED) {
|
|
|
- s2 = peg$parseCOMMENT();
|
|
|
- }
|
|
|
- }
|
|
|
- if (s1 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s0;
|
|
|
- s1 = peg$c106();
|
|
|
- }
|
|
|
- s0 = s1;
|
|
|
- peg$silentFails--;
|
|
|
- if (s0 === peg$FAILED) {
|
|
|
- s1 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c103); }
|
|
|
- }
|
|
|
-
|
|
|
- return s0;
|
|
|
- }
|
|
|
-
|
|
|
- function peg$parse__() {
|
|
|
- var s0, s1, s2;
|
|
|
-
|
|
|
- peg$silentFails++;
|
|
|
- s0 = peg$currPos;
|
|
|
- if (peg$c104.test(input.charAt(peg$currPos))) {
|
|
|
- s1 = input.charAt(peg$currPos);
|
|
|
- peg$currPos++;
|
|
|
- } else {
|
|
|
- s1 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c105); }
|
|
|
- }
|
|
|
- if (s1 !== peg$FAILED) {
|
|
|
- s2 = peg$parse_();
|
|
|
- if (s2 === peg$FAILED) {
|
|
|
- s2 = peg$c17;
|
|
|
- }
|
|
|
- if (s2 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s0;
|
|
|
- s1 = peg$c106();
|
|
|
- s0 = s1;
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- peg$silentFails--;
|
|
|
- if (s0 === peg$FAILED) {
|
|
|
- s1 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c107); }
|
|
|
- }
|
|
|
-
|
|
|
- return s0;
|
|
|
- }
|
|
|
-
|
|
|
- function peg$parseNL() {
|
|
|
- var s0, s1;
|
|
|
-
|
|
|
- peg$silentFails++;
|
|
|
- s0 = peg$currPos;
|
|
|
- if (peg$c109.test(input.charAt(peg$currPos))) {
|
|
|
- s1 = input.charAt(peg$currPos);
|
|
|
- peg$currPos++;
|
|
|
- } else {
|
|
|
- s1 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c110); }
|
|
|
- }
|
|
|
- if (s1 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s0;
|
|
|
- s1 = peg$c106();
|
|
|
- }
|
|
|
- s0 = s1;
|
|
|
- peg$silentFails--;
|
|
|
- if (s0 === peg$FAILED) {
|
|
|
- s1 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c108); }
|
|
|
- }
|
|
|
-
|
|
|
- return s0;
|
|
|
- }
|
|
|
-
|
|
|
- function peg$parseCOMMENT() {
|
|
|
- var s0, s1, s2;
|
|
|
-
|
|
|
- s0 = peg$currPos;
|
|
|
- s1 = peg$parseCOMMENT_LINE();
|
|
|
- if (s1 !== peg$FAILED) {
|
|
|
- s2 = peg$parseNL();
|
|
|
- if (s2 === peg$FAILED) {
|
|
|
- s2 = peg$c17;
|
|
|
- }
|
|
|
- if (s2 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s0;
|
|
|
- s1 = peg$c22(s1);
|
|
|
- s0 = s1;
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- if (s0 === peg$FAILED) {
|
|
|
- s0 = peg$currPos;
|
|
|
- s1 = peg$parseCOMMENT_BLOCK();
|
|
|
- if (s1 !== peg$FAILED) {
|
|
|
- s2 = peg$parseNL();
|
|
|
- if (s2 === peg$FAILED) {
|
|
|
- s2 = peg$c17;
|
|
|
- }
|
|
|
- if (s2 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s0;
|
|
|
- s1 = peg$c22(s1);
|
|
|
- s0 = s1;
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return s0;
|
|
|
- }
|
|
|
-
|
|
|
- function peg$parseCOMMENT_LINE() {
|
|
|
- var s0, s1, s2, s3;
|
|
|
-
|
|
|
- peg$silentFails++;
|
|
|
- s0 = peg$currPos;
|
|
|
- if (input.substr(peg$currPos, 2) === peg$c112) {
|
|
|
- s1 = peg$c112;
|
|
|
- peg$currPos += 2;
|
|
|
- } else {
|
|
|
- s1 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c113); }
|
|
|
- }
|
|
|
- if (s1 !== peg$FAILED) {
|
|
|
- s2 = [];
|
|
|
- if (peg$c114.test(input.charAt(peg$currPos))) {
|
|
|
- s3 = input.charAt(peg$currPos);
|
|
|
- peg$currPos++;
|
|
|
- } else {
|
|
|
- s3 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c115); }
|
|
|
- }
|
|
|
- while (s3 !== peg$FAILED) {
|
|
|
- s2.push(s3);
|
|
|
- if (peg$c114.test(input.charAt(peg$currPos))) {
|
|
|
- s3 = input.charAt(peg$currPos);
|
|
|
- peg$currPos++;
|
|
|
- } else {
|
|
|
- s3 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c115); }
|
|
|
- }
|
|
|
- }
|
|
|
- if (s2 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s0;
|
|
|
- s1 = peg$c116(s2);
|
|
|
- s0 = s1;
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- peg$silentFails--;
|
|
|
- if (s0 === peg$FAILED) {
|
|
|
- s1 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c111); }
|
|
|
- }
|
|
|
-
|
|
|
- return s0;
|
|
|
- }
|
|
|
-
|
|
|
- function peg$parseCOMMENT_BLOCK() {
|
|
|
- var s0, s1, s2, s3, s4, s5;
|
|
|
-
|
|
|
- peg$silentFails++;
|
|
|
- s0 = peg$currPos;
|
|
|
- if (input.substr(peg$currPos, 2) === peg$c118) {
|
|
|
- s1 = peg$c118;
|
|
|
- peg$currPos += 2;
|
|
|
- } else {
|
|
|
- s1 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c119); }
|
|
|
- }
|
|
|
- if (s1 !== peg$FAILED) {
|
|
|
- s2 = [];
|
|
|
- s3 = peg$currPos;
|
|
|
- s4 = peg$currPos;
|
|
|
- peg$silentFails++;
|
|
|
- if (input.substr(peg$currPos, 2) === peg$c120) {
|
|
|
- s5 = peg$c120;
|
|
|
- peg$currPos += 2;
|
|
|
- } else {
|
|
|
- s5 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c121); }
|
|
|
- }
|
|
|
- peg$silentFails--;
|
|
|
- if (s5 === peg$FAILED) {
|
|
|
- s4 = peg$c6;
|
|
|
- } else {
|
|
|
- peg$currPos = s4;
|
|
|
- s4 = peg$c2;
|
|
|
- }
|
|
|
- if (s4 !== peg$FAILED) {
|
|
|
- if (input.length > peg$currPos) {
|
|
|
- s5 = input.charAt(peg$currPos);
|
|
|
- peg$currPos++;
|
|
|
- } else {
|
|
|
- s5 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c122); }
|
|
|
- }
|
|
|
- if (s5 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s3;
|
|
|
- s4 = peg$c123(s5);
|
|
|
- s3 = s4;
|
|
|
- } else {
|
|
|
- peg$currPos = s3;
|
|
|
- s3 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s3;
|
|
|
- s3 = peg$c2;
|
|
|
- }
|
|
|
- while (s3 !== peg$FAILED) {
|
|
|
- s2.push(s3);
|
|
|
- s3 = peg$currPos;
|
|
|
- s4 = peg$currPos;
|
|
|
- peg$silentFails++;
|
|
|
- if (input.substr(peg$currPos, 2) === peg$c120) {
|
|
|
- s5 = peg$c120;
|
|
|
- peg$currPos += 2;
|
|
|
- } else {
|
|
|
- s5 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c121); }
|
|
|
- }
|
|
|
- peg$silentFails--;
|
|
|
- if (s5 === peg$FAILED) {
|
|
|
- s4 = peg$c6;
|
|
|
- } else {
|
|
|
- peg$currPos = s4;
|
|
|
- s4 = peg$c2;
|
|
|
- }
|
|
|
- if (s4 !== peg$FAILED) {
|
|
|
- if (input.length > peg$currPos) {
|
|
|
- s5 = input.charAt(peg$currPos);
|
|
|
- peg$currPos++;
|
|
|
- } else {
|
|
|
- s5 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c122); }
|
|
|
- }
|
|
|
- if (s5 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s3;
|
|
|
- s4 = peg$c123(s5);
|
|
|
- s3 = s4;
|
|
|
- } else {
|
|
|
- peg$currPos = s3;
|
|
|
- s3 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s3;
|
|
|
- s3 = peg$c2;
|
|
|
- }
|
|
|
- }
|
|
|
- if (s2 !== peg$FAILED) {
|
|
|
- if (input.substr(peg$currPos, 2) === peg$c120) {
|
|
|
- s3 = peg$c120;
|
|
|
- peg$currPos += 2;
|
|
|
- } else {
|
|
|
- s3 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c121); }
|
|
|
- }
|
|
|
- if (s3 !== peg$FAILED) {
|
|
|
- peg$reportedPos = s0;
|
|
|
- s1 = peg$c124(s2);
|
|
|
- s0 = s1;
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peg$currPos = s0;
|
|
|
- s0 = peg$c2;
|
|
|
- }
|
|
|
- peg$silentFails--;
|
|
|
- if (s0 === peg$FAILED) {
|
|
|
- s1 = peg$FAILED;
|
|
|
- if (peg$silentFails === 0) { peg$fail(peg$c117); }
|
|
|
- }
|
|
|
-
|
|
|
- return s0;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /*global parse, options, offset, line, column, text, SyntaxError*/
|
|
|
- var opts = arguments[2] || options,
|
|
|
- fileName = opts.fileName || "NOFILENAME",
|
|
|
- locations = opts.locations !== undefined ? opts.locations : true,
|
|
|
- comments = opts.comments !== undefined ? opts.comments : false,
|
|
|
- showAst = opts.showAst !== undefined ? opts.showAst : false;
|
|
|
-
|
|
|
- var err = function err(msg, suffix, opts) {
|
|
|
- opts = opts || {};
|
|
|
- if (typeof msg === "number") msg = "ERR" + msg + ": " + errors[msg];
|
|
|
- if (suffix) msg += suffix;
|
|
|
- return new SyntaxError(msg,
|
|
|
- opts.expected || null,
|
|
|
- opts.found || null,
|
|
|
- offset(),
|
|
|
- opts.line || line(),
|
|
|
- opts.col || column()
|
|
|
- );
|
|
|
- };
|
|
|
-
|
|
|
- var errors = [
|
|
|
- "reference to an undefined system",
|
|
|
- "reference to system in a behavior",
|
|
|
- "scope lower bound exceeds its upper bound",
|
|
|
- "definition is recursive"
|
|
|
- ];
|
|
|
-
|
|
|
- var scopify = function scopify(i, q) {
|
|
|
- if (q === null) q = {min:1, max:1};
|
|
|
- i.scope = q;
|
|
|
- return i;
|
|
|
- }
|
|
|
-
|
|
|
- var minmaxify = function minmaxify(lo, hi) {
|
|
|
- var m = hi ? hi.v || null : lo;
|
|
|
- return {min:lo, max:m};
|
|
|
- }
|
|
|
-
|
|
|
- var model = function model(statements) {
|
|
|
-
|
|
|
- var model = {
|
|
|
- systems: {},
|
|
|
- behaviors: {},
|
|
|
- interactions: [],
|
|
|
- triggers: [],
|
|
|
- init: [],
|
|
|
- };
|
|
|
-
|
|
|
- if (showAst) model.ast = statements;
|
|
|
-
|
|
|
- // accumulate varying statements into a flatter structure
|
|
|
- for (var s in statements) {
|
|
|
- var statement = statements[s];
|
|
|
-
|
|
|
- switch(statements[s].type) {
|
|
|
- case "System":
|
|
|
- model.systems[statement.id] = statement;
|
|
|
- break;
|
|
|
- case "Behavior":
|
|
|
- model.behaviors[statement.id] = statement;
|
|
|
- break;
|
|
|
- case "Then":
|
|
|
- case "Join":
|
|
|
- model.interactions.push(statement);
|
|
|
- break;
|
|
|
- case "Trigger":
|
|
|
- model.triggers.push(statement);
|
|
|
- break;
|
|
|
- case "Init":
|
|
|
- model.init.push(statement);
|
|
|
- default: break;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // add atomic events to behaviors list
|
|
|
- for (var r in ast.references) {
|
|
|
- var ref = ast.references[r];
|
|
|
-
|
|
|
- if (!model.behaviors[ref])
|
|
|
- model.behaviors[ref] = new ast.Behavior(ref, [], [])
|
|
|
- }
|
|
|
-
|
|
|
- return errorCheck(model);
|
|
|
- };
|
|
|
-
|
|
|
- var errorCheck = function errorCheck(model) {
|
|
|
- model.errors = ast.errors;
|
|
|
-
|
|
|
- for (var i in model.interactions) {
|
|
|
- model.interactions[i].body.forEach(function (sys) {
|
|
|
- if (sys.type === "Selector" && !model.systems[sys.system])
|
|
|
- model.errors.push(err(0, ` (${sys.system})`, sys.location));
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- for (var t in model.triggers) {
|
|
|
- var sys = model.triggers[t].on;
|
|
|
- if (sys.type === "Selector" && !model.systems[sys.system])
|
|
|
- model.errors.push(err(0, ` (${sys.system})`, sys.location));
|
|
|
- }
|
|
|
-
|
|
|
- for (var i in model.init) {
|
|
|
- var sys = model.init[i].system;
|
|
|
- if (sys && !model.systems[sys])
|
|
|
- model.errors.push(err(0, ` (${sys})`, model.init[i].location));
|
|
|
- }
|
|
|
-
|
|
|
- for (var b in model.behaviors) {
|
|
|
- var bhv = model.behaviors[b];
|
|
|
- bhv.refs.forEach(function (ref) {
|
|
|
- if (model.systems[ref])
|
|
|
- model.errors.push(err(1, ` (${ref} in ${bhv.id})`, bhv.location));
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- return model;
|
|
|
- };
|
|
|
-
|
|
|
- var ast = {
|
|
|
-
|
|
|
- comments: [],
|
|
|
- errors: [],
|
|
|
- references: [],
|
|
|
-
|
|
|
- Base: function Base(type) {
|
|
|
- this.type = type;
|
|
|
- if (locations) {
|
|
|
- this.location = {
|
|
|
- pos: offset(),
|
|
|
- line: line(),
|
|
|
- col: column(),
|
|
|
- len: text().length,
|
|
|
- };
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
- Comment: function Comment(block, text) {
|
|
|
- ast.Base.call(this, "Comment");
|
|
|
- this.block = block;
|
|
|
- this.text = text;
|
|
|
- ast.comments.push(this);
|
|
|
- },
|
|
|
-
|
|
|
- Id: function Id(type, id) {
|
|
|
- ast.Base.call(this, type);
|
|
|
- this.id = id;
|
|
|
- },
|
|
|
-
|
|
|
- System: function System(id, body, refs) {
|
|
|
- ast.Id.call(this, "System", id);
|
|
|
- this.body = body;
|
|
|
- this.refs = refs;
|
|
|
- this.properties = {};
|
|
|
- this.scope = { min:1, max:1 };
|
|
|
- },
|
|
|
-
|
|
|
- Behavior: function Behavior(id, body, refs) {
|
|
|
- ast.Id.call(this, "Behavior", id);
|
|
|
- this.body = body;
|
|
|
- this.refs = refs;
|
|
|
- this.properties = {};
|
|
|
- },
|
|
|
-
|
|
|
- Interaction: function Interaction(type, body) {
|
|
|
- ast.Base.call(this, type);
|
|
|
- this.body = body;
|
|
|
- },
|
|
|
-
|
|
|
- Sequence: function Sequence(body) {
|
|
|
- ast.Base.call(this, "Sequence");
|
|
|
- this.body = body;
|
|
|
- this.scope = { min:1, max:1 };
|
|
|
- },
|
|
|
-
|
|
|
- Alternation: function Alternation(body) {
|
|
|
- ast.Base.call(this, "Alternation");
|
|
|
- this.body = body;
|
|
|
- this.scope = { min:1, max:1 };
|
|
|
- },
|
|
|
-
|
|
|
- Group: function Group(async, body) {
|
|
|
- ast.Base.call(this, "Group");
|
|
|
- this.async = async;
|
|
|
- this.body = body;
|
|
|
- },
|
|
|
-
|
|
|
- Selector: function Selector(system, pattern, pre, post) {
|
|
|
- ast.Base.call(this, "Selector");
|
|
|
- this.system = system;
|
|
|
- this.pattern = pattern;
|
|
|
- this.pre = pre || null;
|
|
|
- this.post = post || null;
|
|
|
- },
|
|
|
-
|
|
|
- Trigger: function Trigger(selector, body) {
|
|
|
- ast.Base.call(this, "Trigger");
|
|
|
- this.on = selector;
|
|
|
- this.do = body;
|
|
|
- },
|
|
|
-
|
|
|
- Init: function Init(system, body) {
|
|
|
- ast.Base.call(this, "Init");
|
|
|
- this.system = system;
|
|
|
- this.do = body;
|
|
|
- },
|
|
|
-
|
|
|
- };
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- 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" });
|
|
|
- }
|
|
|
-
|
|
|
- throw peg$buildException(null, peg$maxFailExpected, peg$maxFailPos);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return {
|
|
|
- SyntaxError: SyntaxError,
|
|
|
- parse: parse
|
|
|
- };
|
|
|
-})();
|