arcs nicely curve when they connect a rountangle to itself
This commit is contained in:
parent
e009f718d2
commit
da0e56e17c
11 changed files with 526 additions and 153 deletions
26
src/VisualEditor/interpreter.ts
Normal file
26
src/VisualEditor/interpreter.ts
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import { ConcreteState, Statechart } from "./ast";
|
||||
|
||||
export function initialize(ast: Statechart): RT_Statechart {
|
||||
const rt_root = recursiveEnter(ast.root) as RT_OrState;
|
||||
return {
|
||||
root: rt_root,
|
||||
variables: new Map(),
|
||||
};
|
||||
}
|
||||
|
||||
export function recursiveEnter(state: ConcreteState): RT_ConcreteState {
|
||||
if (state.kind === "and") {
|
||||
return {
|
||||
kind: "and",
|
||||
children: state.children.map(child => recursiveEnter(child)),
|
||||
};
|
||||
}
|
||||
else {
|
||||
const currentState = state.initial[0][1];
|
||||
return {
|
||||
kind: "or",
|
||||
current: currentState.uid,
|
||||
current_rt: recursiveEnter(currentState),
|
||||
};
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue