builtins

package
v0.0.0-...-e582a83 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLoadError

func NewLoadError(name string, callstack string) *loadError

func NewNameError

func NewNameError(name, context, className string, callStack string) *nameError

func NewNoMethodError

func NewNoMethodError(name, context, className, callstack string) *noMethodError

Types

type ArgEvaluator

type ArgEvaluator interface {
	EvaluateArgInContext(ast.Node, Value) (Value, error)
}

type Array

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

func (*Array) AddMethod

func (valueStub *Array) AddMethod(m Method)

func (*Array) Append

func (array *Array) Append(v Value)

func (*Array) Class

func (valueStub *Array) Class() Class

func (*Array) GetAttribute

func (v *Array) GetAttribute(name string) (Value, bool)

func (*Array) GetClassVariable

func (valueStub *Array) GetClassVariable(name string) Value

func (*Array) GetInstanceVariable

func (valueStub *Array) GetInstanceVariable(name string) Value

func (*Array) IsTruthy

func (v *Array) IsTruthy() bool

func (*Array) Members

func (array *Array) Members() []Value

func (*Array) Method

func (valueStub *Array) Method(name string) Method

func (*Array) Methods

func (valueStub *Array) Methods() []Method

func (*Array) PrettyPrint

func (valueStub *Array) PrettyPrint() string

func (*Array) RemoveMethod

func (valueStub *Array) RemoveMethod(m Method)

func (*Array) SetAttribute

func (v *Array) SetAttribute(name string, value Value)

func (*Array) SetClassVariable

func (valueStub *Array) SetClassVariable(name string, value Value)

func (*Array) SetInstanceVariable

func (valueStub *Array) SetInstanceVariable(name string, value Value)

func (*Array) String

func (array *Array) String() string

type ArrayClass

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

func (*ArrayClass) AddInstanceMethod

func (klass *ArrayClass) AddInstanceMethod(m Method)

func (*ArrayClass) AddMethod

func (valueStub *ArrayClass) AddMethod(m Method)

func (*ArrayClass) Class

func (valueStub *ArrayClass) Class() Class

func (*ArrayClass) GetAttribute

func (v *ArrayClass) GetAttribute(name string) (Value, bool)

func (*ArrayClass) GetClassVariable

func (valueStub *ArrayClass) GetClassVariable(name string) Value

func (*ArrayClass) GetInstanceVariable

func (valueStub *ArrayClass) GetInstanceVariable(name string) Value

func (*ArrayClass) Include

func (classStub *ArrayClass) Include(module Module)

func (*ArrayClass) IsTruthy

func (v *ArrayClass) IsTruthy() bool

func (*ArrayClass) Method

func (valueStub *ArrayClass) Method(name string) Method

func (*ArrayClass) Methods

func (valueStub *ArrayClass) Methods() []Method

func (*ArrayClass) Name

func (array *ArrayClass) Name() string

func (*ArrayClass) New

func (klass *ArrayClass) New(provider Provider, args ...Value) (Value, error)

func (*ArrayClass) PrettyPrint

func (valueStub *ArrayClass) PrettyPrint() string

func (*ArrayClass) RemoveMethod

func (valueStub *ArrayClass) RemoveMethod(m Method)

func (*ArrayClass) SetAttribute

func (v *ArrayClass) SetAttribute(name string, value Value)

func (*ArrayClass) SetClassVariable

func (valueStub *ArrayClass) SetClassVariable(name string, value Value)

func (*ArrayClass) SetInstanceVariable

func (valueStub *ArrayClass) SetInstanceVariable(name string, value Value)

func (*ArrayClass) String

func (array *ArrayClass) String() string

func (*ArrayClass) SuperClass

func (classStub *ArrayClass) SuperClass() Class

type BasicObjectClass

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

func (*BasicObjectClass) AddMethod

func (valueStub *BasicObjectClass) AddMethod(m Method)

func (*BasicObjectClass) Class

func (valueStub *BasicObjectClass) Class() Class

func (*BasicObjectClass) GetAttribute

func (v *BasicObjectClass) GetAttribute(name string) (Value, bool)

func (*BasicObjectClass) GetClassVariable

func (valueStub *BasicObjectClass) GetClassVariable(name string) Value

func (*BasicObjectClass) GetInstanceVariable

func (valueStub *BasicObjectClass) GetInstanceVariable(name string) Value

func (*BasicObjectClass) Include

func (classStub *BasicObjectClass) Include(module Module)

func (*BasicObjectClass) IsTruthy

func (v *BasicObjectClass) IsTruthy() bool

func (*BasicObjectClass) Method

func (valueStub *BasicObjectClass) Method(name string) Method

func (*BasicObjectClass) Methods

func (valueStub *BasicObjectClass) Methods() []Method

func (*BasicObjectClass) Name

func (obj *BasicObjectClass) Name() string

func (*BasicObjectClass) New

func (obj *BasicObjectClass) New(provider Provider, args ...Value) (Value, error)

func (*BasicObjectClass) PrettyPrint

func (valueStub *BasicObjectClass) PrettyPrint() string

func (*BasicObjectClass) RemoveMethod

func (valueStub *BasicObjectClass) RemoveMethod(m Method)

func (*BasicObjectClass) SetAttribute

func (v *BasicObjectClass) SetAttribute(name string, value Value)

