syntax

package
v0.8.17 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 6, 2024 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BusinessWorkflowID

type BusinessWorkflowID string

BusinessWorkflowID is a triple Unnamed.BO.BOID

func BusinessWorkflowIDof

func BusinessWorkflowIDof(workflowName Unversioned, bo, boID string) BusinessWorkflowID

BusinessWorkflowIDof creates a BusinessWorkflowID (wfname.bo.boid) from its components

func (BusinessWorkflowID) Decompose

func (id BusinessWorkflowID) Decompose() (workflowName Unversioned, bo, boid string, err error)

Decompose splits a BusinessWorkflowID into its components (wfname.bo.boid) it was created from. The wfname part must not be empty.

type Consequence

type Consequence struct {
	Line       int         `json:"line"`                 // Line is the linenumber within the source in which this consequence was declared
	Col        int         `json:"col"`                  // Col is the column number within the source in which this consequence was declared
	Action     string      `json:"action"`               // Action is a keyword describing the type of this consequence. It can be assign, funcall, if-goto, goto, if-halt, halt or terminate
	Goto       string      `json:"goto,omitempty"`       // Goto is either the name of a state to go to or the name of an interpreter's environment var containing the target state
	LVar       string      `json:"lvar,omitempty"`       // LVar is the name of en interpreter's $variable used on the left hand side of an assignment or an if clause, its $$ for a map valued action call
	Operator   string      `json:"operator,omitempty"`   // Operator is either == or !=
	Function   string      `json:"function,omitempty"`   // Function is a function's name for a funcall, which is usually mapped to a temporal action name
	Parameters []Parameter `json:"parameters,omitempty"` // Parameters is a list of either a string literal or an interperter's environment variable name
}

Consequence is an action that acts as a consequence of an Initialization, a time-out or an Event

type Event

type Event struct {
	Named
	Type         string        `json:"type"`         // Type can be event, delay or initialization
	Parameter    string        `json:"parameter"`    // Parameter is a Duration if this event is of Type delay
	Consequences []Consequence `json:"consequences"` // Consequences is a list of actions to be executed if this event is triggered
}

Event is sth a state waits for and can be triggered by Name from the outside

func (Event) AllTargets added in v0.7.13

func (e Event) AllTargets() (states []string)

AllTargets collects all potential states, an event can reach declaratively. State changes based on environmental vars are not covered by the result.

func (Event) IntersectsWith

func (e Event) IntersectsWith(roles []string) bool

IntersectsWith is true if e.Roles is empty or otherwise if there is a non-empty intersection between e.Roles and the given roles

type Named

type Named struct {
	Name        Unversioned `json:"name"`        // Name is the key of an FSE DSL's object
	Option      string      `json:"option"`      // Option is an option string, that must be parseable via option.Parse
	Display     string      `json:"display"`     // Display is a text intended to be shown in a GUI
	Description string      `json:"description"` // Description is descriptive text attached to an FSE DSL's object. For web GUIs it's normally markdown formatted.
	Roles       []string    `json:"roles"`       // Roles is a list of role names intended to be checked by an RBAC implementation for visibility
}

Named is an identifier with a displayname and some descriptive text

func (Named) DisplayOrName

func (n Named) DisplayOrName() string

DisplayOrName returns Display if it is not empty, otherwise Name is returned

func (Named) NameOrDisplay

func (n Named) NameOrDisplay() string

NameOrDisplay returns Name if it is not empty, otherwise Display is returned

func (Named) OptionParsed

func (n Named) OptionParsed() option.Option

OptionParsed returns Option parsed as option.Option or empty options if invalid

type Parameter

type Parameter struct {
	Var  string `json:"var,omitempty"`  // Var is the $name of an interpreter's environment variable
	Text string `json:"text,omitempty"` // Text is the value of a string literal
}

Parameter is either a variable name or a string literal, but not both

type Predecessor added in v0.5.2

type Predecessor struct {
	Source *State
	Events []Event
}

Predecessor describes source state and events for a target state

type State

type State struct {
	Named
	Line   int     `json:"line"`   // Line is the linenumber within the source in which the "state" directive was declared
	Events []Event `json:"events"` // Events is the list of Events this State owns directly including initialization and delay events
	States []State `json:"states"` // States is the list of sub-states this state has
	Parent *State  `json:"-"`      // Parent is the state this state is a sub-state of
}

State is a workflow state

func (State) Predecessors added in v0.5.2

func (s State) Predecessors(wf *Workflow) []Predecessor

Predecessors lists all states and events that can possibly enter this State. Inherited events are however only listed within their defining state. Predecessors are sorted by state-name.

type Statename added in v0.5.6

type Statename struct {
	Name    Unversioned `json:"name"`    // Name is the key of a workflow state
	Display string      `json:"display"` // Display is a text intended to be shown in a GUI
}

Statename describes a workflow state's name by key and display text

type Unversioned

type Unversioned string

Unversioned is a name or a version, but not a combination name@version

func (Unversioned) String

func (uv Unversioned) String() string

type Versioned

type Versioned string

Versioned is a name with an optional version

func VersionedName

func VersionedName(name, version Unversioned) Versioned

VersionedName returns Name@Version if there is one, otherwise Name

func (Versioned) String

func (v Versioned) String() string

type Workflow

type Workflow struct {
	Named
	Version    Unversioned            `json:"version,omitempty"` // Version is optional, but if you have one and you are parsing with a non empty path, it is an error to not include the version in the filename
	States     []State                `json:"states"`            // States are only the daclared top-level states
	Statenames []Statename            `json:"statenames"`        // Statenames lists all states names in text order
	AllStates  map[Unversioned]*State `json:"-"`                 // AllStates are all states and their substates indexed by Name
	Path       string                 `json:"-"`                 // Path is the filename, if the wf was parsed from an os.File
}

Workflow is the parsed SemanticTree

func Parse

func Parse(r io.Reader, path string) (*Workflow, []listener.Diagnostic, error)

Parse parses FSE DSL syntax and returns a semantic tree and diagnostic information. The path is stored as Path in the resulting wf and within diagnostics.

func (Workflow) VersionedName

func (wf Workflow) VersionedName() Versioned

VersionedName returns Name@Version if there is one, otherwise Name

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL