activations

package
v0.14.3 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2021 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ValueType added in v0.14.0

type ValueType generic.Type

type ValueTypeActivation added in v0.14.0

type ValueTypeActivation struct {
	Depth  int
	Parent *ValueTypeActivation
	// contains filtered or unexported fields
}

A ValueTypeActivation is a map of strings to values. It can be used to represent an active scope in a program, i.e. it can be used as a symbol table during semantic analysis, or as an activation record during interpretation or compilation.

func NewValueTypeActivation added in v0.14.0

func NewValueTypeActivation(parent *ValueTypeActivation) *ValueTypeActivation

func (*ValueTypeActivation) Find added in v0.14.0

func (a *ValueTypeActivation) Find(name string) ValueType

Find returns the value for a given name in the activation. It returns nil if no value is found.

func (*ValueTypeActivation) Set added in v0.14.0

func (a *ValueTypeActivation) Set(name string, value ValueType)

Set sets the given name-value pair in the activation.

type ValueTypeActivations added in v0.14.0

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

Activations is a stack of activation records. Each entry represents a new activation record.

The current / most nested activation record can be found at the top of the stack (see function `Current`).

func (*ValueTypeActivations) Current added in v0.14.0

Current returns the current / most nested activation, which can be found at the top of the stack. It returns nil if there is no active activation.

func (*ValueTypeActivations) CurrentOrNew added in v0.14.0

func (a *ValueTypeActivations) CurrentOrNew() *ValueTypeActivation

CurrentOrNew returns the current activation, or if it does not exists, a new activation

func (*ValueTypeActivations) Depth added in v0.14.0

func (a *ValueTypeActivations) Depth() int

Depth returns the depth (size) of the activation stack.

func (*ValueTypeActivations) Find added in v0.14.0

func (a *ValueTypeActivations) Find(name string) ValueType

Find returns the value for a given key in the current activation. It returns nil if no value is found or if there is no current activation.

func (*ValueTypeActivations) Pop added in v0.14.0

func (a *ValueTypeActivations) Pop()

Pop pops the top-most (current) activation from the top of the activation stack.

func (*ValueTypeActivations) Push added in v0.14.0

func (a *ValueTypeActivations) Push(activation *ValueTypeActivation)

Push pushes the given activation onto the top of the activation stack.

func (*ValueTypeActivations) PushNewWithCurrent added in v0.14.0

func (a *ValueTypeActivations) PushNewWithCurrent()

PushNewWithCurrent pushes a new empty activation to the top of the activation stack. The new activation has the current activation as its parent.

func (*ValueTypeActivations) PushNewWithParent added in v0.14.0

func (a *ValueTypeActivations) PushNewWithParent(parent *ValueTypeActivation) *ValueTypeActivation

PushNewWithParent pushes a new empty activation to the top of the activation stack. The new activation has the given parent as its parent.

func (*ValueTypeActivations) Set added in v0.14.0

func (a *ValueTypeActivations) Set(name string, value ValueType)

Set sets the name-value pair in the current scope.

Jump to

Keyboard shortcuts

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