func (*BasicObjectClass) SetClassVariable

func (valueStub *BasicObjectClass) SetClassVariable(name string, value Value)

func (*BasicObjectClass) SetInstanceVariable

func (valueStub *BasicObjectClass) SetInstanceVariable(name string, value Value)

func (*BasicObjectClass) SetSuperClass

func (c *BasicObjectClass) SetSuperClass()

func (*BasicObjectClass) String

func (obj *BasicObjectClass) String() string

func (*BasicObjectClass) SuperClass

func (classStub *BasicObjectClass) SuperClass() Class

type Block

type Block interface {
	Call(args ...Value) (Value, error)
	// contains filtered or unexported methods
}

func NewBlock

func NewBlock(Context Value, args []ast.MethodParam, body []ast.Node, evaluator BlockEvaluator) Block

type BlockArg

type BlockArg struct {
	Name  string
	Value Value
}

type BlockEvaluator

type BlockEvaluator interface {
	EvaluateBlockWithArgsInContext(Value, []BlockArg, []ast.Node) (Value, error)
}

type Class

type Class interface {
	Module // includes Value

	New(provider Provider, args ...Value) (Value, error)

	SuperClass() Class

	Include(Module)
	// contains filtered or unexported methods
}

abstract class interface

func NewArgumentErrorClass

func NewArgumentErrorClass(provider Provider) Class

func NewArrayClass

func NewArrayClass(provider Provider) Class

func NewBasicObjectClass

func NewBasicObjectClass(provider Provider) Class

func NewClassClass

func NewClassClass(provider Provider) Class

func NewDirClass

func NewDirClass(provider Provider) Class

func NewEncodingClass

func NewEncodingClass(provider Provider) Class

func NewExceptionClass

func NewExceptionClass(provider Provider) Class

func NewFalseClass

func NewFalseClass(provider Provider) Class

func NewFileClass

func NewFileClass(provider Provider) Class

func NewFixnumClass

func NewFixnumClass(provider Provider) Class

func NewFloatClass

func NewFloatClass(provider Provider) Class

func NewGenericClass

func NewGenericClass(name, superClass string, provider Provider) Class

func NewGlobalObjectClass

func NewGlobalObjectClass(provider Provider) Class

func NewHashClass

func NewHashClass(provider Provider) Class

func NewIOClass

func NewIOClass(provider Provider) Class

func NewIntegerClass

func NewIntegerClass(provider Provider) Class

func NewModuleClass

func NewModuleClass(provider Provider, evaluator Evaluator) Class

func NewNilClass

func NewNilClass(provider Provider) Class

func NewNumericClass

func NewNumericClass(provider Provider) Class

func NewProcClass

func NewProcClass(provider Provider) Class

func NewRegexpClass

func NewRegexpClass(provider Provider) Class

func NewStandardErrorClass

func NewStandardErrorClass(provider Provider) Class

func NewStringClass

func NewStringClass(provider Provider) Class

func NewSymbolClass

func NewSymbolClass(provider Provider) Class

func NewTrueClass

func NewTrueClass(provider Provider) Class

func NewUserDefinedClass

func NewUserDefinedClass(name, superclassName string, provider Provider) Class

type ClassProvider

type ClassProvider interface {
	ClassWithName(string) Class
}

type ClassValue

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

globlal Class class

func (*ClassValue) AddMethod

func (valueStub *ClassValue) AddMethod(m Method)

func (*ClassValue) Class

func (valueStub *ClassValue) Class() Class

func (*ClassValue) GetAttribute

func (v *ClassValue) GetAttribute(name string) (Value, bool)

func (*ClassValue) GetClassVariable

func (valueStub *ClassValue) GetClassVariable(name string) Value

func (*ClassValue) GetInstanceVariable

func (valueStub *ClassValue) GetInstanceVariable(name string) Value

func (*ClassValue) Include

func (classStub *ClassValue) Include(module Module)

func (*ClassValue) IsTruthy

func (v *ClassValue) IsTruthy() bool

func (*ClassValue) Method

func (valueStub *ClassValue) Method(name string) Method

func (*ClassValue) Methods

func (valueStub *ClassValue) Methods() []Method

func (ClassValue) Name

func (c ClassValue) Name() string

func (ClassValue) New

func (c ClassValue) New(provider Provider, args ...Value) (Value, error)

func (*ClassValue) PrettyPrint

func (valueStub *ClassValue) PrettyPrint() string

func (*ClassValue) RemoveMethod

func (valueStub *ClassValue) RemoveMethod(m Method)

func (*ClassValue) SetAttribute

func (v *ClassValue) SetAttribute(name string, value Value)

func (*ClassValue) SetClassVariable

func (valueStub *ClassValue) SetClassVariable(name string, value Value)

func (*ClassValue) SetInstanceVariable

func (valueStub *ClassValue) SetInstanceVariable(name string, value Value)

func (*ClassValue) SetSuperClass

func (c *ClassValue) SetSuperClass()

func (ClassValue) String

func (c ClassValue) String() string

func (*ClassValue) SuperClass

func (classStub *ClassValue) SuperClass() Class

type Evaluator

type Evaluator interface {
	EvaluateStringInContext(string, Value) (Value, error)
	EvaluateStringInContextAndNewStack(string, Value) (Value, error)
}

type FloatValue

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

func (*FloatValue) AddMethod

func (valueStub *FloatValue) AddMethod(m Method)

func (*FloatValue) Class

func (valueStub *FloatValue) Class() Class

func (*FloatValue) GetAttribute

func (v *FloatValue) GetAttribute(name string) (Value, bool)

func (*FloatValue) GetClassVariable

func (valueStub *FloatValue) GetClassVariable(name string) Value

func (*FloatValue) GetInstanceVariable

func (valueStub *FloatValue) GetInstanceVariable(name string) Value

func (*FloatValue) IsTruthy

func (v *FloatValue) IsTruthy() bool

func (*FloatValue) Method

func (valueStub *FloatValue) Method(name string) Method

func (*FloatValue) Methods

func (valueStub *FloatValue) Methods() []Method

func (*FloatValue) PrettyPrint

func (valueStub *FloatValue) PrettyPrint() string

func (*FloatValue) RemoveMethod

func (valueStub *FloatValue) RemoveMethod(m Method)

func (*FloatValue) SetAttribute

func (v *FloatValue) SetAttribute(name string, value Value)

func (*FloatValue) SetClassVariable

func (valueStub *FloatValue) SetClassVariable(name string, value Value)

func (*FloatValue) SetInstanceVariable

func (valueStub *FloatValue) SetInstanceVariable(name string, value Value)

func (*FloatValue) String

func (FloatValue *FloatValue) String() string

func (*FloatValue) ValueAsFloat

func (FloatValue *FloatValue) ValueAsFloat() float64

type Hash

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

func (*Hash) Add

func (hash *Hash) Add(key, value Value)

func (*Hash) AddMethod

func (valueStub *Hash) AddMethod(m Method)

func (*Hash) Class

func (valueStub *Hash) Class() Class

func (*Hash) GetAttribute

func (v *Hash) GetAttribute(name string) (Value, bool)

func (*Hash) GetClassVariable

func (valueStub *Hash) GetClassVariable(name string) Value

func (*Hash) GetInstanceVariable

func (valueStub *Hash) GetInstanceVariable(name string) Value

func (*Hash) IsTruthy

func (v *Hash) IsTruthy() bool

func (*Hash) Method

func (valueStub *Hash) Method(name string) Method

func (*Hash) Methods

func (valueStub *Hash) Methods() []Method

func (*Hash) PrettyPrint

func (valueStub *Hash) PrettyPrint() string

func (*Hash) RemoveMethod

func (valueStub *Hash) RemoveMethod(m Method)

func (*Hash) SetAttribute

func (v *Hash) SetAttribute(name string, value Value)

func (*Hash) SetClassVariable

func (valueStub *Hash) SetClassVariable(name string, value Value)

func (*Hash) SetInstanceVariable

func (valueStub *Hash) SetInstanceVariable(name string, value Value)

func (*Hash) String

func (hash *Hash) String() string

type HashClass

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

func (*HashClass) AddInstanceMethod

func (klass *HashClass) AddInstanceMethod(m Method)

func (*HashClass) AddMethod

func (valueStub *HashClass) AddMethod(m Method)

func (*HashClass) Class

func (valueStub *HashClass) Class() Class

func (*HashClass) GetAttribute

func (v *HashClass) GetAttribute(name string) (Value, bool)

func (*HashClass) GetClassVariable

func (valueStub *HashClass) GetClassVariable(name string) Value

func (*HashClass) GetInstanceVariable

func (valueStub *HashClass) GetInstanceVariable(name string) Value

func (*HashClass) Include

func (classStub *HashClass) Include(module Module)

func (*HashClass) IsTruthy

func (v *HashClass) IsTruthy() bool

func (*HashClass) Method

func (valueStub *HashClass) Method(name string) Method

func (*HashClass) Methods

func (valueStub *HashClass) Methods() []Method

func (*HashClass) Name

func (hash *HashClass) Name() string

func (*HashClass) New

func (klass *HashClass) New(provider Provider, args ...Value) (Value, error)

func (*HashClass) PrettyPrint

func (valueStub *HashClass) PrettyPrint() string

func (*HashClass) RemoveMethod

func (valueStub *HashClass) RemoveMethod(m Method)

func (*HashClass) SetAttribute

func (v *HashClass) SetAttribute(name string, value Value)

func (*HashClass) SetClassVariable

func (valueStub *HashClass) SetClassVariable(name string, value Value)

func (*HashClass) SetInstanceVariable

func (valueStub *HashClass) SetInstanceVariable(name string, value Value)

func (*HashClass) String

func (hash *HashClass) String() string

func (*HashClass) SuperClass

func (classStub *HashClass) SuperClass() Class

type Method

type Method interface {
	Value

	Name() string
	IsPrivate() bool
	IsPublic() bool
	IsProtected() bool

	Execute(self Value, block Block, args ...Value) (Value, error)

	Visibility() MethodVisibility
	SetVisibility(MethodVisibility)
	// contains filtered or unexported methods
}

func NewNativeMethod

func NewNativeMethod(name string, provider Provider, body func(self Value, block Block, args ...Value) (Value, error)) Method

func NewNativePrivateMethod

func NewNativePrivateMethod(name string, provider Provider, body func(self Value, block Block, args ...Value) (Value, error)) Method

func NewPrivateRubyMethod

