Documentation ¶
Index ¶
Constants ¶
const ( // InstructionMaxLength is the maximum number of characters per // instruction. InstructionMaxLength = 8192 // InstructionMaxDigits is the maximum number of digits to allow per // length prefix. InstructionMaxDigits = 5 // InstructionMaxElements is the maximum number of elements per // instruction, including the opcode. InstructionMaxElements = 128 )
const MaxInstructionLength = 8192
MaxInstructionLength is the maximum number of characters per instruction.
Variables ¶
var ( ErrInstructionMissDot = errors.New("instruction without dot") ErrInstructionMissComma = errors.New("instruction without comma") ErrInstructionMissSemi = errors.New("instruction withou semi") ErrInstructionBadDigit = errors.New("instruction with bad digit") ErrInstructionBadRune = errors.New("instruction with bad rune") )
Errors while parsing instruction
Functions ¶
This section is empty.
Types ¶
type IO ¶
type IO struct {
// contains filtered or unexported fields
}
IO is a fd wrap that implements io.Reader and io.Writer
type Instruction ¶
type Instruction struct {
// contains filtered or unexported fields
}
Instruction is a guacamole instruction
func NewInstruction ¶
func NewInstruction(elements []string) *Instruction
NewInstruction creates a instruction with given elements
func ParseInstruction ¶
func ParseInstruction(raw []byte) (ins *Instruction, err error)
ParseInstruction parses an instruction: 1.a,2.bc,3.def,10.abcdefghij;
func (Instruction) Args ¶
func (i Instruction) Args() []string
Args returns the arguments of an instruction
func (Instruction) Opcode ¶
func (i Instruction) Opcode() string
Opcode returns the opcode of an instruction
func (Instruction) String ¶
func (i Instruction) String() string
type InstructionIO ¶
type InstructionIO struct {
// contains filtered or unexported fields
}
InstructionIO implements io.Reader and io.Writer
func (*InstructionIO) Read ¶
func (io *InstructionIO) Read() (*Instruction, error)
Read reads and parses the instruction from io input
func (*InstructionIO) ReadRaw ¶
func (io *InstructionIO) ReadRaw() ([]byte, error)
ReadRaw reads raw data from io input
func (*InstructionIO) Write ¶
func (io *InstructionIO) Write(ins *Instruction) (int, error)
Write writes and decodes an instruction to io output
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser parses an occamy instruction
type ParserState ¶
type ParserState int
ParserState is the parsing state of a parser
const ( ParserStateLength ParserState = iota ParserStateContent ParserStateComplete ParserStateError )
All possible states of the instruction parser.