package
0.5.1
Repository: https://github.com/jsmorph/sheens.git
Documentation: pkg.go.dev

# README

ECMAScript

This core.Interpreter is based on Goja, which executes Ecmascript 5.1.

Unlike the demo goja interpreter (interpreters/goja), this interpreter doesn't support libraries. If you want to use this interpreter but also want to use libraries, then you should implement a preprocessing step that generates source that has the libraries embedded in that source.

Eventually deprecate interpreters/goja in favor of this interpreter.

Environment

The base runtime environment includes a binding for the variable _:

  1. _.bindings: The current set of machine bindings.

  2. _.params: The current parameters for the machine execution. These parameters are provided by the application that uses the Machines core. In the example mservice process, these parameters include

    1. mid: The id of the current machine
    2. cid: The id of the machine's crew
  3. _.props: core.StepProps (if any).

  4. _.out(X): "Emits" the given message.

If the interpreter's Extended flag is true, then _ has these additional properties:

  1. _.genstr(): Generates a random 32-char string

  2. _.cronNext(CRONEXPR)TIMESTAMP: cronNext attempts to parse its argument as a cron expression. If successful, returns the next time in Go RFC3339Nano format.

    Example:

    ({next: _.cronNext("* 0 * * *")});
    
  3. _.match(PATTERN, MESSAGE): Invokes pattern matching.

If the interpreter's Test flag is true, then _ has these additional properties:

  1. _.sleep(MS): Sleeps for the given number of milliseconds.

  2. _.exit(N): Terminates the process (!) with the given exit code.

# Functions

No description provided by the author
NewInterpreter makes a new Interpreter.
No description provided by the author

# Variables

IgnoreExit will prevent the Goja function "exit" from terminating the process.
Interrupted is returned by Exec if the execution is interrupted.
InterruptedMessage is the string value of Interrupted.

# Structs

Interpreter implements core.Intepreter using Goja, which is a Go implementation of ECMAScript 5.1+.