func NewPrivateRubyMethod(
	name string,
	lineNumber int,
	args []ast.MethodParam,
	rubyBody []ast.Node,
	provider Provider,
	evaluator ArgEvaluator,
	body func(self Value, method *RubyMethod) (Value, error),
) Method

func NewRubyMethod

func NewRubyMethod(
	name string,
	lineNumber int,
	args []ast.MethodParam,
	rubyBody []ast.Node,
	provider Provider,
	evaluator ArgEvaluator,
	body func(self Value, method *RubyMethod) (Value, error),
) Method

type MethodProvider

type MethodProvider interface {
	AddMethod(name string, context Value, body func(self Value, block Block, args ...Value) (Value, error))
}

type MethodVisibility

type MethodVisibility int
const (
	Public MethodVisibility = iota
	Private
	Protected
)

type Module

type Module interface {
	Name() string
	AddInstanceMethod(Method)
	RemoveInstanceMethod(Method)

	InstanceMethods() []Method
	InstanceMethod(string) (Method, error)

	Constants() []Value
	ConstantsWithNames() map[string]Value
	Constant(string) (Value, error)
	SetConstant(string, Value)

	Value

	ActiveVisibility() MethodVisibility
	SetActiveVisibility(MethodVisibility)
}

abstract module interface

func NewComparableModule

func NewComparableModule(provider Provider) Module

func NewGenericModule

func NewGenericModule(name string, provider Provider) Module

func NewGlobalKernelModule

func NewGlobalKernelModule(provider Provider) Module

func NewModule

func NewModule(name string, provider Provider) Module

func NewProcessModule

func NewProcessModule(provider Provider) Module

type ModuleClass

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

globlal Module class

func (*ModuleClass) AddMethod

func (valueStub *ModuleClass) AddMethod(m Method)

func (*ModuleClass) Class

func (valueStub *ModuleClass) Class() Class

func (*ModuleClass) GetAttribute

func (v *ModuleClass) GetAttribute(name string) (Value, bool)

func (*ModuleClass) GetClassVariable

func (valueStub *ModuleClass) GetClassVariable(name string) Value

func (*ModuleClass) GetInstanceVariable

func (valueStub *ModuleClass) GetInstanceVariable(name string) Value

func (*ModuleClass) Include

func (classStub *ModuleClass) Include(module Module)

func (*ModuleClass) IsTruthy

func (v *ModuleClass) IsTruthy() bool

func (*ModuleClass) Method

func (valueStub *ModuleClass) Method(name string) Method

func (*ModuleClass) Methods

func (valueStub *ModuleClass) Methods() []Method

func (ModuleClass) Name

func (c ModuleClass) Name() string

func (ModuleClass) New

func (c ModuleClass) New(provider Provider, args ...Value) (Value, error)

func (*ModuleClass) PrettyPrint

func (valueStub *ModuleClass) PrettyPrint() string

func (*ModuleClass) RemoveMethod

func (valueStub *ModuleClass) RemoveMethod(m Method)

func (*ModuleClass) SetAttribute

func (v *ModuleClass) SetAttribute(name string, value Value)

func (*ModuleClass) SetClassVariable

func (valueStub *ModuleClass) SetClassVariable(name string, value Value)

func (*ModuleClass) SetInstanceVariable

func (valueStub *ModuleClass) SetInstanceVariable(name string, value Value)

func (ModuleClass) String

func (c ModuleClass) String() string

func (*ModuleClass) SuperClass

func (classStub *ModuleClass) SuperClass() Class

type NilClass

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

func (*NilClass) AddMethod

func (valueStub *NilClass) AddMethod(m Method)

func (*NilClass) Class

func (valueStub *NilClass) Class() Class

func (*NilClass) GetAttribute

func (v *NilClass) GetAttribute(name string) (Value, bool)

func (*NilClass) GetClassVariable

func (valueStub *NilClass) GetClassVariable(name string) Value

func (*NilClass) GetInstanceVariable

func (valueStub *NilClass) GetInstanceVariable(name string) Value

func (*NilClass) Include

func (classStub *NilClass) Include(module Module)

func (*NilClass) IsTruthy

func (v *NilClass) IsTruthy() bool

func (*NilClass) Method

func (valueStub *NilClass) Method(name string) Method

func (*NilClass) Methods

func (valueStub *NilClass) Methods() []Method

func (*NilClass) Name

func (n *NilClass) Name() string

func (*NilClass) New

func (class *NilClass) New(provider Provider, args ...Value) (Value, error)

func (*NilClass) PrettyPrint

func (valueStub *NilClass) PrettyPrint() string

func (*NilClass) RemoveMethod

func (valueStub *NilClass) RemoveMethod(m Method)

func (*NilClass) SetAttribute

func (v *NilClass) SetAttribute(name string, value Value)

func (*NilClass) SetClassVariable

func (valueStub *NilClass) SetClassVariable(name string, value Value)

func (*NilClass) SetInstanceVariable

func (valueStub *NilClass) SetInstanceVariable(name string, value Value)

func (*NilClass) String

func (n *NilClass) String() string

func (*NilClass) SuperClass

func (classStub *NilClass) SuperClass() Class

type ObjectClass

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

func (*ObjectClass) AddMethod

func (valueStub *ObjectClass) AddMethod(m Method)

func (*ObjectClass) Class

func (valueStub *ObjectClass) Class() Class

func (*ObjectClass) GetAttribute

