Documentation ¶
Index ¶
- Constants
- Variables
- func AddExtensionInitializer(initializer func(*Interpreter) error)
- func AddFunModToNamespace(importModName string, content []byte, interpreter *Interpreter) (err error)
- func AddImportsToNamespace(nspace *NSpace, frame *Frame, interpreter *Interpreter)
- func AddImportsToNamespaceSub(nspace *NSpace, frame *Frame, interpreter *Interpreter)
- func DebugPrint(format string, args ...interface{})
- func EvalAndAssignValuesForSymbolsInFrameForNS(frame *Frame, ns *NSpace)
- func GetModsFromTar(tarContent []byte) (map[string][]byte, error)
- func GetReplCode() string
- func GetWastedName() string
- func InitFunSourceSTD(interpreter *Interpreter) (err error)
- func NewOperatorDocs() map[string]string
- func NewTokenizer(operators Operators) *tokenizer
- func RunTimeError(format string, args ...interface{})
- func RunTimeError2(frame *Frame, format string, args ...interface{})
- type AddInfo
- type ExtProcType
- type ExtSetupHandler
- type FNIApi
- type FNIHandler
- type Frame
- func (fr *Frame) FindFuncSID(fptr *Function) (sid SymID, found bool)
- func (fr *Frame) GetFuncDebugInfos(prev []fdebugInfo) []fdebugInfo
- func (fr *Frame) GetImportedSymItem(modSid SymID, rest SymbolPath) (*Item, bool)
- func (fr *Frame) GetSymItem(sid SymID) (*Item, bool)
- func (fr *Frame) GetSymItemsOfImportedModule(modSid SymID) (*Symt, bool)
- func (fr *Frame) GetTopFrame() *Frame
- func (fr *Frame) SetInProcCall(v bool)
- type FuncValue
- type Function
- type ImportInfo
- type Interpreter
- type Item
- type ItemType
- type KeyVal
- type List
- type ListIterator
- type ListObject
- type ModuleImporter
- type NSAccess
- type NSTopInfo
- type NSpace
- type Node
- type NodeHandler
- type NodeType
- type NodeValue
- type OpCall
- type OpaqueAPI
- type OperHandler
- type OperType
- type OperatorInfo
- type Operators
- type PMap
- type ParseErrorHandler
- type Parser
- func (p *Parser) Parse(source string) (nsName string, ns *NSpace, err error)
- func (p *Parser) ParseArgs(source string) (argsItems []*Item, err error)
- func (p *Parser) ParseExpandedLet() (symbols []string, item *Item)
- func (p *Parser) ParseExpr() (item *Item)
- func (p *Parser) ParseFuncValue(procOrFuncToken token) (funcData *Function)
- func (p *Parser) ParseImport() (modName string, importInfo ImportInfo)
- func (p *Parser) ParseLet() (symbol string, item *Item)
- func (p *Parser) ParseNamespace() (nsName string, ns *NSpace)
- func (p *Parser) ParseOneExpression(source string) (item *Item, err error)
- func (p *Parser) ParseOperCall() (item *Item)
- func (p *Parser) ParseSymbolPath() (item *Item)
- func (p *Parser) ParseValue() (item *Item)
- func (p *Parser) SetCanEndWithSymbol(canSet bool)
- func (p *Parser) SetErrorHandler(peh ParseErrorHandler)
- type SymID
- type SymbolPath
- type SymbolToIDConverter
- type Symt
- func (sym *Symt) Add(symbol string, item *Item) error
- func (sym *Symt) AddBySID(sid SymID, item *Item) bool
- func (sym *Symt) AddBySIDByOverwriteIfNeeded(sid SymID, item *Item) bool
- func (sym *Symt) AsMap() map[SymID]*Item
- func (sym *Symt) FindFuncSID(fptr *Function) (sid SymID, found bool)
- func (sym *Symt) GetByName(symbol string) (*Item, bool)
- func (sym *Symt) GetBySID(sid SymID) (*Item, bool)
- func (sym *Symt) Has(key SymID) bool
- func (sym *Symt) Keys() []SymID
- func (sym *Symt) MakeCopy() *Symt
- func (sym *Symt) Print(depth int) (s string)
- type Thunk
- type Value
- func EvalItem(item *Item, frame *Frame) (retVal Value)
- func EvalItemV2(item *Item, frame *Frame, addInfo *AddInfo) (retVal Value)
- func FunlMainWithArgs(content string, argsItems []*Item, name, srcFileName string, ...) (retValue Value, err error)
- func FunlMainWithInterpreter(content string, argsItems []*Item, name, srcFileName string, ...) (retValue Value, err error)
- func FunlMainWithPackImport(impPackName string, content string, argsItems []*Item, ...) (retValue Value, err error)
- func FunlMainWithPackImportContent(data []byte, content string, argsItems []*Item, name, srcFileName string, ...) (retValue Value, err error)
- func FunlMainWithPackage(argsItems []*Item, name, srcFileName string, initSTD func(*Interpreter) error) (retValue Value, err error)
- func FunlMainWithPackageContent(data []byte, argsItems []*Item, name, srcFileName string, ...) (retValue Value, err error)
- func HandleCallOP(frame *Frame, operands []*Item) (retVal Value)
- func HandleEvalOP(frame *Frame, operands []*Item) (retVal Value)
- func HandleGetlOP(frame *Frame, operands []*Item) (retVal Value)
- func HandleKeyvalsOP(frame *Frame, operands []*Item) (retVal Value)
- func HandleMapOP(frame *Frame, operands []*Item) (retVal Value)
- func HandlePutOP(frame *Frame, operands []*Item) (retVal Value)
- func HandleSprintfOP(frame *Frame, operands []*Item) (retVal Value)
- func MakeListOfValues(frame *Frame, values []Value) (retVal Value)
- type ValueType
Constants ¶
const ( IntValue ValueType = iota StringValue BoolValue FuncProtoValue FunctionValue ListValue ExtProcValue ChanValue FloatValue OpaqueValue MapValue ThunkValue ValueItem ItemType = iota SymbolPathItem OperCallItem AndOP OperType = iota OrOP NotOP CallOP EqOP IfOP PlusOP MinusOP MulOP DivOP ModOP ListOP EmptyOP HeadOP LastOP RestOP AppendOP AddOP LenOP TypeOP InOP IndOP FindOP SliceOP RrestOP ReverseOP ExtendOP SplitOP GtOP LtOP LeOP GeOP StrOP ConvOP CaseOP NameOP ErrorOP PrintOP SpawnOP ChanOP SendOP RecvOP SymvalOP TryOP TrylOP SelectOP EvalOP WhileOP FloatOP MapOP PutOP GetOP GetlOP KeysOP ValsOP KeyvalsOP LetOP ImpOP DelOP DellOP SprintfOP ArgslistOP CondOP HelpOP RecwithOP DeferOP ForceOP MaximumOP )
const DeletionsLimit = 1000
DeletionsLimit is limit for amount of items marked as deleted in map, before making new map
Variables ¶
var AnySymSid = SymIDMap.Add("_")
var PrintingDisabledInFunctions bool
var PrintingRTElocationAndScopeEnabled bool
var SymIDMap = NewSymbolToIDConverter()
Functions ¶
func AddExtensionInitializer ¶
func AddExtensionInitializer(initializer func(*Interpreter) error)
AddExtensionInitializer can be used for registering initializer for some extension module (registered in init -function)
func AddFunModToNamespace ¶
func AddFunModToNamespace(importModName string, content []byte, interpreter *Interpreter) (err error)
func AddImportsToNamespace ¶
func AddImportsToNamespace(nspace *NSpace, frame *Frame, interpreter *Interpreter)
func AddImportsToNamespaceSub ¶
func AddImportsToNamespaceSub(nspace *NSpace, frame *Frame, interpreter *Interpreter)
func DebugPrint ¶
func DebugPrint(format string, args ...interface{})
func InitFunSourceSTD ¶
func InitFunSourceSTD(interpreter *Interpreter) (err error)
InitFunSourceSTD provided for initializing std externally
func NewOperatorDocs ¶
NewOperatorDocs returns documentation for operators
func NewTokenizer ¶
func NewTokenizer(operators Operators) *tokenizer
NewTokenizer exposes tokenizer API
func RunTimeError ¶
func RunTimeError(format string, args ...interface{})
func RunTimeError2 ¶
Types ¶
type ExtSetupHandler ¶
type FNIApi ¶
type FNIApi interface {
RegExtProc(ExtProcType, string) error
}
type FNIHandler ¶
type FNIHandler struct {
// contains filtered or unexported fields
}
func (*FNIHandler) RegExtProc ¶
func (fni *FNIHandler) RegExtProc(extProc ExtProcType, extProcName string) (err error)
type Frame ¶
type Frame struct { FuncProto *Function Syms *Symt OtherNS map[SymID]ImportInfo AccessLink *Frame // nil if root Imported map[SymID]*Frame EvaluatedArgs []Value Interpreter *Interpreter // contains filtered or unexported fields }
func AddNStoCache ¶
func AddNStoCache(inProcCall bool, importModName string, nspace *NSpace, interpreter *Interpreter) *Frame
AddNStoCache is for std usage
func NewTopFrameWithInterpreter ¶
func NewTopFrameWithInterpreter(interpreter *Interpreter) *Frame
NewTopFrameWithInterpreter returns new top level frame
func SetupExtModule ¶
func SetupExtModule(targetPath string, interpreter *Interpreter) (topFrame *Frame, err error)
func (*Frame) GetFuncDebugInfos ¶
func (fr *Frame) GetFuncDebugInfos(prev []fdebugInfo) []fdebugInfo
GetFuncDebugInfos gets function infos for backtrace
func (*Frame) GetImportedSymItem ¶
func (fr *Frame) GetImportedSymItem(modSid SymID, rest SymbolPath) (*Item, bool)
GetImportedSymItem gets item from imported namespaces
func (*Frame) GetSymItem ¶
GetSymItem gets item ralated to symbol
func (*Frame) GetSymItemsOfImportedModule ¶
GetSymItemsOfImportedModule finds symbol table for module
func (*Frame) SetInProcCall ¶
SetInProcCall sets inProcCall in Frame
type Function ¶
type ImportInfo ¶
type ImportInfo struct {
// contains filtered or unexported fields
}
func (*ImportInfo) Path ¶
func (imp *ImportInfo) Path() string
func (*ImportInfo) SetPath ¶
func (imp *ImportInfo) SetPath(path string)
type Interpreter ¶
type Interpreter struct { NsDir *NSAccess Importer ModuleImporter }
func NewInterpreter ¶
func NewInterpreter() *Interpreter
type List ¶
type List struct { Head *ListObject Tail *ListObject }
type ListIterator ¶
type ListIterator struct { NextItem *ListObject HeadDone bool Tail *ListObject }
func NewListIterator ¶
func NewListIterator(val Value) (lit *ListIterator)
func (*ListIterator) Next ¶
func (lit *ListIterator) Next() *Value
type ListObject ¶
type ListObject struct { Val *Value Next *ListObject }
type ModuleImporter ¶
type NSAccess ¶
NSAccess is access point to namespaces
func (*NSAccess) FillFromAstNSpaceAndStore ¶
func (*NSAccess) GetTopFrameBySID ¶
type NSpace ¶
type NSpace struct { Syms *Symt OtherNS map[SymID]ImportInfo }
type NodeValue ¶
func NewNodeValue ¶
type OperHandler ¶
type Operators ¶
type Operators map[string]OperatorInfo
Operators contains operator information (operator name as key)
func NewDefaultOperators ¶
func NewDefaultOperators() Operators
NewDefaultOperators returns default set of operators
type ParseErrorHandler ¶
type ParseErrorHandler interface {
HandleParseError(errorText string)
}
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser implements syntax tree parser
func (*Parser) Parse ¶
Parse calls token iterator to scan source text and based on tokens it forms syntax tree
func (*Parser) ParseExpandedLet ¶
func (*Parser) ParseFuncValue ¶
func (*Parser) ParseImport ¶
func (p *Parser) ParseImport() (modName string, importInfo ImportInfo)
ParseImport parses import definition
func (*Parser) ParseNamespace ¶
ParseNamespace parses namespace definition
func (*Parser) ParseOneExpression ¶
func (*Parser) ParseOperCall ¶
ParseOperCall parses operator call
func (*Parser) SetCanEndWithSymbol ¶
func (*Parser) SetErrorHandler ¶
func (p *Parser) SetErrorHandler(peh ParseErrorHandler)
type SymbolPath ¶
type SymbolPath []SymID
func (*SymbolPath) ToString ¶
func (sp *SymbolPath) ToString() string
type SymbolToIDConverter ¶
func NewSymbolToIDConverter ¶
func NewSymbolToIDConverter() *SymbolToIDConverter
func (*SymbolToIDConverter) Add ¶
func (sidc *SymbolToIDConverter) Add(symbol string) SymID
func (*SymbolToIDConverter) AsString ¶
func (sidc *SymbolToIDConverter) AsString(sid SymID) string
func (*SymbolToIDConverter) Get ¶
func (sidc *SymbolToIDConverter) Get(symbol string) (sid SymID, found bool)
func (*SymbolToIDConverter) SymbolCount ¶
func (sidc *SymbolToIDConverter) SymbolCount() int
type Symt ¶
func (*Symt) AddBySIDByOverwriteIfNeeded ¶
type Value ¶
type Value struct { Kind ValueType Data interface{} }
func EvalItemV2 ¶
TODO: its copy-paste, but no wrapper because it would add additional overhead
func FunlMainWithArgs ¶
func FunlMainWithInterpreter ¶
func FunlMainWithInterpreter(content string, argsItems []*Item, name, srcFileName string, initSTD func(*Interpreter) error, interpreter *Interpreter) (retValue Value, err error)
func FunlMainWithPackImport ¶
func FunlMainWithPackage ¶
func HandleCallOP ¶
HandleCallOP for std lib usage
func HandleEvalOP ¶
HandleEvalOP can be used from Go code
func HandleGetlOP ¶
HandleGetlOP is for std usage
func HandleKeyvalsOP ¶
HandleKeyvalsOP is for std usage
func HandleMapOP ¶
HandleMapOP is for std usage
func HandlePutOP ¶
HandlePutOP is for std usage
func HandleSprintfOP ¶
func MakeListOfValues ¶
MakeListOfValues offers API for std to create list for values