stdlib

package
v0.0.0-...-1070c7b Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2022 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrorOk int = iota
	ErrorErr
	ErrorRet
	ErrorBreak
	ErrorContinue
)

Variables

View Source
var (
	ErrArgument = errors.New("wrong number of argument given")
	ErrExit     = errors.New("exit")
	ErrReturn   = errors.New("return")
	ErrBreak    = errors.New("break")
	ErrContinue = errors.New("continue")
)
View Source
var ErrType = errors.New("invalid type given")

Functions

func CheckBool

func CheckBool(v env.Value) (env.Value, error)

func CheckNumber

func CheckNumber(v env.Value) (env.Value, error)

func CheckString

func CheckString(v env.Value) (env.Value, error)

func DefaultError

func DefaultError(msg string) error

func ErrorFromError

func ErrorFromError(err error) error

func ErrorWithCode

func ErrorWithCode(msg string, code int) error

func IsSet

func IsSet(list []Option, name string) (int, error)

func IsValid

func IsValid(list []Option) error

Types

type Builtin

type Builtin struct {
	Name     string
	Usage    string
	Help     string
	Safe     bool
	Arity    int
	Variadic bool
	Scope    bool
	Run      CommandFunc
	Options  []Option
}

func (Builtin) Execute

func (b Builtin) Execute(i Interpreter, args []env.Value) (env.Value, error)

func (Builtin) GetName

func (b Builtin) GetName() string

func (Builtin) IsSafe

func (b Builtin) IsSafe() bool

func (Builtin) Scoped

func (b Builtin) Scoped() bool

type ChannelHandler

type ChannelHandler interface {
	Interpreter

	Open(string, string) (string, error)
	Close(string) error
	Eof(string) (bool, error)

	Channels() []string

	Seek(string, int, int) (int64, error)
	Tell(string) (int64, error)
	Gets(string) (string, error)
	Read(string, int) (string, error)

	Copy(string, string, int) (int64, error)

	PrintHandler
}

type CheckFunc

type CheckFunc func(env.Value) (env.Value, error)

func CombineCheck

func CombineCheck(cs ...CheckFunc) CheckFunc

func OneOf

func OneOf(cs ...CheckFunc) CheckFunc

type CommandFunc

type CommandFunc func(Interpreter, []env.Value) (env.Value, error)

type CommandHandler

type CommandHandler interface {
	Depth() int
	Count() int
	Commands(string) []string
	CurrentFrame(int) (string, []string, error)
}

type DeferHandler

type DeferHandler interface {
	Interpreter
	RegisterDefer(string) error
}

type Ensemble

type Ensemble struct {
	Name  string
	Usage string
	Help  string
	Safe  bool
	List  []Executer
}

func (Ensemble) Execute

func (e Ensemble) Execute(i Interpreter, args []env.Value) (env.Value, error)

func (Ensemble) GetName

func (e Ensemble) GetName() string

func (Ensemble) IsSafe

func (e Ensemble) IsSafe() bool

func (Ensemble) Scoped

func (_ Ensemble) Scoped() bool

type Error

type Error struct {
	Err   error
	Code  int
	Level int
}

func (Error) Error

func (e Error) Error() string

func (Error) Unwrap

func (e Error) Unwrap() error

type Executer

type Executer interface {
	GetName() string
	IsSafe() bool
	Scoped() bool
	Execute(Interpreter, []env.Value) (env.Value, error)
}

func MakeArray

func MakeArray() Executer

func MakeChan

func MakeChan() Executer

func MakeClock

func MakeClock() Executer

func MakeFile

func MakeFile() Executer

func MakeInfo

func MakeInfo() Executer

func MakeInterp

func MakeInterp() Executer

func MakeList

func MakeList() Executer

func MakeNamespace

func MakeNamespace() Executer

func MakeString

func MakeString() Executer

func PrintArray

func PrintArray() Executer

func RunAbs

func RunAbs() Executer

func RunAcos

func RunAcos() Executer

func RunAdd

func RunAdd() Executer

func RunAppend

func RunAppend() Executer

func RunAsin

func RunAsin() Executer

func RunAtan

func RunAtan() Executer

func RunAtan2

func RunAtan2() Executer

func RunBool

func RunBool() Executer

func RunBreak

func RunBreak() Executer

func RunCatch

func RunCatch() Executer

func RunCeil

func RunCeil() Executer

func RunChdir

func RunChdir() Executer

func RunClose

func RunClose() Executer

func RunContinue

func RunContinue() Executer

func RunCos

func RunCos() Executer

func RunCosh

func RunCosh() Executer

func RunDecr

func RunDecr() Executer

func RunDefer

func RunDefer() Executer

func RunDegree

func RunDegree() Executer

func RunDiv

func RunDiv() Executer

func RunDouble

func RunDouble() Executer

func RunEntier

func RunEntier() Executer

func RunEof

func RunEof() Executer

func RunEq

func RunEq() Executer

func RunError

func RunError() Executer

func RunEval

func RunEval() Executer

func RunExit

func RunExit() Executer

func RunExp

func RunExp() Executer

func RunExpr

func RunExpr() Executer

func RunFCopy

func RunFCopy() Executer

func RunFileCat

