eval

package
v0.0.0-...-3085ebc Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NUMBER_OBJ  = "NUMBER"
	NIL_OBJ     = "NIL_OBJ"
	BOOLEAN_OBJ = "BOOLEAN"
)

Variables

View Source
var (
	TRUE  = &Boolean{Bool: true}
	FALSE = &Boolean{Bool: false}
	NIL   = &Nil{}
)

Functions

This section is empty.

Types

type Boolean

type Boolean struct {
	Bool bool
}

func NewBooleanObj

func NewBooleanObj(b bool) *Boolean

func (*Boolean) Inspect

func (b *Boolean) Inspect() string

func (*Boolean) Type

func (b *Boolean) Type() ObjectType

type Nil

type Nil struct {
}

func NewNil

func NewNil(s string) *Nil

func (*Nil) Inspect

func (n *Nil) Inspect() string

func (*Nil) Type

func (n *Nil) Type() ObjectType

type Number

type Number struct {
	Value float64
}

func NewNumber

func NewNumber(f float64) *Number

func (*Number) Inspect

func (n *Number) Inspect() string

func (*Number) Type

func (n *Number) Type() ObjectType

type Object

type Object interface {
	Type() ObjectType
	Inspect() string
}

func Eval

func Eval(node ast.Node) (val Object)

type ObjectType

type ObjectType string

object

type Scope

type Scope struct {
	Writer io.Writer
	// contains filtered or unexported fields
}

func NewScope

func NewScope(p *Scope, w io.Writer) *Scope

func (*Scope) DebugPrint

func (s *Scope) DebugPrint(indent string)

func (*Scope) Del

func (s *Scope) Del(name string)

func (*Scope) Get

func (s *Scope) Get(name string) (Object, bool)

func (*Scope) GetKeys

func (s *Scope) GetKeys() []string

Get all the keys of the scope.

func (*Scope) Set

func (s *Scope) Set(name string, val Object) Object

Jump to

Keyboard shortcuts

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