object

package
v0.0.0-...-1e04c87 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NULL_OBJ  = "NULL"
	ERROR_OBJ = "ERROR"

	INTEGER_OBJ = "INTEGER"
	BOOLEAN_OBJ = "BOOLEAN"
	STRING_OBJ  = "STRING"

	RETURN_VALUE_OBJ = "RETURN_VALUE"

	FUNCTION_OBJ = "FUNCTION"
	BUILTIN_OBJ  = "BUILTIN"
	FLAG_OBJ     = "FLAG"

	ARRAY_OBJ = "ARRAY"
	HASH_OBJ  = "HASH"

	PIPES_OBJ = "PIPES"

	BACKTICK_OBJ = "BACKTICK"

	QUOTE_OBJ = "QUOTE"
	MACRO_OBJ = "MACRO"
)
View Source
const (
	Bool = 0
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Array

type Array struct {
	Elements []Object
}

func (*Array) Inspect

func (ao *Array) Inspect() string

func (*Array) Type

func (ao *Array) Type() ObjectType

type BacktickExpression

type BacktickExpression struct {
	Value string
}

func (*BacktickExpression) HashKey

func (s *BacktickExpression) HashKey() HashKey

func (*BacktickExpression) Inspect

func (s *BacktickExpression) Inspect() string

func (*BacktickExpression) Type

func (s *BacktickExpression) Type() ObjectType

type Boolean

type Boolean struct {
	Value bool
}

func (*Boolean) HashKey

func (b *Boolean) HashKey() HashKey

func (*Boolean) Inspect

func (b *Boolean) Inspect() string

func (*Boolean) Type

func (b *Boolean) Type() ObjectType

type Builtin

type Builtin struct {
	Fn    BuiltinFunction
	Flags []Flag
	Help  string
}

func (*Builtin) Inspect

func (b *Builtin) Inspect() string

func (*Builtin) Type

func (b *Builtin) Type() ObjectType

type BuiltinFunction

type BuiltinFunction func(scope Scope, args ...Object) (Operation, error)

type Environment

type Environment struct {
	Streams Streams
	// contains filtered or unexported fields
}

func NewEnclosedEnvironment

func NewEnclosedEnvironment(outer *Environment) *Environment

func NewEnvironment

func NewEnvironment(streams Streams) *Environment

func (*Environment) Export

func (e *Environment) Export() map[string]interface{}

func (*Environment) Get

func (e *Environment) Get(name string) (Object, bool)

func (*Environment) Set

func (e *Environment) Set(name string, val Object) Object

type Error

type Error struct {
	Message string
}

func NewError

func NewError(format string, a ...interface{}) *Error

func (*Error) Inspect

func (e *Error) Inspect() string

func (*Error) Type

func (e *Error) Type() ObjectType

type Flag

type Flag struct {
	Name      string
	ParamType ObjectType
	Param     Object
	Help      string
}

func (*Flag) Inspect

func (b *Flag) Inspect() string

func (*Flag) Type

func (b *Flag) Type() ObjectType

type Function

type Function struct {
	Parameters []*ast.Identifier
	Body       *ast.BlockStatement
	Env        *Environment
}

func (*Function) Inspect

func (f *Function) Inspect() string

func (*Function) Type

func (f *Function) Type() ObjectType

type Hash

type Hash struct {
	Pairs map[HashKey]HashPair
}

func (*Hash) Inspect

func (h *Hash) Inspect() string

func (*Hash) Type

func (h *Hash) Type() ObjectType

type HashKey

type HashKey struct {
	Type  ObjectType
	Value uint64
}

type HashPair

type HashPair struct {
	Key   Object
	Value Object
}

type Hashable

type Hashable interface {
	HashKey() HashKey
}

type Integer

type Integer struct {
	Value int64
}

func (*Integer) HashKey

func (i *Integer) HashKey() HashKey

func (*Integer) Inspect

func (i *Integer) Inspect() string

func (*Integer) Type

func (i *Integer) Type() ObjectType

type Macro

type Macro struct {
	Parameters []*ast.Identifier
	Body       *ast.BlockStatement
	Env        *Environment
}

func (*Macro) Inspect

func (m *Macro) Inspect() string

func (*Macro) Type

func (m *Macro) Type() ObjectType

type Null

type Null struct{}

func (*Null) Inspect

func (n *Null) Inspect() string

func (*Null) Type

func (n *Null) Type() ObjectType

type Object

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

type ObjectType

type ObjectType string

type Operation

type Operation func() Object

helper for async/sync versions of functions.

type Pipes

type Pipes ast.Pipes

// Pipes are the outcome of an exec'd command

type Pipes struct {
	Out  io.ReadCloser
	Err  io.ReadCloser
	Wait func() error
}

func (*Pipes) Inspect

func (h *Pipes) Inspect() string

func (*Pipes) Type

func (h *Pipes) Type() ObjectType

type Quote

type Quote struct {
	Node ast.Node
}

func (*Quote) Inspect

func (q *Quote) Inspect() string

func (*Quote) Type

func (q *Quote) Type() ObjectType

type ReturnValue

type ReturnValue struct {
	Value Object
}

func (*ReturnValue) Inspect

func (rv *ReturnValue) Inspect() string

func (*ReturnValue) Type

func (rv *ReturnValue) Type() ObjectType

type Scope

type Scope struct {
	Env     *Environment
	In, Out *ast.Pipes
}

Scope for a builtin function

type Streams

type Streams struct {
	Stdin  io.Reader
	Stdout io.Writer
	Stderr io.Writer
}

type String

type String struct {
	Value string
}

func (*String) HashKey

func (s *String) HashKey() HashKey

func (*String) Inspect

func (s *String) Inspect() string

func (*String) Type

func (s *String) Type() ObjectType

Jump to

Keyboard shortcuts

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