Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DataSection ¶
type DataSection struct { Doc string // 注释 Name string // 名字 Offset uint32 // 偏移量(0 表示自动计算) Value []byte // 初始化值 }
初始化数据
type ElemSection ¶
type ElemSection struct { Doc string // 注释 Offset uint32 // 偏移量(从 0 开始) Value string // 初始化值, 引用的是其他 func 的名字 }
表格元素数据
type Func ¶
type Func struct { Doc string // 注释 Name string // 函数名 ImportPath []string // 导入路径(仅针对导入对象) ExportName string // 导出名字 Type *FuncType // 函数类型 Body *FuncBody // 函数体 }
函数定义
type Global ¶
type Global struct { Doc string // 注释 Name string // 全局变量名 ImportPath []string // 导入路径(仅针对导入对象) ExportName string // 导出名字 Type string // 类型信息 Value string // 初始值(导入变量忽略) Mutable bool // 是否可写 }
全局变量
type Instruction ¶
type Instruction interface { DocString() string WATString() string // 支持缩进 // contains filtered or unexported methods }
指令对应接口
type Memory ¶
type Memory struct { Doc string // 注释 Name string // 内存对象的名字 ImportPath []string // 导入路径(仅针对导入对象) ExportName string // 导出名字 Pages int // 页数, 每页 64 KB Data []DataSection // 初始化数据, 可能重叠 }
内存信息
type Module ¶
type Module struct { Doc string // 注释 Name string // 模块的名字(可空) InitFn string // 初始化函数 MainFn string // 开始函数名字(可空) Memory *Memory // 内存对象, 包含 Data 信息(可空) Table *Table // 表格对象, 包含 Elem 信息(可空) Globals []Global // 全局对象 Funcs []Func // 函数对象 }
Module 表示一个 WASM 模块。
type Position ¶
type Position struct { Filename string // 文件名 Offset int // 偏移量, 从 0 开始 Line int // 行号, 从 1 开始 Column int // 列号, 从 1 开始 }
行列号位置
func (Position) String ¶
String returns a string in one of several forms:
file:line:column valid position with file name file:line valid position with file name but no column (column == 0) line:column valid position without file name line valid position without file name and no column (column == 0) file invalid position with file name - invalid position without file name
type Table ¶
type Table struct { Doc string // 注释 Name string // Table对象的名字 ImportPath []string // 导入路径(仅针对导入对象) ExportName string // 导出名字 Size int // 表格容量 Type string // 元素类型, 默认为 anyfunc Elem []ElemSection // 初始化数据 }
Table 信息
type TokenKind ¶
type TokenKind int
记号类型
const ( // 非法/结尾/注释 ILLEGAL TokenKind = iota EOF COMMENT INSTRUCTION // 指令, 比如 global.get IDENT // 表示符, 比如 $name INT // 12345 FLOAT // 123.45 CHAR // 'a' STRING // "abc" LPAREN // ( RPAREN // ) I32 // i32 I64 // i64 F32 // f32 F64 // f64 MODULE // module IMPORT // import EXPORT // export MEMORY // memory TABLE // table GLOBAL // global LOCAL // local DATA // data ELEM // elem TYPE // type FUNC // func PARAM // param RESULT // result START // start )
Source Files
¶
Click to show internal directories.
Click to hide internal directories.