Executes a script.

interface Parser {
    addCommand(commandName, commandFnc, helpText): void;
    parse(script): any;
    saveStart(): void;
    toStringShort(): string;

Hierarchy (view full)

Implemented by


  • Adds a single-word command to this Parser. When the Parser sees this command during Parser.parse it will execute the given function. The function result is returned as the result of parse.

    The function must return a value other than undefined, otherwise a script syntax error will be indicated to the user.


    • commandName: string

      name of command

    • commandFnc: (() => any)

      function to execute

        • (): any
        • Returns any

    • helpText: string

      description of the command for help text

    Returns void

  • Interprets and executes a script.


    • script: string

      the script to parse and execute

    Returns any

    the value of the script, or undefined if the script did not fit the allowed syntax


    if executing the script causes an error

  • Saves current application and simulation state to compare against when generating a script later on. This helps shorten the script by not including settings that are unchanged.

    Returns void

  • Returns a minimal string representation of this object, usually giving just identity information like the class name and name of the object.

    For an object whose main purpose is to represent another Printable object, it is recommended to include the result of calling toStringShort on that other object. For example, calling toStringShort() on a DisplayShape might return something like this:


    Returns string

    a minimal string representation of this object.

Generated using TypeDoc