fsmtest

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FsmStr

func FsmStr(s *fsm.State) string

FsmStr generates a string representation of the provided FSM

func NewFsm

func NewFsm(spec string, matchers map[string]matcher.Matcher) *fsm.State

NewFsm constructs an FSM from the provided string spec and a list of defined matchers The spec syntax is:

S1 t1 S2 S2 t2 (S3) <source state name> <transition name> <target state name>

states between parenthesis are final states

func TransitionStrs

func TransitionStrs(trs fsm.StateTransitions) []string

TransitionStrs returns a string slice with the transitions names

Types

type NopeMatcher

type NopeMatcher struct{}

NopeMatcher is a matcher that always fails

func (NopeMatcher) Match

func (NopeMatcher) Match(args []string, c *matcher.ParseContext) (bool, []string)

Match always returns false without consuming any args

func (NopeMatcher) Priority

func (NopeMatcher) Priority() int

Priority returns the magic value 666

func (NopeMatcher) String

func (NopeMatcher) String() string

type TestMatcher

type TestMatcher struct {
	MatchFunc    func(args []string, c *matcher.ParseContext) (bool, []string)
	TestPriority int
}

TestMatcher is a matcher with a configurable match function and priority

func (TestMatcher) Match

func (t TestMatcher) Match(args []string, c *matcher.ParseContext) (bool, []string)

Match executes the provided match func

func (TestMatcher) Priority

func (t TestMatcher) Priority() int

Priority returns the provided priority

type YepMatcher

type YepMatcher struct{}

YepMatcher is a matcher that always succeeds without consuming any args

func (YepMatcher) Match

func (YepMatcher) Match(args []string, c *matcher.ParseContext) (bool, []string)

Match always returns true without consuming any args

func (YepMatcher) Priority

func (YepMatcher) Priority() int

Priority returns the magic value 666

func (YepMatcher) String

func (YepMatcher) String() string

Jump to

Keyboard shortcuts

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