add _log function to environment + enable explicit order of orthogonal regions
This commit is contained in:
parent
098a6d7e78
commit
45cfc6f1f8
2 changed files with 12 additions and 2 deletions
|
|
@ -7,7 +7,10 @@ export function initialize(ast: Statechart): BigStepOutput {
|
||||||
let history = new Map();
|
let history = new Map();
|
||||||
let enteredStates, environment, rest;
|
let enteredStates, environment, rest;
|
||||||
({enteredStates, environment, history, ...rest} = enterDefault(0, ast.root, {
|
({enteredStates, environment, history, ...rest} = enterDefault(0, ast.root, {
|
||||||
environment: new Environment([new Map([["_timers", []]])]),
|
environment: new Environment([new Map<string, any>([
|
||||||
|
["_timers", []],
|
||||||
|
["_log", (str: string) => console.log(str)],
|
||||||
|
])]),
|
||||||
history,
|
history,
|
||||||
...initialRaised,
|
...initialRaised,
|
||||||
}));
|
}));
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { ConcreteState, HistoryState, OrState, PseudoState, Statechart, Transition } from "./abstract_syntax";
|
import { ConcreteState, HistoryState, OrState, PseudoState, Statechart, stateDescription, Transition } from "./abstract_syntax";
|
||||||
import { Rountangle } from "./concrete_syntax";
|
import { Rountangle } from "./concrete_syntax";
|
||||||
import { isEntirelyWithin, Rect2D } from "../VisualEditor/geometry";
|
import { isEntirelyWithin, Rect2D } from "../VisualEditor/geometry";
|
||||||
import { Action, EventTrigger, Expression, ParsedText } from "./label_ast";
|
import { Action, EventTrigger, Expression, ParsedText } from "./label_ast";
|
||||||
|
|
@ -352,6 +352,13 @@ export function parseStatechart(state: VisualEditorState, conns: Connections): [
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// sort children by their label
|
||||||
|
for (const state of uid2State.values()) {
|
||||||
|
if (state.kind === "and") {
|
||||||
|
state.children.sort((a, b) => stateDescription(a).localeCompare(stateDescription(b)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return [{
|
return [{
|
||||||
root,
|
root,
|
||||||
transitions,
|
transitions,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue