func (m *DFA) States() []State {
	q := make([]State, 0, len(m.q))
	for s, _ := range m.q {
		q = append(q, s)
	}
	return q
}
States of the DFA.
package dfa
import (
	"bytes"
	"fmt"
)
type State string
func (s State) String() string {
	return string(s)
}
type Letter string
func (l Letter) String() string {
	return string(l)
}
type DFA struct {
	q      map[State]bool                      
	e      map[Letter]bool                     
	d      map[domainelement]*codomainelement  
	q0     State                               
	f      map[State]bool                      
	done   chan laststate                      
	input  *Letter                             
	stop   chan struct{}                       
	logger func(State)                         
}
type domainelement struct {
	l Letter
	s State
}
type codomainelement struct {
	s    State
	exec interface{}
}
type laststate struct {
	s        State
	accepted bool
}
func New() *DFA {
	return &DFA{
		q:      make(map[State]bool),
		e:      make(map[Letter]bool),
		f:      make(map[State]bool),
		d:      make(map[domainelement]*codomainelement),
		done:   make(chan laststate, 1),
		stop:   make(chan struct{}),
		logger: func(State) {},
	}
}
func (m *DFA) SetTransition(from State, input Letter, to State, exec interface{}) {
	if exec == nil {
		panic("stateful computation cannot be nil")
	}
	if from == State("") || to == State("") {
		panic("state cannot be defined as the empty string")
	}
	switch exec.(type) {
	case func():
		if !m.f[to] {
			panic(fmt.Sprintf("stateful computation must be of type 'func() Letter' for non-terminal '%v' state", to))
		}
	case func() Letter:
		if m.f[to] {
			panic(fmt.Sprintf("stateful computation must be of type 'func()' for terminal '%v' state", to))
		}
	default:
		panic("stateful computation must be of type 'func()' or 'func() Letter")
	}
	m.q[to] = true
	m.q[from] = true
	m.e[input] = true
	de := domainelement{l: input, s: from}
	if _, ok := m.d[de]; !ok {
		m.d[de] = &codomainelement{s: to, exec: exec}
	}
}
func (m *DFA) SetStartState(q0 State) {
	m.q0 = q0
}
func (m *DFA) SetTerminalStates(f ...State) {
	for _, q := range f {
		m.f[q] = true
	}
}
func (m *DFA) SetTransitionLogger(logger func(State)) {
	m.logger = logger
}