func (v *ObjectClass) GetAttribute(name string) (Value, bool)

func (*ObjectClass) GetClassVariable

func (valueStub *ObjectClass) GetClassVariable(name string) Value

func (*ObjectClass) GetInstanceVariable

func (valueStub *ObjectClass) GetInstanceVariable(name string) Value

func (*ObjectClass) Include

func (classStub *ObjectClass) Include(module Module)

func (*ObjectClass) IsTruthy

func (v *ObjectClass) IsTruthy() bool

func (*ObjectClass) Method

func (valueStub *ObjectClass) Method(name string) Method

func (*ObjectClass) Methods

func (valueStub *ObjectClass) Methods() []Method

func (*ObjectClass) Name

func (obj *ObjectClass) Name() string

func (*ObjectClass) New

func (obj *ObjectClass) New(provider Provider, args ...Value) (Value, error)

func (*ObjectClass) PrettyPrint

func (valueStub *ObjectClass) PrettyPrint() string

func (*ObjectClass) RemoveMethod

func (valueStub *ObjectClass) RemoveMethod(m Method)

func (*ObjectClass) SetAttribute

func (v *ObjectClass) SetAttribute(name string, value Value)

func (*ObjectClass) SetClassVariable

func (valueStub *ObjectClass) SetClassVariable(name string, value Value)

func (*ObjectClass) SetInstanceVariable

func (valueStub *ObjectClass) SetInstanceVariable(name string, value Value)

func (*ObjectClass) SetSuperClass

func (c *ObjectClass) SetSuperClass()

func (*ObjectClass) String

func (obj *ObjectClass) String() string

func (*ObjectClass) SuperClass

func (classStub *ObjectClass) SuperClass() Class

type Proc

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

func NewProcInstance

func NewProcInstance(methodName string, provider Provider) *Proc

func (*Proc) AddMethod

func (valueStub *Proc) AddMethod(m Method)

func (*Proc) Call

func (proc *Proc) Call(args ...Value) (Value, error)

func (*Proc) Class

func (valueStub *Proc) Class() Class

func (*Proc) GetAttribute

func (v *Proc) GetAttribute(name string) (Value, bool)

func (*Proc) GetClassVariable

func (valueStub *Proc) GetClassVariable(name string) Value

func (*Proc) GetInstanceVariable

func (valueStub *Proc) GetInstanceVariable(name string) Value

func (*Proc) IsTruthy

func (v *Proc) IsTruthy() bool

func (*Proc) Method

func (valueStub *Proc) Method(name string) Method

func (*Proc) Methods

func (valueStub *Proc) Methods() []Method

func (*Proc) PrettyPrint

func (valueStub *Proc) PrettyPrint() string

func (*Proc) RemoveMethod

func (valueStub *Proc) RemoveMethod(m Method)

func (*Proc) SetAttribute

func (v *Proc) SetAttribute(name string, value Value)

func (*Proc) SetClassVariable

func (valueStub *Proc) SetClassVariable(name string, value Value)

func (*Proc) SetInstanceVariable

func (valueStub *Proc) SetInstanceVariable(name string, value Value)

func (*Proc) String

func (valueStub *Proc) String() string

type ProcClass

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

func (*ProcClass) AddMethod

func (valueStub *ProcClass) AddMethod(m Method)

func (*ProcClass) Class

func (valueStub *ProcClass) Class() Class

func (*ProcClass) GetAttribute

func (v *ProcClass) GetAttribute(name string) (Value, bool)

func (*ProcClass) GetClassVariable

func (valueStub *ProcClass) GetClassVariable(name string) Value

func (*ProcClass) GetInstanceVariable

func (valueStub *ProcClass) GetInstanceVariable(name string) Value

func (*ProcClass) Include

func (classStub *ProcClass) Include(module Module)

func (*ProcClass) IsTruthy

func (v *ProcClass) IsTruthy() bool

func (*ProcClass) Method

func (valueStub *ProcClass) Method(name string) Method

func (*ProcClass) Methods

func (valueStub *ProcClass) Methods() []Method

func (*ProcClass) Name

func (proc *ProcClass) Name() string

func (*ProcClass) New

func (klass *ProcClass) New(provider Provider, args ...Value) (Value, error)

func (*ProcClass) PrettyPrint

func (valueStub *ProcClass) PrettyPrint() string

func (*ProcClass) RemoveMethod

func (valueStub *ProcClass) RemoveMethod(m Method)

func (*ProcClass) SetAttribute

func (v *ProcClass) SetAttribute(name string, value Value)

func (*ProcClass) SetClassVariable

func (valueStub *ProcClass) SetClassVariable(name string, value Value)

func (*ProcClass) SetInstanceVariable

func (valueStub *ProcClass) SetInstanceVariable(name string, value Value)

func (*ProcClass) String

func (proc *ProcClass) String() string

func (*ProcClass) SuperClass

func (classStub *ProcClass) SuperClass() Class

type Provider

type Provider interface {
	ArgEvaluator() ArgEvaluator
	ClassProvider() ClassProvider
	SingletonProvider() SingletonProvider
	StackProvider() StackProvider
	MethodProvider() MethodProvider
}

type Regexp

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

func (*Regexp) AddMethod

func (valueStub *Regexp) AddMethod(m Method)

func (*Regexp) Class

func (valueStub *Regexp) Class() Class

func (*Regexp) GetAttribute

func (v *Regexp) GetAttribute(name string) (Value, bool)

func (*Regexp) GetClassVariable

func (valueStub *Regexp) GetClassVariable(name string) Value

func (*Regexp) GetInstanceVariable

func (valueStub *Regexp) GetInstanceVariable(name string) Value

func (*Regexp) IsTruthy

func (v *Regexp) IsTruthy() bool

func (*Regexp) Method

func (valueStub *Regexp) Method(name string) Method

func (*Regexp) Methods

func (valueStub *Regexp) Methods() []Method

func (*Regexp) PrettyPrint

func (valueStub *Regexp) PrettyPrint() string

func (*Regexp) RemoveMethod

func (valueStub *Regexp) RemoveMethod(m Method)

func (*Regexp) SetAttribute

func (v *Regexp) SetAttribute(name string, value Value)

func (*Regexp) SetClassVariable

func (valueStub *Regexp) SetClassVariable(name string, value Value)

func (*Regexp) SetInstanceVariable

func (valueStub *Regexp) SetInstanceVariable(name string, value Value)

func (*Regexp) String

func (regexp *Regexp) String() string

type RubyMethod

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

func (*RubyMethod) AddMethod

func (valueStub *RubyMethod) AddMethod(m Method)

func (*RubyMethod) Args

func (method *RubyMethod) Args() []methodArg

func (*RubyMethod) Body

func (method *RubyMethod) Body() []ast.Node

func (*RubyMethod) Class

func (valueStub *RubyMethod) Class() Class

func (*RubyMethod) Execute

func (method *RubyMethod) Execute(self Value, block Block, args ...Value) (Value, error)

func (*RubyMethod) GetAttribute

func (v *RubyMethod) GetAttribute(name string) (Value, bool)

func (*RubyMethod) GetClassVariable

func (valueStub *RubyMethod) GetClassVariable(name string) Value

func (*RubyMethod) GetInstanceVariable

func (valueStub *RubyMethod) GetInstanceVariable(name string) Value

func (*RubyMethod) IsPrivate

func (method *RubyMethod) IsPrivate() bool

func (*RubyMethod) IsProtected

func (method *RubyMethod) IsProtected() bool

func (*RubyMethod) IsPublic

func (method *RubyMethod) IsPublic() bool

func (*RubyMethod) IsTruthy

func (v *RubyMethod) IsTruthy() bool

func (*RubyMethod) Method

func (valueStub *RubyMethod) Method(name string) Method

func (*RubyMethod) Methods

func (valueStub *RubyMethod) Methods() []Method

func (*RubyMethod) Name

func (method *RubyMethod) Name() string

func (*RubyMethod) PrettyPrint

func (valueStub *RubyMethod) PrettyPrint() string

func (*RubyMethod) RemoveMethod

func (valueStub *RubyMethod) RemoveMethod(m Method)

func (*RubyMethod) SetAttribute

func (v *RubyMethod) SetAttribute(name string, value Value)

func (*RubyMethod) SetClassVariable

func (valueStub *RubyMethod) SetClassVariable(name string, value Value)

func (*RubyMethod) SetInstanceVariable

func (valueStub *RubyMethod) SetInstanceVariable(name string, value Value)

func (*RubyMethod) SetVisibility

func (method *RubyMethod) SetVisibility(visibility MethodVisibility)

func (*RubyMethod) String

func (method *RubyMethod) String() string

FIXME: in order to fix this, the method needs to know what it is attached to

func (*RubyMethod) Visibility

func (method *RubyMethod) Visibility() MethodVisibility

type RubyModule

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

user defined module type

func (*RubyModule) ActiveVisibility

func (m *RubyModule) ActiveVisibility() MethodVisibility

func (*RubyModule) AddInstanceMethod

func (m *RubyModule) AddInstanceMethod(method Method)

func (*RubyModule) AddMethod

func (valueStub *RubyModule) AddMethod(m Method)

func (*RubyModule) Class

func (valueStub *RubyModule) Class() Class

func (*RubyModule) Constant

func (m *RubyModule) Constant(name string) (Value, error)

func (*RubyModule) Constants

func (m *RubyModule) Constants() []Value

func (*RubyModule) ConstantsWithNames

func (m *RubyModule) ConstantsWithNames() map[string]Value

func (*RubyModule) GetAttribute

func (v *RubyModule) GetAttribute(name string) (Value, bool)

func (*RubyModule) GetClassVariable

func (valueStub *RubyModule) GetClassVariable(name string) Value

func (*RubyModule) GetInstanceVariable

func (valueStub *RubyModule) GetInstanceVariable(name string) Value

func (*RubyModule) InstanceMethod

func (m *RubyModule) InstanceMethod(name string) (Method, error)

func (*RubyModule) InstanceMethods

func (m *RubyModule) InstanceMethods() []Method

func (*RubyModule) IsTruthy

func (v *RubyModule) IsTruthy() bool

func (*RubyModule) Method

func (valueStub *RubyModule) Method(name string) Method

func (*RubyModule) Methods

func (valueStub *RubyModule) Methods() []Method

func (RubyModule) Name

func (m RubyModule) Name() string

func (*RubyModule) PrettyPrint

func (valueStub *RubyModule) PrettyPrint() string

func (*RubyModule) RemoveInstanceMethod

func (m *RubyModule) RemoveInstanceMethod(method Method)

func (*RubyModule) RemoveMethod

func (valueStub *RubyModule) RemoveMethod(m Method)

func (*RubyModule) SetActiveVisibility

func (m *RubyModule) SetActiveVisibility(visibility MethodVisibility)

func (*RubyModule) SetAttribute

func (v *RubyModule) SetAttribute(name string, value Value)

func (*RubyModule) SetClassVariable

func (valueStub *RubyModule) SetClassVariable(name string, value Value)

func (*RubyModule) SetConstant

func (m *RubyModule) SetConstant(name string, value Value)

func (*RubyModule) SetInstanceVariable

func (valueStub *RubyModule) SetInstanceVariable(name string, value Value)

func (*RubyModule) String

func (m *RubyModule) String() string

type SingletonProvider

type SingletonProvider interface {
	SingletonWithName(string) Value
	NewSingletonWithName(string, Value)

	SymbolWithName(string) Value
	AddSymbol(Value)
}

type StackProvider

type StackProvider interface {
	CurrentStack() string
	UnshiftStackFrame(string, string, int)
	ShiftStackFrame()
}

type StringClass

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

func (*StringClass) AddMethod

func (valueStub *StringClass) AddMethod(m Method)

func (*StringClass) Class

func (valueStub *StringClass) Class() Class

func (*StringClass) GetAttribute

func (v *StringClass) GetAttribute(name string) (Value, bool)

func (*StringClass) GetClassVariable

func (valueStub *StringClass) GetClassVariable(name string) Value

func (*StringClass) GetInstanceVariable

func (valueStub *StringClass) GetInstanceVariable(name string) Value

func (*StringClass) Include

func (classStub *StringClass) Include(module Module)

func (*StringClass) IsTruthy

func (v *StringClass) IsTruthy() bool

func (*StringClass) Method

func (valueStub *StringClass) Method(name string) Method

func (*StringClass) Methods

func (valueStub *StringClass) Methods() []Method

func (*StringClass) Name

func (c *StringClass) Name() string

func (*StringClass) New

func (class *StringClass) New(provider Provider, args ...Value) (Value, error)

func (*StringClass) PrettyPrint

func (valueStub *StringClass) PrettyPrint() string

func (*StringClass) RemoveMethod

func (valueStub *StringClass) RemoveMethod(m Method)

func (*StringClass) SetAttribute

func (v *StringClass) SetAttribute(name string, value Value)

func (*StringClass) SetClassVariable

func (valueStub *StringClass) SetClassVariable(name string, value Value)

func (*StringClass) SetInstanceVariable

func (valueStub *StringClass) SetInstanceVariable(name string, value Value)

func (*StringClass) String

func (c *StringClass) String() string

func (*StringClass) SuperClass

func (classStub *StringClass) SuperClass() Class

type StringValue

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

func (*StringValue) AddMethod

func (valueStub *StringValue) AddMethod(m Method)

func (*StringValue) Class

func (valueStub *StringValue) Class() Class

func (*StringValue) GetAttribute

func (v *StringValue) GetAttribute(name string) (Value, bool)

func (*StringValue) GetClassVariable

func (valueStub *StringValue) GetClassVariable(name string) Value

func (*StringValue) GetInstanceVariable

func (valueStub *StringValue) GetInstanceVariable(name string) Value

func (*StringValue) IsTruthy

func (v *StringValue) IsTruthy() bool

func (*StringValue) Method

func (valueStub *StringValue) Method(name string) Method

func (*StringValue) Methods

func (valueStub *StringValue) Methods() []Method

func (*StringValue) PrettyPrint

func (s *StringValue) PrettyPrint() string

func (*StringValue) RawString

func (s *StringValue) RawString() string

func (*StringValue) RemoveMethod

func (valueStub *StringValue) RemoveMethod(m Method)

func (*StringValue) SetAttribute

func (v *StringValue) SetAttribute(name string, value Value)

func (*StringValue) SetClassVariable

func (valueStub *StringValue) SetClassVariable(name string, value Value)

func (*StringValue) SetInstanceVariable

func (valueStub *StringValue) SetInstanceVariable(name string, value Value)

func (*StringValue) String

func (s *StringValue) String() string

type SymbolValue

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

func (*SymbolValue) AddMethod

func (valueStub *SymbolValue) AddMethod(m Method)

func (*SymbolValue) Class

func (valueStub *SymbolValue) Class() Class

func (*SymbolValue) GetAttribute

func (v *SymbolValue) GetAttribute(name string) (Value, bool)

func (*SymbolValue) GetClassVariable

func (valueStub *SymbolValue) GetClassVariable(name string) Value

func (*SymbolValue) GetInstanceVariable

func (valueStub *SymbolValue) GetInstanceVariable(name string) Value

func (*SymbolValue) IsTruthy

func (v *SymbolValue) IsTruthy() bool

func (*SymbolValue) Method

func (valueStub *SymbolValue) Method(name string) Method

func (*SymbolValue) Methods

func (valueStub *SymbolValue) Methods() []Method

func (*SymbolValue) Name

func (SymbolValue *SymbolValue) Name() string

func (*SymbolValue) PrettyPrint

func (valueStub *SymbolValue) PrettyPrint() string

func (*SymbolValue) RemoveMethod

