repl

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: UNKNOWN not legal advice Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Repl

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

func NewRepl

func NewRepl(opts ...ReplOption) *Repl

NewRepl creates a Repl struct. It is able to process input source code and eventually run it.

func (*Repl) Debug

func (r *Repl) Debug()

Debug activates the GnoVM debugger for the next evaluation.

func (*Repl) Process

func (r *Repl) Process(input string) (out string, err error)

Process accepts any valid Gno source code and executes it if it is an expression, or stores it for later use if they are declarations. If the provided input is not valid Gno source code, an error is returned. If the execution on the VM is not successful, the panic is recovered and returned as an error.

func (*Repl) Reset

func (r *Repl) Reset()

Reset will reset the actual repl state, restarting the internal VM.

func (*Repl) Src

func (r *Repl) Src() string

Src will print all the valid code introduced on this Repl session.

type ReplOption

type ReplOption func(*Repl)

func WithStd

func WithStd(stdin io.Reader, stdout, stderr io.Writer) ReplOption

WithStd changes std's reader and writers implementations. An internal bytes.Buffer is used by default.

func WithStore

func WithStore(s gno.Store) ReplOption

WithStore allows to modify the default Store implementation used by the VM. If nil is provided, the VM will use a default implementation.

Jump to

Keyboard shortcuts

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