asm

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2025 License: LGPL-3.0 Imports: 16 Imported by: 3

Documentation

Overview

Package asm implements the Good Ethereum Assembler (geas).

For a description of the geas language, see the README.md file in the project root.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsWarning added in v0.2.0

func IsWarning(err error) bool

IsWarning reports whether an error is a warning.

Types

type Compiler

type Compiler struct {
	// contains filtered or unexported fields
}

Compiler turns assembly source into bytecode.

func New added in v0.2.1

func New(fsys fs.FS) *Compiler

New creates a compiler. The file system is used to resolve import file names. If a nil FS is given, #import cannot be used.

func NewCompiler

func NewCompiler(fsys fs.FS) *Compiler

NewCompiler creates a compiler. Deprecated: use New.

func (*Compiler) ClearGlobals added in v0.2.2

func (c *Compiler) ClearGlobals()

ClearGlobals removes all definitions created by SetGlobal.

func (*Compiler) CompileFile

func (c *Compiler) CompileFile(filename string) []byte

CompileString compiles the given program text and returns the corresponding bytecode. If compilation fails, the returned slice is nil. Use the Errors method to get parsing/compilation errors.

func (*Compiler) CompileString

func (c *Compiler) CompileString(input string) []byte

CompileString compiles the given program text and returns the corresponding bytecode. If compilation fails, the returned slice is nil. Use the Errors method to get parsing/compilation errors.

func (*Compiler) Errors

func (c *Compiler) Errors() []error

Errors returns errors that have accumulated during compilation.

func (*Compiler) ErrorsAndWarnings added in v0.2.0

func (c *Compiler) ErrorsAndWarnings() []error

ErrorsAndWarnings returns all errors and warnings which have accumulated during compilation.

func (*Compiler) Failed added in v0.2.0

func (c *Compiler) Failed() bool

Failed reports whether compilation has failed.

func (*Compiler) SetDebugLexer

func (c *Compiler) SetDebugLexer(on bool)

SetDebugLexer enables/disables printing of the token stream to stdout.

func (*Compiler) SetDefaultFork added in v0.2.0

func (c *Compiler) SetDefaultFork(f string)

SetDefaultFork sets the EVM instruction set used by default.

func (*Compiler) SetFilesystem added in v0.2.1

func (c *Compiler) SetFilesystem(fsys fs.FS)

SetFilesystem sets the file system used for resolving #include files. Note: if set to a nil FS, #include is not allowed.

func (*Compiler) SetGlobal added in v0.2.2

func (c *Compiler) SetGlobal(name string, value *big.Int)

SetGlobal sets the value of a global expression macro. Note the name must start with an uppercase letter to make it global.

func (*Compiler) SetIncludeDepthLimit

func (c *Compiler) SetIncludeDepthLimit(limit int)

SetDebugLexer enables/disables printing of the token stream to stdout.

func (*Compiler) SetMaxErrors

func (c *Compiler) SetMaxErrors(limit int)

SetMaxErrors sets the limit on the number of errors that can happen before the compiler gives up.

func (*Compiler) Warnings added in v0.2.0

func (c *Compiler) Warnings() []error

Warnings returns all warnings that have accumulated during compilation.

type PositionError

type PositionError interface {
	error
	Position() ast.Position
}

PositionError is an error containing a file position.

type Warning added in v0.2.0

type Warning interface {
	error
	IsWarning() bool
}

Warning is implemented by errors that could also be just a warning.

Jump to

Keyboard shortcuts

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