Documentation
¶
Index ¶
- Variables
- func DefaultSourceParserFunc(valuetype string, input string) (value interface{}, err error)
- func DefaultValidFunc(valuetype string, input string, strict bool) bool
- type CommandIterator
- func (ci *CommandIterator) Backup()
- func (ci *CommandIterator) First() bool
- func (ci *CommandIterator) HasVisualCharactor() bool
- func (ci *CommandIterator) Last() bool
- func (ci *CommandIterator) Next() (command string, err error)
- func (ci *CommandIterator) Reset()
- func (ci *CommandIterator) Restore()
- type CommandList
- type CommandWord
- type CommandWordDef
- type CommandWordDefElem
- type CommandWordGroup
- type SourceParserFunc
- type ValidFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var UndoIdentity int64 = 0x800001
UndoIdentity undo identity
Functions ¶
func DefaultSourceParserFunc ¶
DefaultSourceParserFunc parse input and assign value
Types ¶
type CommandIterator ¶
type CommandIterator struct {
Expression string
CommandKeywords []string
// contains filtered or unexported fields
}
CommandIterator command iterator
func NewCommandIterator ¶
func NewCommandIterator(expression string) (iter *CommandIterator)
NewCommandIterator 创建辛的迭代器
func (*CommandIterator) First ¶
func (ci *CommandIterator) First() bool
First whether it is first element
func (*CommandIterator) HasVisualCharactor ¶
func (ci *CommandIterator) HasVisualCharactor() bool
Last whether it is last element
func (*CommandIterator) Last ¶
func (ci *CommandIterator) Last() bool
Last whether it is last element
func (*CommandIterator) Next ¶
func (ci *CommandIterator) Next() (command string, err error)
Next 命令获取下一个
type CommandList ¶
type CommandList struct {
CommandWordGroups []CommandWordGroup
}
CommandList 命令参数
type CommandWord ¶
type CommandWord struct {
CommandWordDef
RequireCommands []CommandWord //必须的命令字
}
CommandWord 命令参数
type CommandWordDef ¶
type CommandWordDef struct {
Identity int64 // 命令字的ID
Name string // 命令行助记符
Helper string // 命令行帮助提示
Type string // 如果是 Name,就用助记符比较,如果是 Value,则用 Value 比较
ValueType string // 值类型, bool, integer, string
Value interface{} // 携带的值,初始值为默认值
DefaultValue interface{} // 初始值为默认值
SourceParser SourceParserFunc // 源解析函数,通过输入
ValidFunc ValidFunc // 值校验函数
}
CommandWordDef define command keyword
var DebugCommandDef CommandWordDef = CommandWordDef{
Name: "debugging",
Helper: "debugging operation",
Type: "name",
}
DebugCommandDef debug command define
var ResetCommandDef CommandWordDef = CommandWordDef{
Name: "reset",
Helper: "reset operation",
Type: "name",
}
ResetCommandDef reset command define
var ShowCommandDef CommandWordDef = CommandWordDef{
Name: "show",
Helper: "show operation",
Type: "name",
}
ShowCommandDef show information
var UndoCommandDef CommandWordDef = CommandWordDef{ Identity: UndoIdentity, Name: "undo", Helper: "undo operation", Type: "name", }
UndoCommandDef undo operation
func (*CommandWordDef) MatchCommandDef ¶
func (cw *CommandWordDef) MatchCommandDef(command string, strict bool) bool
MatchCommandDef 判断是否匹配
func (*CommandWordDef) MatchCommandDefByName ¶
func (cw *CommandWordDef) MatchCommandDefByName(command string, strict bool) bool
MatchCommandDefByName match by name
func (*CommandWordDef) MatchCommandDefByValue ¶
func (cw *CommandWordDef) MatchCommandDefByValue(command string, strict bool) bool
MatchCommandDefByValue match by value
type CommandWordDefElem ¶
type CommandWordDefElem struct {
CommandWordDefs []CommandWordDef
}
CommandWordDefElem 命令元组
type CommandWordGroup ¶
type CommandWordGroup struct {
Type string
IsWild bool
CommandWordDefElems []CommandWordDefElem
}
CommandWordGroup 元组
type SourceParserFunc ¶
SourceParserFunc func
Click to show internal directories.
Click to hide internal directories.