wast

package
v0.7.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 19, 2021 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Overview

Package wast provides functions to handle wast files.

See https://webassembly.github.io/spec/core/text/

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteTo

func WriteTo(w io.Writer, m *wasm.Module) error

WriteTo writes a WASM module in a text representation.

Types

type Scanner

type Scanner struct {
	Line   int
	Column int

	Errors []error
	// contains filtered or unexported fields
}

func NewScanner

func NewScanner(path string) *Scanner

func (*Scanner) Next

func (s *Scanner) Next() (token *Token)

type Token

type Token struct {
	Kind   TokenKind
	Text   string
	Line   int
	Column int
	Data   interface{} // may be nil
}

func (*Token) Copy

func (t *Token) Copy() *Token

func (*Token) String

func (t *Token) String() string

type TokenKind

type TokenKind int
const (
	NAT TokenKind = iota
	INT
	FLOAT
	STRING
	VAR
	VALUE_TYPE
	ANYFUNC
	MUT
	LPAR
	RPAR

	NOP
	DROP
	BLOCK
	END
	IF
	THEN
	ELSE
	SELECT
	LOOP
	BR
	BR_IF
	BR_TABLE

	CALL
	CALL_INDIRECT
	RETURN
	GET_LOCAL
	SET_LOCAL
	TEE_LOCAL
	GET_GLOBAL
	SET_GLOBAL

	LOAD
	STORE
	OFFSET_EQ_NAT
	ALIGN_EQ_NAT

	CONST
	LOAD_8
	LOAD_16
	LOAD_32
	STORE_8
	STORE_16
	STORE_32

	CLZ
	CTZ
	POPCNT
	NEG
	ABS
	SQRT
	CEIL
	FLOOR
	TRUNC
	NEAREST

	ADD
	SUB
	MUL
	DIV_S
	DIV_U
	REM_S
	REM_U
	AND
	OR
	XOR
	SHL
	SHR_S
	SHR_U
	ROTL
	ROTR
	MIN
	MAX
	COPYSIGN

	EQZ
	EQ
	NE
	LT_S
	LT_U
	LE_S
	LE_U
	GT_S
	GT_U
	GE_S
	GE_U
	LT
	LE
	GT
	GE

	WRAP
	EXTEND_S
	EXTEND_U
	DEMOTE
	PROMOTE
	TRUNC_S_F32
	TRUNC_U_F32
	TRUNC_S_F64
	TRUNC_U_F64
	CONVERT_S_I32
	CONVERT_U_I32
	CONVERT_S_I64
	CONVERT_U_I64
	REINTERPRET_I32
	REINTERPRET_I64
	REINTERPRET_F32
	REINTERPRET_F64

	UNREACHABLE
	CURRENT_MEMORY
	GROW_MEMORY

	FUNC
	START
	TYPE
	PARAM
	RESULT
	LOCAL
	GLOBAL

	TABLE
	ELEM
	MEMORY
	DATA
	OFFSET
	IMPORT
	EXPORT

	MODULE
	BIN
	QUOTE

	SCRIPT
	REGISTER
	INVOKE
	GET

	ASSERT_MALFORMED
	ASSERT_INVALID
	ASSERT_SOFT_INVALID
	ASSERT_UNLINKABLE
	ASSERT_RETURN
	ASSERT_RETURN_CANONICAL_NAN
	ASSERT_RETURN_ARITHMETIC_NAN
	ASSERT_TRAP
	ASSERT_EXHAUSTION
	INPUT
	OUTPUT
	EOF
)

func (TokenKind) String

func (t TokenKind) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL