Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewFsm ¶
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) String ¶
func (YepMatcher) String() string