Documentation ¶
Overview ¶
string stream protocol package provides a simple and efficient way to parse lab device communication streams
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrWrongResSyntax = errors.New("illegal syntax in response") ErrWrongReqSyntax = errors.New("illegal syntax in request") )
Functions ¶
Types ¶
type CommandPattern ¶
type CommandPattern struct {
// contains filtered or unexported fields
}
Keeps request and response tokens
type Item ¶
type Item struct {
// contains filtered or unexported fields
}
Main structure that keeps token type and its value.
func ItemsFromConfig ¶
Convert string input to set of Items config
type Lexer ¶
type Lexer struct { Input string //the input string being scanned ItemsCh chan Item //channel of scanned items State StateFn //current state of the state machine // contains filtered or unexported fields }
Define the lexer struct
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Main parser structure, based on vdfile generates map of commands, and then parses incoming messages
func (*Parser) Decode ¶
func (p *Parser) Decode(data []byte) ([]protocol.Transaction, error)
Method that fullfils main Protocol interface, all logic is implemented here. Based on byte input it returns transactions to be processed.
Click to show internal directories.
Click to hide internal directories.