runtime

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2024 License: EPL-1.0 Imports: 18 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SymbolUnquote       = value.NewSymbol("clojure.core/unquote") // TODO: rename to glojure.core/unquote
	SymbolSpliceUnquote = value.NewSymbol("splice-unquote")
	SymbolNamespace     = value.NewSymbol("ns")
	SymbolInNamespace   = value.NewSymbol("in-ns")
	SymbolUserNamespace = value.NewSymbol("user")
	SymbolDot           = value.NewSymbol(".")
)
View Source
var (
	Debug = false

	SymNS   = value.NewSymbol("ns")
	SymInNS = value.NewSymbol("in-ns")
)
View Source
var (
	Compiler = &evalCompiler{}
)
View Source
var (
	RT = &RTMethods{}
)

Functions

func AddLoadPath

func AddLoadPath(fs fs.FS)

AddLoadPath adds a filesystem to the load path.

func NewEnvironment

func NewEnvironment(opts ...EvalOption) value.Environment

func RTReadString

func RTReadString(s string) interface{}

func ReadEval

func ReadEval(code string, options ...ReadEvalOption) interface{}

ReadEval reads and evaluates a string that may contain one or more forms in the global environment.

Types

type EvalError

type EvalError struct {
	Err      error
	GLJStack []string
	GoStack  string
}

func (*EvalError) Error

func (e *EvalError) Error() string

func (*EvalError) Is

func (e *EvalError) Is(err error) bool

func (*EvalError) Unwrap

func (e *EvalError) Unwrap() error

type EvalOption

type EvalOption func(*evalOptions)

func WithLoadPath

func WithLoadPath(path []string) EvalOption

func WithStderr

func WithStderr(w io.Writer) EvalOption

func WithStdout

func WithStdout(w io.Writer) EvalOption

type Fn

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

func NewFn

func NewFn(astNode *ast.Node, env lang.Environment) *Fn

func (*Fn) ApplyTo

func (fn *Fn) ApplyTo(args lang.ISeq) interface{}

func (*Fn) Invoke

func (fn *Fn) Invoke(args ...interface{}) interface{}

func (*Fn) Meta

func (fn *Fn) Meta() lang.IPersistentMap

func (*Fn) WithMeta

func (fn *Fn) WithMeta(meta lang.IPersistentMap) interface{}

type Program

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

func (*Program) Eval

func (p *Program) Eval(opts ...EvalOption) (interface{}, error)

type RTMethods

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

RT is a struct with methods that map to Clojure's RT class' static methods. This approach is used to make translation of core.clj to Glojure easier.

func (*RTMethods) Alength

func (rt *RTMethods) Alength(x interface{}) int

func (*RTMethods) BooleanCast

func (rt *RTMethods) BooleanCast(x interface{}) bool

func (*RTMethods) ByteCast

func (rt *RTMethods) ByteCast(x interface{}) byte

func (*RTMethods) CharCast

func (rt *RTMethods) CharCast(x interface{}) Char

func (*RTMethods) Contains

func (rt *RTMethods) Contains(coll, key interface{}) bool

func (*RTMethods) Dissoc

func (rt *RTMethods) Dissoc(x interface{}, k interface{}) interface{}

func (*RTMethods) Find

func (rt *RTMethods) Find(coll, key interface{}) interface{}

func (*RTMethods) FindVar

func (rt *RTMethods) FindVar(qualifiedSym *Symbol) *Var

func (*RTMethods) IntCast

func (rt *RTMethods) IntCast(x interface{}) int

func (*RTMethods) Load

func (rt *RTMethods) Load(scriptBase string)

func (*RTMethods) Munge

func (rt *RTMethods) Munge(name string) string

func (*RTMethods) NextID

func (rt *RTMethods) NextID() int

func (*RTMethods) Nth

func (rt *RTMethods) Nth(x interface{}, i int) interface{}

func (*RTMethods) NthDefault

func (rt *RTMethods) NthDefault(x interface{}, i int, def interface{}) interface{}

func (*RTMethods) Peek added in v0.2.1

func (rt *RTMethods) Peek(x interface{}) interface{}

func (*RTMethods) Pop

func (rt *RTMethods) Pop(x interface{}) interface{}

func (*RTMethods) Subvec

func (rt *RTMethods) Subvec(v IPersistentVector, start, end int) IPersistentVector

func (*RTMethods) ToArray

func (rt *RTMethods) ToArray(coll interface{}) interface{}

func (*RTMethods) UncheckedCharCast

func (rt *RTMethods) UncheckedCharCast(x interface{}) Char

type ReadEvalOption

type ReadEvalOption func(*readEvalOptions)

ReadEvalOption is an option for ReadEval.

func WithEnv

func WithEnv(env value.Environment) ReadEvalOption

WithEnv sets the environment to use for evaluation.

func WithFilename

func WithFilename(filename string) ReadEvalOption

WithFilename sets the filename to use for evaluation.

Jump to

Keyboard shortcuts

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