yaegicore

package
v0.3.8 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2025 License: BSD-3-Clause Imports: 12 Imported by: 2

Documentation

Overview

Package yaegicore provides functions connecting https://github.com/cogentcore/yaegi to Cogent Core.

Index

Constants

This section is empty.

Variables

View Source
var Interpreters = map[string]func(options interp.Options) Interpreter{
	"Go": func(options interp.Options) Interpreter {
		return interp.New(options)
	},
}

Interpreters is a map from language names (such as "Go") to functions that create a new Interpreter for that language. The base implementation is just interp.Interpreter for Go, but other packages can extend this. See the Interpreter interface for more information.

Functions

func BindTextEditor

func BindTextEditor(ed *texteditor.Editor, parent *core.Frame, language string)

BindTextEditor binds the given text editor to a yaegi interpreter such that the contents of the text editor are interpreted as code of the given language, which is run in the context of the given parent widget. It is used as the default value of htmlcore.BindTextEditor.

Types

type Interpreter added in v0.3.8

type Interpreter interface {

	// Use imports the given symbols into the interpreter.
	Use(values interp.Exports) error

	// ImportUsed imports the used symbols into the interpreter
	// and does any extra necessary configuration steps.
	ImportUsed()

	// Eval evaluates the given code in the interpreter.
	Eval(src string) (res reflect.Value, err error)
}

Interpreter is an interface that represents the functionality provided by an interpreter compatible with yaegicore. The base implementation is just interp.Interpreter, but other packages such as yaegilab in Cogent Lab provide their own implementations with other languages such as Cogent Goal. See Interpreters.

Directories

Path Synopsis
Package basesymbols contains yaegi symbols for base (non-GUI) packages.
Package basesymbols contains yaegi symbols for base (non-GUI) packages.
Package coresymbols contains yaegi symbols for core packages.
Package coresymbols contains yaegi symbols for core packages.

Jump to

Keyboard shortcuts

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