Documentation
¶
Index ¶
Constants ¶
View Source
const ( NUL byte = 0x00 SOH byte = 0x01 STX byte = 0x02 ETX byte = 0x03 EOT byte = 0x04 ENQ byte = 0x05 ACK byte = 0x06 BEL byte = 0x07 BS byte = 0x08 HT byte = 0x09 LF byte = 0x0A VT byte = 0x0B FF byte = 0x0C CR byte = 0x0D SO byte = 0x0E SI byte = 0x0F DLE byte = 0x10 DC1 byte = 0x11 DC2 byte = 0x12 DC3 byte = 0x13 DC4 byte = 0x14 NAK byte = 0x15 SYN byte = 0x16 ETB byte = 0x17 CAN byte = 0x18 EM byte = 0x19 SUB byte = 0x1A ESC byte = 0x1B FS byte = 0x1C GS byte = 0x1D RS byte = 0x1E US byte = 0x1F )
Variables ¶
View Source
var ( PrintableChars8Bit = []byte{} /* 226 elements not displayed */ PrintableChars7Bit = []byte{10, 13, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127} )
View Source
var ASCIIMapNotPrintable = map[byte]string{
0: "<NUL>",
1: "<SOH>",
2: "<STX>",
3: "<ETX>",
4: "<EOT>",
5: "<ENQ>",
6: "<ACK>",
7: "<BEL>",
8: "<BS>",
9: "<HT>",
10: "<LF>",
11: "<VT>",
12: "<FF>",
13: "<CR>",
14: "<SO>",
15: "<SI>",
16: "<DLE>",
17: "<DC1>",
18: "<DC2>",
19: "<DC3>",
20: "<DC4>",
21: "<NAK>",
22: "<SYN>",
23: "<ETB>",
24: "<CAN>",
25: "<EM>",
26: "<SUB>",
27: "<ESC>",
28: "<FS>",
29: "<GS>",
30: "<RS>",
31: "<US>",
}
View Source
var (
ErrInvalidCharacter = errors.New("invalid character")
)
Functions ¶
This section is empty.
Types ¶
type ActionCode ¶
type ActionCode string
const ( Consumed ActionCode = "" Ok ActionCode = "" Start ActionCode = "Start" CheckSum ActionCode = "CheckSum" ProcessMessage ActionCode = "ProcessMessage" Error ActionCode = "Error" RequestFinished ActionCode = "RequestFinished" Finished ActionCode = "Finished" )
type FiniteStateMachine ¶
type FiniteStateMachine interface { Push(token byte) ([]byte, ActionCode, error) ResetBuffer() Init() }
func CreateFSM ¶
func CreateFSM(data []Rule) FiniteStateMachine
type Rule ¶
type Rule struct { FromState State // Current state Symbols []byte // Any of these symbols will trigger this transition ToState State // Target state of transition ActionCode ActionCode // Define an action to perform when this rule is used Scan bool // If enabled the character is added to the buffer }
The rule describes the transtion from each state to another. The transition is performed with every new character.
Click to show internal directories.
Click to hide internal directories.