envir

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPoolSize = 0x20
	DefaultEnvSize  = 0xff
)
View Source
const (
	TRUE  = 1
	FALSE = 0
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ArrayEnv

type ArrayEnv struct {
	Values []interface{}
	Outer  Environment
	GoPool *pool.Pool
}

ArrayEnv 适用于自定义函数内部的环境 为什么这里敢直接写死数组大小 在创建函数内环境之前会 Lookup 实际需求大小 根据需求 size 创建

func NewArrayEnv

func NewArrayEnv(size int, p *pool.Pool, out Environment) *ArrayEnv

func (*ArrayEnv) Clone

func (a *ArrayEnv) Clone() Environment

func (*ArrayEnv) Get

func (a *ArrayEnv) Get(name string) interface{}

func (*ArrayEnv) GetNest

func (a *ArrayEnv) GetNest(nest, index int) interface{}

func (*ArrayEnv) GetPool

func (a *ArrayEnv) GetPool() *pool.Pool

func (*ArrayEnv) NewJob

func (a *ArrayEnv) NewJob(fn func()) bool

func (*ArrayEnv) Put

func (a *ArrayEnv) Put(name string, _ interface{})

func (*ArrayEnv) PutNest

func (a *ArrayEnv) PutNest(nest, index int, value interface{})

func (*ArrayEnv) PutNew

func (a *ArrayEnv) PutNew(name string, _ interface{})

func (*ArrayEnv) SetOuter

func (a *ArrayEnv) SetOuter(e Environment)

func (*ArrayEnv) Symbols

func (a *ArrayEnv) Symbols() *Symbols

func (*ArrayEnv) WaitJob

func (a *ArrayEnv) WaitJob() bool

func (*ArrayEnv) Where

func (a *ArrayEnv) Where(name string) Environment

type Environment

type Environment interface {
	Put(name string, value interface{})
	Get(name string) interface{}
	SetOuter(e Environment)
	Symbols() *Symbols
	PutNest(nest, index int, value interface{})
	GetNest(nest, index int) interface{}
	PutNew(name string, value interface{})
	Where(name string) Environment
	GetPool() *pool.Pool
	NewJob(fn func()) bool
	WaitJob() bool
	Clone() Environment
}

type GlobalEnv

type GlobalEnv struct {
	Names *Symbols
	// contains filtered or unexported fields
}

func NewGlobalEnv

func NewGlobalEnv(size int, poolSize int) *GlobalEnv

NewGlobalEnv 全局环境的实现

func (*GlobalEnv) Assign

func (r *GlobalEnv) Assign(index int, value interface{})

func (*GlobalEnv) Clone

func (r *GlobalEnv) Clone() Environment

func (*GlobalEnv) Get

func (r *GlobalEnv) Get(name string) interface{}

func (*GlobalEnv) GetNest

func (r *GlobalEnv) GetNest(nest, index int) interface{}

func (*GlobalEnv) GetPool

func (r *GlobalEnv) GetPool() *pool.Pool

func (*GlobalEnv) NewJob

func (r *GlobalEnv) NewJob(fn func()) bool

func (*GlobalEnv) Put

func (r *GlobalEnv) Put(name string, value interface{})

func (*GlobalEnv) PutNest

func (r *GlobalEnv) PutNest(nest, index int, value interface{})

func (*GlobalEnv) PutNew

func (r *GlobalEnv) PutNew(name string, value interface{})

func (*GlobalEnv) SetOuter

func (r *GlobalEnv) SetOuter(e Environment)

func (*GlobalEnv) Symbols

func (r *GlobalEnv) Symbols() *Symbols

func (*GlobalEnv) WaitJob

func (r *GlobalEnv) WaitJob() bool

func (*GlobalEnv) Where

func (r *GlobalEnv) Where(name string) Environment

type Location

type Location struct {
	Nest  int
	Index int
}

func NewLocation

func NewLocation(nest, index int) *Location

type Symbols

type Symbols struct {
	Outer *Symbols
	Table *base.Map[string, int]
}

func NewSymbols

func NewSymbols(outer *Symbols) *Symbols

func NewSymbolsNull

func NewSymbolsNull() *Symbols

func (*Symbols) Add

func (s *Symbols) Add(key string) int

func (*Symbols) Append

func (s *Symbols) Append(other *Symbols)

func (*Symbols) Find

func (s *Symbols) Find(key string) (int, bool)

func (*Symbols) Get

func (s *Symbols) Get(key string) *Location

func (*Symbols) GetNest

func (s *Symbols) GetNest(key string, nest int) *Location

func (*Symbols) Put

func (s *Symbols) Put(key string) *Location

func (*Symbols) PutNew

func (s *Symbols) PutNew(key string) int

func (*Symbols) Size

func (s *Symbols) Size() int

Jump to

Keyboard shortcuts

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