Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const _clonedeep = require("lodash.clonedeep");
/* eslint import/no-unassigned-import: 0 */
require("./smcat.template");
const NAME_QUOTABLE = new RegExp(";|,|{| |\\[");
const ACTIONS_QUOTABLE = new RegExp(";|,|{");
const LABEL_QUOTABLE = new RegExp(";|{");
function quoteIfNecessary(pRegExp, pString) {
return pRegExp.test(pString) ? `"${pString}"` : pString;
}
Handlebars.registerPartial(
"smcat.template.hbs",
Handlebars.templates["smcat.template.hbs"]
);
function formatActionType(pString) {
return pString === "activity" ? "" : `${pString}/ `;
}
function flattenActions(pState) {
const lRetval = Object.assign({}, pState);
lRetval.actions = (pState.actions || [])
.map(pAction => `${formatActionType(pAction.type)}${pAction.body}`)
.join("\n ");
return lRetval;
}
function xlate(pStateMachine, pRegionCounter = 0) {
return Object.assign(
{},
xlateStates(pStateMachine.states, pRegionCounter),
xlateTransitions(pStateMachine.transitions)
);
}
/* eslint import/no-unassigned-import: 0 */
require("./xmi.template");
require("./xmi.states.template");
Handlebars.registerPartial(
"xmi.states.template.hbs",
Handlebars.templates["xmi.states.template.hbs"]
);
module.exports = pStateMachine =>
Handlebars.templates["xmi.template.hbs"](xlate(pStateMachine));
Handlebars.registerHelper("stateSection", pStateMachine =>
Handlebars.templates["dot.states.template.hbs"](splitStates(pStateMachine))
);
var Handlebars = require("handlebars/dist/handlebars.runtime"); var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
templates['dot.states.template.hbs'] = template({"1":function(container,depth0,helpers,partials,data) {
var stack1, helper, options, buffer = "";
stack1 = ((helper = (helper = helpers.nestedExternalSelfTransitions || (depth0 != null ? depth0.nestedExternalSelfTransitions : depth0)) != null ? helper : container.hooks.helperMissing),(options={"name":"nestedExternalSelfTransitions","hash":{},"fn":container.program(2, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":2,"column":2},"end":{"line":4,"column":36}}}),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),options) : helper));
if (!helpers.nestedExternalSelfTransitions) { stack1 = container.hooks.blockHelperMissing.call(depth0,stack1,options)}
if (stack1 != null) { buffer += stack1; }
return buffer;
},"2":function(container,depth0,helpers,partials,data) {
var stack1;
return " \"self_"
+ ((stack1 = container.lambda(depth0, depth0)) != null ? stack1 : "")
+ "\" [shape=point style=invis width=0 height=0 fixedsize=true]\n";
},"4":function(container,depth0,helpers,partials,data) {
var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {});
var Handlebars = require("handlebars/dist/handlebars.runtime"); var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
templates['dot.template.hbs'] = template({"1":function(container,depth0,helpers,partials,data,blockParams,depths) {
var stack1, helper, options, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.hooks.blockHelperMissing, buffer = "";
stack1 = ((helper = (helper = helpers.noteName || (depth0 != null ? depth0.noteName : depth0)) != null ? helper : alias2),(options={"name":"noteName","hash":{},"fn":container.noop,"inverse":container.program(2, data, 0, blockParams, depths),"data":data,"loc":{"start":{"line":9,"column":2},"end":{"line":24,"column":15}}}),(typeof helper === alias3 ? helper.call(alias1,options) : helper));
if (!helpers.noteName) { stack1 = alias4.call(depth0,stack1,options)}
if (stack1 != null) { buffer += stack1; }
stack1 = ((helper = (helper = helpers.noteName || (depth0 != null ? depth0.noteName : depth0)) != null ? helper : alias2),(options={"name":"noteName","hash":{},"fn":container.program(17, data, 0, blockParams, depths),"inverse":container.noop,"data":data,"loc":{"start":{"line":25,"column":2},"end":{"line":35,"column":15}}}),(typeof helper === alias3 ? helper.call(alias1,options) : helper));
if (!helpers.noteName) { stack1 = alias4.call(depth0,stack1,options)}
if (stack1 != null) { buffer += stack1; }
return buffer;
},"2":function(container,depth0,helpers,partials,data) {
var stack1, helper, options, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.hooks.blockHelperMissing, buffer = "";
stack1 = ((helper = (helper = helpers.isCompositeSelf || (depth0 != null ? depth0.isCompositeSelf : depth0)) != null ? helper : alias2),(options={"name":"isCompositeSelf","hash":{},"fn":container.noop,"inverse":container.program(3, data, 0),"data":data,"loc":{"start":{"line":10,"column":4},"end":{"line":15,"column":24}}}),(typeof helper === alias3 ? helper.call(alias1,options) : helper));
if (!helpers.isCompositeSelf) { stack1 = alias4.call(depth0,stack1,options)}
if (stack1 != null) { buffer += stack1; }
var Handlebars = require("handlebars/dist/handlebars.runtime"); var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
templates['scxml.template.hbs'] = template({"1":function(container,depth0,helpers,partials,data) {
var helper;
return "initial=\""
+ container.escapeExpression(((helper = (helper = helpers.initial || (depth0 != null ? depth0.initial : depth0)) != null ? helper : container.hooks.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"initial","hash":{},"data":data,"loc":{"start":{"line":2,"column":71},"end":{"line":2,"column":82}}}) : helper)))
+ "\" ";
},"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
var stack1;
return "\n\n"
+ ((stack1 = container.invokePartial(partials["scxml.states.template.hbs"],depth0,{"name":"scxml.states.template.hbs","data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "")
+ "\n";
},"usePartial":true,"useData":true});
module.exports = pAST =>
Handlebars.templates["html.template.hbs"](toTableMatrix(pAST));
module.exports = pStateMachine =>
Handlebars.templates["xmi.template.hbs"](xlate(pStateMachine));