func RunFileCat() Executer

func RunFileForeachLine

func RunFileForeachLine() Executer

func RunFileWriteFile

func RunFileWriteFile() Executer

func RunFloor

func RunFloor() Executer

func RunFmod

func RunFmod() Executer

func RunFor

func RunFor() Executer

func RunForeach

func RunForeach() Executer

func RunGe

func RunGe() Executer

func RunGets

func RunGets() Executer

func RunGlobal

func RunGlobal() Executer

func RunGt

func RunGt() Executer

func RunHelp

func RunHelp() Executer

func RunHypot

func RunHypot() Executer

func RunIf

func RunIf() Executer

func RunIncr

func RunIncr() Executer

func RunInt

func RunInt() Executer

func RunIsqrt

func RunIsqrt() Executer

func RunLAppend

func RunLAppend() Executer

func RunLAssign

func RunLAssign() Executer

func RunLIndex

func RunLIndex() Executer

func RunLInsert

func RunLInsert() Executer

func RunLLength

func RunLLength() Executer

func RunLMap

func RunLMap() Executer

func RunLRange

func RunLRange() Executer

func RunLRepeat

func RunLRepeat() Executer

func RunLReplace

func RunLReplace() Executer

func RunLReverse

func RunLReverse() Executer

func RunLSearch

func RunLSearch() Executer

func RunLSet

func RunLSet() Executer

func RunLSort

func RunLSort() Executer

func RunLe

func RunLe() Executer

func RunList

func RunList() Executer

func RunLog

func RunLog() Executer

func RunLog10

func RunLog10() Executer

func RunLt

func RunLt() Executer

func RunMax

func RunMax() Executer

func RunMin

func RunMin() Executer

func RunMod

func RunMod() Executer

func RunMul

func RunMul() Executer

func RunNe

func RunNe() Executer

func RunNot

func RunNot() Executer

func RunOpen

func RunOpen() Executer

func RunPid

func RunPid() Executer

func RunPow

func RunPow() Executer

func RunPrefixAll

func RunPrefixAll() Executer

func RunPrefixLongest

func RunPrefixLongest() Executer

func RunPrefixMatch

func RunPrefixMatch() Executer

func RunProc

func RunProc() Executer

func RunPuts

func RunPuts() Executer

func RunPwd

func RunPwd() Executer

func RunRadian

func RunRadian() Executer

func RunRaise

func RunRaise() Executer

func RunRand

func RunRand() Executer

func RunRead

func RunRead() Executer

func RunRename

func RunRename() Executer

func RunReturn

func RunReturn() Executer

func RunRound

func RunRound() Executer

func RunSeek

func RunSeek() Executer

func RunSet

func RunSet() Executer

func RunSin

func RunSin() Executer

func RunSinh

func RunSinh() Executer

func RunSource

func RunSource() Executer

func RunSplit

func RunSplit() Executer

func RunSqrt

func RunSqrt() Executer

func RunSrand

func RunSrand() Executer

func RunSub

func RunSub() Executer

func RunSwitch

func RunSwitch() Executer

func RunTan

func RunTan() Executer

func RunTanh

func RunTanh() Executer

func RunTell

func RunTell() Executer

func RunThrow

func RunThrow() Executer

func RunTime

func RunTime() Executer

func RunTry

func RunTry() Executer

func RunTypeOf

func RunTypeOf() Executer

func RunUnknown

func RunUnknown() Executer

func RunUnset

func RunUnset() Executer

func RunUplevel

func RunUplevel() Executer

func RunUpvar

func RunUpvar() Executer

func RunVariable

func RunVariable() Executer

func RunWhile

func RunWhile() Executer

func RunWide

func RunWide() Executer

type InterpHandler

type InterpHandler interface {
	Interpreter
	RegisterInterpreter([]string, bool) (string, error)
	UnregisterInterpreter([]string) error
	LookupInterpreter(paths []string) (InterpHandler, error)
	InterpretersList() []string
	IsSafe() bool
}

type Interpreter

type Interpreter interface {
	Execute(io.Reader) (env.Value, error)
	IsComplete(string) bool
	IsSafe() bool
	Version() string

	Resolve(string) (env.Value, error)
	Define(string, env.Value)
	Delete(string)
}

type LinkHandler

type LinkHandler interface {
	LinkVar(string, string, int) error
}

type NamespaceHandler

type NamespaceHandler interface {
	Interpreter
	RegisterNS(string, string) error
	UnregisterNS(string) error
	CurrentNS() string
	ParentNS(string) (string, error)
	ChildrenNS(string) ([]string, error)
	HasNS(string) bool
	DefineVar(string, env.Value)
}

type Option

type Option struct {
	env.Value
	Name     string
	Help     string
	Flag     bool
	Required bool
	Check    CheckFunc
}

type PrintHandler

type PrintHandler interface {
	Print(string, string) error
	Println(string, string) error
}

type ProcHandler

type ProcHandler interface {
	ProcList(string) []string
	ProcBody(string) (string, error)
	ProcArgs(string) ([]string, error)
	ProcDefault(string, string) (string, bool, error)
}

type VariableHandler

type VariableHandler interface {
	Globals(string) []string
	Locals(string) []string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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