Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterOpcode ¶
Types ¶
type Context ¶
type Context interface { // 是否是严格模式 IsStrict() bool // 从栈顶弹出一个元素,未找到返回 nil Pop() interface{} // 压入一个元素到栈顶 Push(val interface{}) interface{} // 获取或设置一个变量 Var(name string, val ...interface{}) (interface{}, bool) // 打印一个对象到输出 Print(obj interface{}, escape bool) error // 启用一个新的域 Scope() error // 注销一个域 Unscope() error // 释放当前上下文 Free() Load(src, ref string) (Loader, error) Exec(loader Loader, ptr Ptr) error TemplateFunc(name string, fn ...TemplateFunc) TemplateFunc }
Context 表示一个运行时上下文
type Loader ¶
type Loader interface { ReadByte() (byte, error) ReadBool() (bool, error) ReadPtr() (Ptr, error) ReadInt() (int, error) ReadLong() (int64, error) ReadFloat() (float64, error) ReadString() (string, error) Load(ptr Ptr) (Opcode, error) TemplateName() string StartPtr() Ptr PutBlock(blockID string, block Opcode) GetBlock(blockID string) (block Opcode, ok bool) SetBody(body Loader, start Ptr) BodyLoader() (Loader, bool) BodyPtr() Ptr Close() error Blocks() map[string]Opcode }
type TemplateFunc ¶
type TemplateFunc func(...interface{}) (interface{}, error)
Click to show internal directories.
Click to hide internal directories.