Skip to content

Commit

Permalink
Merge pull request #397 from StoneCypher/ArrangeStartAndEnd
Browse files Browse the repository at this point in the history
Arrange start and end
  • Loading branch information
StoneCypher committed Jan 29, 2020
2 parents de1fea7 + 751cde5 commit cc39df4
Show file tree
Hide file tree
Showing 14 changed files with 740 additions and 171 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,5 @@
* [[`f96df2623d`](https://github.com/StoneCypher/jssm/commit/f96df2623d)] - arrange-start and arrange-end (John Haugeland)
* [[`de1fea7329`](https://github.com/StoneCypher/jssm/commit/de1fea7329)] - add support for line styles, fixes StoneCypher/fsl#367 (John Haugeland)
* [[`e0a395bb33`](https://github.com/StoneCypher/jssm/commit/e0a395bb33)] - vastly superior implementation of corners (John Haugeland)
* [[`3aa55887b6`](https://github.com/StoneCypher/jssm/commit/3aa55887b6)] - Merge pull request #396 from StoneCypher/AddArrange (John Haugeland)
* [[`7345a14e14`](https://github.com/StoneCypher/jssm/commit/7345a14e14)] - Add arrange, fixes StoneCypher/fsl#267 (John Haugeland)
Expand Down
188 changes: 179 additions & 9 deletions dist/jssm.es5.cjs.js
Expand Up @@ -871,6 +871,9 @@ function reduce(from) {
var reduceTo6391 = { reduce: reduce, reductions: reductions };
var reduceTo6391_1 = reduceTo6391.reduce;

var array_box_if_string = function (n) {
return typeof n === 'string' ? [n] : n;
};
// this is explicitly about other peoples' data, so it has to be weakly typed
/* eslint-disable flowtype/no-weak-types */
var weighted_rand_select = function (options, probability_property) {
Expand Down Expand Up @@ -2337,6 +2340,13 @@ function peg$parse(input, options) {
peg$c1262 = "arrange",
peg$c1263 = peg$literalExpectation("arrange", false),
peg$c1264 = function(value) { return { key: 'arrange_declaration', value }; },
peg$c1265 = "arrange-start",
peg$c1266 = peg$literalExpectation("arrange-start", false),
peg$c1267 = function(value) { return { key: 'arrange_start_declaration', value }; },
peg$c1268 = "arrange-end",
peg$c1269 = peg$literalExpectation("arrange-end", false),
peg$c1270 = function(value) { return { key: 'arrange_end_declaration', value }; },
peg$c1271 = peg$otherExpectation("arrange declaration"),

peg$currPos = 0,
peg$savedPos = 0,
Expand Down Expand Up @@ -14605,7 +14615,7 @@ function peg$parse(input, options) {
return s0;
}

function peg$parseArrangeDeclaration() {
function peg$parseRegularArrangeDeclaration() {
var s0, s1, s2, s3, s4, s5, s6;

s0 = peg$currPos;
Expand Down Expand Up @@ -14673,6 +14683,161 @@ function peg$parse(input, options) {
return s0;
}

function peg$parseArrangeStartDeclaration() {
var s0, s1, s2, s3, s4, s5, s6;

s0 = peg$currPos;
if (input.substr(peg$currPos, 13) === peg$c1265) {
s1 = peg$c1265;
peg$currPos += 13;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c1266); }
}
if (s1 !== peg$FAILED) {
s2 = peg$parseWS();
if (s2 === peg$FAILED) {
s2 = null;
}
if (s2 !== peg$FAILED) {
s3 = peg$parseLabelOrLabelList();
if (s3 !== peg$FAILED) {
s4 = peg$parseWS();
if (s4 === peg$FAILED) {
s4 = null;
}
if (s4 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 59) {
s5 = peg$c1072;
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c1073); }
}
if (s5 !== peg$FAILED) {
s6 = peg$parseWS();
if (s6 === peg$FAILED) {
s6 = null;
}
if (s6 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c1267(s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}

return s0;
}

function peg$parseArrangeEndDeclaration() {
var s0, s1, s2, s3, s4, s5, s6;

s0 = peg$currPos;
if (input.substr(peg$currPos, 11) === peg$c1268) {
s1 = peg$c1268;
peg$currPos += 11;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c1269); }
}
if (s1 !== peg$FAILED) {
s2 = peg$parseWS();
if (s2 === peg$FAILED) {
s2 = null;
}
if (s2 !== peg$FAILED) {
s3 = peg$parseLabelOrLabelList();
if (s3 !== peg$FAILED) {
s4 = peg$parseWS();
if (s4 === peg$FAILED) {
s4 = null;
}
if (s4 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 59) {
s5 = peg$c1072;
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c1073); }
}
if (s5 !== peg$FAILED) {
s6 = peg$parseWS();
if (s6 === peg$FAILED) {
s6 = null;
}
if (s6 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c1270(s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}

return s0;
}

function peg$parseArrangeDeclaration() {
var s0;

peg$silentFails++;
s0 = peg$parseArrangeStartDeclaration();
if (s0 === peg$FAILED) {
s0 = peg$parseArrangeEndDeclaration();
if (s0 === peg$FAILED) {
s0 = peg$parseRegularArrangeDeclaration();
}
}
peg$silentFails--;
if (s0 === peg$FAILED) {
if (peg$silentFails === 0) { peg$fail(peg$c1271); }
}

return s0;
}

function peg$parseTerm() {
var s0;

Expand Down Expand Up @@ -14735,7 +14900,7 @@ var jssmDot = {
var jssmDot_1 = jssmDot.parse;

// whargarbl lots of these return arrays could/should be sets
var version = '5.28.0'; // replaced from package.js in build // TODO FIXME currently broken
var version = '5.30.0'; // replaced from package.js in build // TODO FIXME currently broken
/* eslint-disable complexity */
function arrow_direction(arrow) {
switch (String(arrow)) {
Expand Down Expand Up @@ -14942,8 +15107,9 @@ function compile_rule_handler(rule) {
}
return { agg_as: 'state_declaration', val: { state: rule.name, declarations: rule.value } };
}
if (rule.key === 'arrange_declaration') {
return { agg_as: 'arrange_declaration', val: [rule.value] };
if (['arrange_declaration', 'arrange_start_declaration',
'arrange_end_declaration'].includes(rule.key)) {
return { agg_as: rule.key, val: [rule.value] };
}
var tautologies = [
'graph_layout', 'start_states', 'end_states', 'machine_name', 'machine_version',
Expand Down Expand Up @@ -14977,6 +15143,8 @@ function compile(tree) {
flow: [],
dot_preamble: [],
arrange_declaration: [],
arrange_start_declaration: [],
arrange_end_declaration: [],
machine_version: []
};
tree.map(function (tr) {
Expand All @@ -15003,8 +15171,8 @@ function compile(tree) {
}
}
});
['arrange_declaration', 'machine_author', 'machine_contributor', 'machine_reference',
'state_declaration'].map(function (multiKey) {
['arrange_declaration', 'arrange_start_declaration', 'arrange_end_declaration',
'machine_author', 'machine_contributor', 'machine_reference', 'state_declaration'].map(function (multiKey) {
if (results[multiKey].length) {
result_cfg[multiKey] = results[multiKey];
}
Expand Down Expand Up @@ -15047,7 +15215,7 @@ var Machine = /** @class */ (function () {
// whargarbl this badly needs to be broken up, monolith master
function Machine(_a) {
var _this = this;
var start_states = _a.start_states, _b = _a.complete, complete = _b === void 0 ? [] : _b, transitions = _a.transitions, machine_author = _a.machine_author, machine_comment = _a.machine_comment, machine_contributor = _a.machine_contributor, machine_definition = _a.machine_definition, machine_language = _a.machine_language, machine_license = _a.machine_license, machine_name = _a.machine_name, machine_version = _a.machine_version, state_declaration = _a.state_declaration, fsl_version = _a.fsl_version, _c = _a.dot_preamble, dot_preamble = _c === void 0 ? undefined : _c, _d = _a.arrange_declaration, arrange_declaration = _d === void 0 ? [] : _d, _e = _a.theme, theme = _e === void 0 ? 'default' : _e, _f = _a.flow, flow = _f === void 0 ? 'down' : _f, _g = _a.graph_layout, graph_layout = _g === void 0 ? 'dot' : _g;
var start_states = _a.start_states, _b = _a.complete, complete = _b === void 0 ? [] : _b, transitions = _a.transitions, machine_author = _a.machine_author, machine_comment = _a.machine_comment, machine_contributor = _a.machine_contributor, machine_definition = _a.machine_definition, machine_language = _a.machine_language, machine_license = _a.machine_license, machine_name = _a.machine_name, machine_version = _a.machine_version, state_declaration = _a.state_declaration, fsl_version = _a.fsl_version, _c = _a.dot_preamble, dot_preamble = _c === void 0 ? undefined : _c, _d = _a.arrange_declaration, arrange_declaration = _d === void 0 ? [] : _d, _e = _a.arrange_start_declaration, arrange_start_declaration = _e === void 0 ? [] : _e, _f = _a.arrange_end_declaration, arrange_end_declaration = _f === void 0 ? [] : _f, _g = _a.theme, theme = _g === void 0 ? 'default' : _g, _h = _a.flow, flow = _h === void 0 ? 'down' : _h, _j = _a.graph_layout, graph_layout = _j === void 0 ? 'dot' : _j;
this._state = start_states[0];
this._states = new Map();
this._state_declarations = new Map();
Expand All @@ -15057,9 +15225,9 @@ var Machine = /** @class */ (function () {
this._actions = new Map();
this._reverse_actions = new Map();
this._reverse_action_targets = new Map(); // todo
this._machine_author = typeof machine_author === 'string' ? [machine_author] : machine_author;
this._machine_author = array_box_if_string(machine_author);
this._machine_comment = machine_comment;
this._machine_contributor = typeof machine_contributor === 'string' ? [machine_contributor] : machine_contributor;
this._machine_contributor = array_box_if_string(machine_contributor);
this._machine_definition = machine_definition;
this._machine_language = machine_language;
this._machine_license = machine_license;
Expand All @@ -15068,6 +15236,8 @@ var Machine = /** @class */ (function () {
this._raw_state_declaration = state_declaration || [];
this._fsl_version = fsl_version;
this._arrange_declaration = arrange_declaration;
this._arrange_start_declaration = arrange_start_declaration;
this._arrange_end_declaration = arrange_end_declaration;
this._dot_preamble = dot_preamble;
this._theme = theme;
this._flow = flow;
Expand Down
2 changes: 1 addition & 1 deletion dist/jssm.es5.cjs.js.map

Large diffs are not rendered by default.

0 comments on commit cc39df4

Please sign in to comment.