re-organize project structure a bit + add icons
This commit is contained in:
parent
3cb3ef91d2
commit
5e7b944978
24 changed files with 514 additions and 249 deletions
74
src/statecharts/label_ast.ts
Normal file
74
src/statecharts/label_ast.ts
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
export type ParsedText = TransitionLabel | Comment;
|
||||
|
||||
export type TransitionLabel = {
|
||||
kind: "transitionLabel";
|
||||
uid: string; // uid of the text node
|
||||
trigger: Trigger;
|
||||
guard: Expression;
|
||||
actions: Action[];
|
||||
}
|
||||
|
||||
export type Comment = {
|
||||
kind: "comment";
|
||||
uid: string; // uid of the text node
|
||||
text: string;
|
||||
}
|
||||
|
||||
export type Trigger = EventTrigger | AfterTrigger | EntryTrigger | ExitTrigger;
|
||||
|
||||
export type EventTrigger = {
|
||||
kind: "event";
|
||||
event: string;
|
||||
}
|
||||
|
||||
export type AfterTrigger = {
|
||||
kind: "after";
|
||||
durationMs: number;
|
||||
}
|
||||
|
||||
export type EntryTrigger = {
|
||||
kind: "entry";
|
||||
}
|
||||
export type ExitTrigger = {
|
||||
kind: "exit";
|
||||
}
|
||||
|
||||
|
||||
export type Action = Assignment | RaiseEvent;
|
||||
|
||||
export type Assignment = {
|
||||
kind: "assignment";
|
||||
lhs: string;
|
||||
rhs: Expression;
|
||||
}
|
||||
|
||||
export type RaiseEvent = {
|
||||
kind: "raise";
|
||||
event: string;
|
||||
}
|
||||
|
||||
|
||||
export type Expression = BinaryExpression | UnaryExpression | VarRef | Literal;
|
||||
|
||||
export type BinaryExpression = {
|
||||
kind: "binaryExpr";
|
||||
operator: "+" | "-" | "*" | "/" | "&&" | "||";
|
||||
lhs: Expression;
|
||||
rhs: Expression;
|
||||
}
|
||||
|
||||
export type UnaryExpression = {
|
||||
kind: "unaryExpr";
|
||||
operator: "!" | "-";
|
||||
expr: Expression;
|
||||
}
|
||||
|
||||
export type VarRef = {
|
||||
kind: "ref";
|
||||
variable: string;
|
||||
}
|
||||
|
||||
export type Literal = {
|
||||
kind: "literal";
|
||||
value: any;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue