playground

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EvalFn func(program any, env *object.Environment) object.Object

EvalFn evaluates an AST program in the given environment.

View Source
var FormatCallStackFn func(stack []object.CallFrame) string

FormatCallStackFn formats a call stack trace for display.

View Source
var IsErrorFn func(obj object.Object) bool

IsErrorFn returns true if the object is an Error.

View Source
var NewLexerFn func(input string) any

NewLexerFn creates a new lexer for the given input string.

View Source
var NewParserFn func(lexer any) any

NewParserFn creates a new parser from a lexer.

View Source
var ObjectErrorStringFn func(obj object.Object) string

ObjectErrorStringFn extracts the error message from an Error object.

View Source
var ParseProgramFn func(parser any) (program any, errors []string)

ParseProgramFn calls ParseProgram on the parser and returns (program, errors).

View Source
var WithSecurityPolicyOverrideFn func(policy *object.SecurityPolicy, fn func() (object.Object, error)) (object.Object, error)

WithSecurityPolicyOverrideFn temporarily overrides the active security policy while running fn.

Functions

func FormatParserErrors

func FormatParserErrors(errs []string) string

Types

type PlaygroundOptions

type PlaygroundOptions struct {
	Args           []string
	MaxDepth       int
	MaxSteps       int64
	MaxHeapMB      int64
	TimeoutMS      int64
	ModuleDir      string
	Security       *object.SecurityPolicy
	MaxOutputBytes int64
	RenderConfig   *object.RenderConfig
}

type PlaygroundResult

type PlaygroundResult struct {
	Output      string                       `json:"output"`
	Result      string                       `json:"result"`
	ResultTy    string                       `json:"result_type"`
	Error       string                       `json:"error"`
	ErrorKind   string                       `json:"error_kind"`
	Diagnostics []string                     `json:"diagnostics,omitempty"`
	Artifacts   []renderpkg.ResolvedArtifact `json:"artifacts,omitempty"`
	Duration    int64                        `json:"duration_ms"`
}

func EvalForPlayground

func EvalForPlayground(script string, opts PlaygroundOptions) PlaygroundResult

EvalForPlayground evaluates a script in a sandboxed playground context.

Jump to

Keyboard shortcuts

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