func (valueStub *SymbolValue) RemoveMethod(m Method)

func (*SymbolValue) SetAttribute

func (v *SymbolValue) SetAttribute(name string, value Value)

func (*SymbolValue) SetClassVariable

func (valueStub *SymbolValue) SetClassVariable(name string, value Value)

func (*SymbolValue) SetInstanceVariable

func (valueStub *SymbolValue) SetInstanceVariable(name string, value Value)

func (*SymbolValue) String

func (SymbolValue *SymbolValue) String() string

type UserDefinedClass

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

user defined class type

func (*UserDefinedClass) AddMethod

func (valueStub *UserDefinedClass) AddMethod(m Method)

func (*UserDefinedClass) Class

func (c *UserDefinedClass) Class() Class

func (*UserDefinedClass) GetAttribute

func (v *UserDefinedClass) GetAttribute(name string) (Value, bool)

func (*UserDefinedClass) GetClassVariable

func (valueStub *UserDefinedClass) GetClassVariable(name string) Value

func (*UserDefinedClass) GetInstanceVariable

func (valueStub *UserDefinedClass) GetInstanceVariable(name string) Value

func (*UserDefinedClass) Include

func (classStub *UserDefinedClass) Include(module Module)

func (*UserDefinedClass) IsTruthy

func (v *UserDefinedClass) IsTruthy() bool

func (*UserDefinedClass) Method

func (valueStub *UserDefinedClass) Method(name string) Method

func (*UserDefinedClass) Methods

func (valueStub *UserDefinedClass) Methods() []Method

func (UserDefinedClass) Name

func (c UserDefinedClass) Name() string

func (*UserDefinedClass) New

func (c *UserDefinedClass) New(provider Provider, args ...Value) (Value, error)

func (*UserDefinedClass) PrettyPrint

func (valueStub *UserDefinedClass) PrettyPrint() string

func (*UserDefinedClass) RemoveMethod

func (valueStub *UserDefinedClass) RemoveMethod(m Method)

func (*UserDefinedClass) SetAttribute

func (v *UserDefinedClass) SetAttribute(name string, value Value)

func (*UserDefinedClass) SetClassVariable

func (valueStub *UserDefinedClass) SetClassVariable(name string, value Value)

func (*UserDefinedClass) SetInstanceVariable

func (valueStub *UserDefinedClass) SetInstanceVariable(name string, value Value)

func (UserDefinedClass) String

func (c UserDefinedClass) String() string

func (*UserDefinedClass) SuperClass

func (classStub *UserDefinedClass) SuperClass() Class

type UserDefinedClassInstance

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

func (*UserDefinedClassInstance) AddMethod

func (valueStub *UserDefinedClassInstance) AddMethod(m Method)

func (*UserDefinedClassInstance) Class

func (valueStub *UserDefinedClassInstance) Class() Class

func (*UserDefinedClassInstance) GetAttribute

func (v *UserDefinedClassInstance) GetAttribute(name string) (Value, bool)

func (*UserDefinedClassInstance) GetClassVariable

func (valueStub *UserDefinedClassInstance) GetClassVariable(name string) Value

func (*UserDefinedClassInstance) GetInstanceVariable

func (valueStub *UserDefinedClassInstance) GetInstanceVariable(name string) Value

func (*UserDefinedClassInstance) IsTruthy

func (v *UserDefinedClassInstance) IsTruthy() bool

func (*UserDefinedClassInstance) Method

func (valueStub *UserDefinedClassInstance) Method(name string) Method

func (*UserDefinedClassInstance) Methods

func (valueStub *UserDefinedClassInstance) Methods() []Method

func (*UserDefinedClassInstance) PrettyPrint

func (valueStub *UserDefinedClassInstance) PrettyPrint() string

func (*UserDefinedClassInstance) RemoveMethod

func (valueStub *UserDefinedClassInstance) RemoveMethod(m Method)

func (*UserDefinedClassInstance) SetAttribute

func (v *UserDefinedClassInstance) SetAttribute(name string, value Value)

func (*UserDefinedClassInstance) SetClassVariable

func (valueStub *UserDefinedClassInstance) SetClassVariable(name string, value Value)

func (*UserDefinedClassInstance) SetInstanceVariable

func (valueStub *UserDefinedClassInstance) SetInstanceVariable(name string, value Value)

func (*UserDefinedClassInstance) String

func (i *UserDefinedClassInstance) String() string

type Value

type Value interface {
	String() string
	PrettyPrint() string

	Class() Class

	AddMethod(Method)
	RemoveMethod(Method)
	Method(string) Method
	Methods() []Method

	GetInstanceVariable(string) Value
	SetInstanceVariable(string, Value)

	GetClassVariable(string) Value
	SetClassVariable(string, Value)

	IsTruthy() bool

	GetAttribute(string) (Value, bool)
	SetAttribute(string, Value)
	// contains filtered or unexported methods
}

func NewENVConstant

func NewENVConstant(provider Provider) Value

func NewFixnum

func NewFixnum(val int64, provider Provider) Value

func NewFloat

func NewFloat(val float64, provider Provider) Value

func NewRegexp

func NewRegexp(provider Provider, expr string) Value

func NewString

func NewString(str string, provider Provider) Value

func NewSymbol

func NewSymbol(val string, provider Provider) Value

Jump to

Keyboard shortcuts

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