import { ConcreteState, PseudoState, stateDescription, Transition } from "../statecharts/abstract_syntax"; import { Action, EventTrigger, Expression } from "../statecharts/label_ast"; import { RT_Statechart } from "../statecharts/runtime_types"; import "./AST.css"; export function ShowTransition(props: {transition: Transition}) { return <>➝ {stateDescription(props.transition.tgt)}; } export function ShowExpr(props: {expr: Expression}) { if (props.expr.kind === "literal") { return <>{props.expr.value}; } else if (props.expr.kind === "ref") { return <>{props.expr.variable}; } else if (props.expr.kind === "unaryExpr") { return <>{props.expr.operator}; } else if (props.expr.kind === "binaryExpr") { return <>{props.expr.operator}; } } export function ShowAction(props: {action: Action}) { if (props.action.kind === "raise") { return <>^{props.action.event}; } else if (props.action.kind === "assignment") { return <>{props.action.lhs} = ;; } } export function ShowAST(props: {root: ConcreteState | PseudoState, transitions: Map, rt: RT_Statechart | undefined, highlightActive: Set}) { const description = stateDescription(props.root); // const outgoing = props.transitions.get(props.root.uid) || []; return
  • {props.root.kind}: {description} {props.root.kind !== "pseudo" && props.root.children.length>0 &&
      {props.root.children.map(child => )}
    }
  • ; return
    {props.root.kind}: {description} {/* {props.root.kind !== "pseudo" && props.root.entryActions.length>0 && props.root.entryActions.map(action =>
     entry /
    ) } {props.root.kind !== "pseudo" && props.root.exitActions.length>0 && props.root.exitActions.map(action =>
     exit /
    ) } */} {props.root.kind !== "pseudo" && props.root.children.length>0 && props.root.children.map(child => ) } {/* {outgoing.length>0 && outgoing.map(transition => <> 
    ) } */}
    ; } import BoltIcon from '@mui/icons-material/Bolt'; export function ShowInputEvents({inputEvents, onRaise, disabled}: {inputEvents: EventTrigger[], onRaise: (e: string, p: any) => void, disabled: boolean}) { return inputEvents.map(({event, paramName}) =>
    {paramName && <> }  
    ) } export function ShowOutputEvents(props: {outputEvents: Set}) { return [...props.outputEvents].map(eventName => { return <>
    {eventName}
    ; }); }