interpreter

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2022 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NULL        = object.NewJNull()
	TRUE        = object.NewJNumber(1)
	FALSE       = object.NewJNumber(0)
	Len         = object.NewJBuiltInFunction("len", []string{"value"}, ExecuteLen)
	Type        = object.NewJBuiltInFunction("type", []string{"value"}, ExecuteType)
	Print       = object.NewJBuiltInFunction("print", []string{"value"}, ExecutePrint)
	Println     = object.NewJBuiltInFunction("println", []string{"value"}, ExecutePrintln)
	Input       = object.NewJBuiltInFunction("input", []string{}, ExecuteInput)
	InputNumber = object.NewJBuiltInFunction("input_number", []string{}, ExecuteInputNumber)
	IsNumber    = object.NewJBuiltInFunction("is_number", []string{"value"}, ExecuteIsNumber)
	IsString    = object.NewJBuiltInFunction("is_string", []string{"value"}, ExecuteIsString)
	IsList      = object.NewJBuiltInFunction("is_list", []string{"value"}, ExecuteIsList)
	IsFunction  = object.NewJBuiltInFunction("is_function", []string{"value"}, ExecuteIsFunction)
	RunShell    = object.NewJBuiltInFunction("run_shell", []string{"text"}, ExecuteRunShell)
	RunScript   = object.NewJBuiltInFunction("run", []string{"filename"}, ExecuteRun)
)
View Source
var GlobalSymbolTable *common.JSymbolTable

Functions

func ExecuteInput

func ExecuteInput(function *object.JBuiltInFunction, args []object.JValue) (object.JValue, error)

func ExecuteInputNumber

func ExecuteInputNumber(function *object.JBuiltInFunction, args []object.JValue) (object.JValue, error)

func ExecuteIsFunction

func ExecuteIsFunction(function *object.JBuiltInFunction, args []object.JValue) (object.JValue, error)

func ExecuteIsList

func ExecuteIsList(function *object.JBuiltInFunction, args []object.JValue) (object.JValue, error)

func ExecuteIsNumber

func ExecuteIsNumber(function *object.JBuiltInFunction, args []object.JValue) (object.JValue, error)

func ExecuteIsString

func ExecuteIsString(function *object.JBuiltInFunction, args []object.JValue) (object.JValue, error)

func ExecuteLen

func ExecuteLen(function *object.JBuiltInFunction, args []object.JValue) (object.JValue, error)

func ExecutePrint

func ExecutePrint(function *object.JBuiltInFunction, args []object.JValue) (object.JValue, error)

func ExecutePrintln

func ExecutePrintln(function *object.JBuiltInFunction, args []object.JValue) (object.JValue, error)

func ExecuteRun

func ExecuteRun(function *object.JBuiltInFunction, args []object.JValue) (object.JValue, error)

func ExecuteRunShell added in v0.1.1

func ExecuteRunShell(function *object.JBuiltInFunction, args []object.JValue) (object.JValue, error)

func ExecuteType

func ExecuteType(function *object.JBuiltInFunction, args []object.JValue) (object.JValue, error)

func Run

func Run(filename, text string) (interface{}, error)

Types

type JInterpreter

type JInterpreter struct {
	Context    *common.JContext
	IsReturn   bool
	IsBreak    bool
	IsContinue bool
}

func NewJInterpreter

func NewJInterpreter(context *common.JContext) *JInterpreter

func (*JInterpreter) Interpreter

func (i *JInterpreter) Interpreter(ast parser.JNode) (object.JValue, error)

func (*JInterpreter) Reset

func (i *JInterpreter) Reset()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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