Documentation
¶
Index ¶
- type Builder
- type Link
- type SerState
- type SerTransducer
- type SerTransition
- type Transducer
- func (ft Transducer) Down(s *state, out io.Writer) error
- func (ft Transducer) GetSerialization() SerTransducer
- func (ft Transducer) Initial() *state
- func (ft Transducer) Rewrite(s *state, str string, out io.Writer) (*state, error)
- func (ft Transducer) RewriteAll(in io.Reader, out io.Writer, delim byte) error
- func (ft Transducer) Walk(f func(link Link) bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
A Builder builds failure transducers.
type Link ¶
type Link struct {
Source, Target *state
Transition transition
}
Link is a triple that represents a transition in the transducer. It contains the source and target states and the transition between them.
type SerState ¶
type SerState struct { Foutput string Id, Ftarget uint64 Ts []SerTransition }
type SerTransducer ¶
type SerTransition ¶
type Transducer ¶
type Transducer struct {
// contains filtered or unexported fields
}
Transducer with failure links. It holds an initial state. An empty Transducer simply copies the input to the ouptput.
func NewTransducerFromSerialization ¶
func NewTransducerFromSerialization(ser SerTransducer) Transducer
NewTransducerFromSerialization creates a new transducer from a SerTransducer.
func (Transducer) Down ¶
func (ft Transducer) Down(s *state, out io.Writer) error
Down follows the failure links down to the initial state of the Transducer.
func (Transducer) GetSerialization ¶
func (ft Transducer) GetSerialization() SerTransducer
GetSerialization returns a SerTransducer that can be serialized.
func (Transducer) Initial ¶
func (ft Transducer) Initial() *state
Initial returns the initial state of a Transducer.
func (Transducer) Rewrite ¶
func (ft Transducer) Rewrite(s *state, str string, out io.Writer) (*state, error)
Rewrite rewrites a string with a transducer.
func (Transducer) RewriteAll ¶
RewriteAll reads input from a reader and rewrites it to a writer. It uses delim to as separator for read chunks.
func (Transducer) Walk ¶
func (ft Transducer) Walk(f func(link Link) bool)
Walk iterates over the transducer in depth first order.