computation

package
v0.0.0-...-6247a41 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDanglingScope = fmt.Errorf("scopes stack is not empty: %w", io.EOF)

Return by Step if there are open scopes in the end of source code

Functions

This section is empty.

Types

type CommandError

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

Return by Step if there an error returned by a command

func (CommandError) Error

func (e CommandError) Error() string

func (CommandError) Unwrap

func (e CommandError) Unwrap() error

type Computation

type Computation[T state.StateType] struct {
	// contains filtered or unexported fields
}

Represent the computaion of a source code against specified state and commands

func New

func New[T state.StateType](
	ctx context.Context,
	state state.State[T],
	commandsMap map[rune]commands.Command[T],
	source io.ReadCloser,
) *Computation[T]

Return a new computaion. The reader get closed on cancelation or end of execution

func (*Computation[T]) Cancel

func (c *Computation[T]) Cancel()

Cancel the computation

func (*Computation[T]) Step

func (c *Computation[T]) Step() error

Move the computaion one step forward.

type UnknownCommandError

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

Return by Step if source contain an unknown command

func (UnknownCommandError) Error

func (e UnknownCommandError) Error() string

Jump to

Keyboard shortcuts

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