Documentation ¶
Overview ¶
This project does not use godoc. Instead there is extensive and detailed description of the language features maintained on the wiki. See the following link.
Index ¶
- Constants
- Variables
- func AllBuiltinFunctions() map[string]GlispUserFunction
- func Blake2bUint64(raw []byte) uint64
- func Chomp(by []byte) []byte
- func ClosureToString(f *SexpFunction, env *Glisp) string
- func CoreFunctions() map[string]GlispUserFunction
- func CountPostHook(env *Glisp, name string, retval Sexp)
- func CountPreHook(env *Glisp, name string, args []Sexp)
- func DecodeChar(atom string) (string, error)
- func DirExists(name string) bool
- func DumpFunction(fun GlispFunction, pc int)
- func EncodingFunctions() map[string]GlispUserFunction
- func EscapeChar(char rune) (rune, error)
- func FileExists(name string) bool
- func GetEmbedPath(e []EmbedPath) string
- func GoToJson(iface interface{}) []byte
- func GoToMsgpack(iface interface{}) ([]byte, error)
- func HashCountKeys(hash *SexpHash) int
- func HashExpression(env *Glisp, expr Sexp) (int, error)
- func HashIsEmpty(hash *SexpHash) bool
- func IsArray(expr Sexp) bool
- func IsAssignmentList(expr Sexp, pos int) (bool, int)
- func IsChar(expr Sexp) bool
- func IsEmpty(expr Sexp) bool
- func IsExactlyDoublePointer(target interface{}) bool
- func IsExactlySinglePointer(target interface{}) bool
- func IsExactlySinglePointerType(typ reflect.Type) bool
- func IsFloat(expr Sexp) bool
- func IsFunc(expr Sexp) bool
- func IsHash(expr Sexp) bool
- func IsInt(expr Sexp) bool
- func IsList(expr Sexp) bool
- func IsNumber(expr Sexp) bool
- func IsString(expr Sexp) bool
- func IsSymbol(expr Sexp) bool
- func IsTruthy(expr Sexp) bool
- func IsZero(expr Sexp) bool
- func JsonToGo(json []byte) (interface{}, error)
- func ListLen(expr Sexp) (int, error)
- func MergeFuncMap(funcs ...map[string]GlispUserFunction) map[string]GlispUserFunction
- func MsgpackToGo(msgp []byte) (interface{}, error)
- func MyWordCompleter(line string, pos int) (head string, c []string, tail string)
- func NilOrHoldsNil(iface interface{}) bool
- func P(format string, stuff ...interface{})
- func PointerDepth(typ reflect.Type) int
- func ReflectionFunctions() map[string]GlispUserFunction
- func RemoveCommasFilter(x Sexp) bool
- func RemoveCommentsFilter(x Sexp) bool
- func RemoveEndsFilter(x Sexp) bool
- func Repl(env *Glisp, cfg *GlispConfig)
- func ReplMain(cfg *GlispConfig)
- func SandboxSafeFunctions() map[string]GlispUserFunction
- func SetHashKeyOrder(hash *SexpHash, keyOrd Sexp) error
- func SetShellCmd()
- func SexpToGo(sexp Sexp, env *Glisp) interface{}
- func SexpToGoStructs(sexp Sexp, target interface{}, env *Glisp) (interface{}, error)
- func SexpToJson(exp Sexp) string
- func SexpToMsgpack(exp Sexp) ([]byte, interface{})
- func StrFunctions() map[string]GlispUserFunction
- func StringToRunes(str string) []rune
- func SystemFunctions() map[string]GlispUserFunction
- func TSPrintf(format string, a ...interface{})
- func UseConveyDummy()
- func VPrintf(format string, a ...interface{})
- func Version() string
- func WPrintf(format string, a ...interface{})
- type AddFuncScopeHelper
- type AddFuncScopeInstr
- type AddScopeInstr
- type Address
- type AssignInstr
- type BindlistInstr
- type BranchInstr
- type BreakInstr
- type CallInstr
- type ClearStackmarkInstr
- type Closing
- func (c *Closing) IsStackElem()
- func (c *Closing) LookupSymbol(sym *SexpSymbol, setVal *Sexp) (Sexp, error, *Scope)
- func (c *Closing) LookupSymbolUntilFunction(sym *SexpSymbol) (Sexp, error, *Scope)
- func (c *Closing) Show(env *Glisp, ps *PrintState, label string) (string, error)
- func (c *Closing) TopScope() *Scope
- type ContinueInstr
- type CreateClosureInstr
- type DataStackElem
- type DebugInstr
- type DispatchInstr
- type DupInstr
- type EmbedPath
- type EnvToStackInstr
- type Event
- func (z *Event) DecodeMsg(dc *msgp.Reader) (err error)
- func (ev *Event) DisplayEvent(from string)
- func (z *Event) EncodeMsg(en *msgp.Writer) (err error)
- func (z *Event) MarshalMsg(b []byte) (o []byte, err error)
- func (z *Event) Msgsize() (s int)
- func (z *Event) UnmarshalMsg(bts []byte) (o []byte, err error)
- type ExplodeInstr
- type Filter
- type Flyer
- type Generator
- func (gen *Generator) AddInstruction(instr Instruction)
- func (gen *Generator) AddInstructions(instr []Instruction)
- func (gen *Generator) Generate(expr Sexp) error
- func (gen *Generator) GenerateAll(expressions []Sexp) error
- func (gen *Generator) GenerateArray(arr *SexpArray) error
- func (gen *Generator) GenerateAssert(args []Sexp) error
- func (gen *Generator) GenerateAssignment(expr *SexpPair, assignPos int) error
- func (gen *Generator) GenerateBegin(expressions []Sexp) error
- func (gen *Generator) GenerateBreak(args []Sexp) error
- func (gen *Generator) GenerateBuilder(fun Sexp, args []Sexp) error
- func (gen *Generator) GenerateCall(expr *SexpPair) error
- func (gen *Generator) GenerateCallBySymbol(sym *SexpSymbol, args []Sexp, orig Sexp) error
- func (gen *Generator) GenerateCond(args []Sexp) error
- func (gen *Generator) GenerateContinue(args []Sexp) error
- func (gen *Generator) GenerateDebug(diag string) error
- func (gen *Generator) GenerateDef(args []Sexp, opname string) error
- func (gen *Generator) GenerateDefmac(args []Sexp, orig Sexp) error
- func (gen *Generator) GenerateDefn(args []Sexp, orig Sexp) error
- func (gen *Generator) GenerateDispatch(fun Sexp, args []Sexp) error
- func (gen *Generator) GenerateFn(args []Sexp, orig Sexp) error
- func (gen *Generator) GenerateForLoop(args []Sexp) error
- func (gen *Generator) GenerateInclude(args []Sexp) error
- func (gen *Generator) GenerateLet(name string, args []Sexp) error
- func (gen *Generator) GenerateMacexpand(args []Sexp) error
- func (gen *Generator) GenerateMultiDef(args []Sexp) error
- func (gen *Generator) GenerateNewScope(expressions []Sexp) error
- func (gen *Generator) GeneratePackage(expressions []Sexp) error
- func (gen *Generator) GenerateQuote(args []Sexp) error
- func (gen *Generator) GenerateReturn(xs []Sexp) error
- func (gen *Generator) GenerateShortCircuit(or bool, args []Sexp) error
- func (gen *Generator) GenerateSyntaxQuote(args []Sexp) error
- func (gen *Generator) GetLHS(arg Sexp, opname string) (*SexpSymbol, error)
- func (gen *Generator) Reset()
- type Glisp
- func (env *Glisp) AddBuilder(name string, function GlispUserFunction)
- func (env *Glisp) AddFunction(name string, function GlispUserFunction)
- func (env *Glisp) AddGlobal(name string, obj Sexp)
- func (env *Glisp) AddMacro(name string, function GlispUserFunction)
- func (env *Glisp) AddPostHook(fun PostHook)
- func (env *Glisp) AddPreHook(fun PreHook)
- func (env *Glisp) Apply(fun *SexpFunction, args []Sexp) (Sexp, error)
- func (env *Glisp) Assignment(op string, bp int) *InfixOp
- func (env *Glisp) CallFunction(function *SexpFunction, nargs int) error
- func (env *Glisp) CallUserFunction(function *SexpFunction, name string, nargs int) (nargReturned int, err error)
- func (env *Glisp) Clear()
- func (env *Glisp) Clone() *Glisp
- func (env *Glisp) Compare(a Sexp, b Sexp) (int, error)
- func (env *Glisp) CurrentFunctionSize() int
- func (env *Glisp) DetectSigils(sym *SexpSymbol)
- func (env *Glisp) DumpEnvironment()
- func (env *Glisp) DumpFunctionByName(name string) error
- func (env *Glisp) Duplicate() *Glisp
- func (env *Glisp) EliminateColonAndCommaFromArgs(args []Sexp) []Sexp
- func (env *Glisp) EvalExpressions(xs []Sexp) (Sexp, error)
- func (env *Glisp) EvalString(str string) (Sexp, error)
- func (env *Glisp) FilterAny(x Sexp, f Filter) (filtered Sexp, keep bool)
- func (env *Glisp) FilterArray(x []Sexp, f Filter) []Sexp
- func (env *Glisp) FilterHash(h *SexpHash, f Filter) *SexpHash
- func (env *Glisp) FilterList(h *SexpPair, f Filter) Sexp
- func (env *Glisp) FindLoop(target *Loop) (int, error)
- func (env *Glisp) FindObject(name string) (Sexp, bool)
- func (env *Glisp) FunctionCallNameTypeCheck(f *SexpFunction, nargs *int) error
- func (env *Glisp) GenSymbol(prefix string) *SexpSymbol
- func (env *Glisp) GetStackTrace(err error) string
- func (env *Glisp) HasMacro(sym *SexpSymbol) bool
- func (env *Glisp) ImportBaseTypes()
- func (env *Glisp) ImportChannels()
- func (env *Glisp) ImportEval()
- func (env *Glisp) ImportGoroutines()
- func (env *Glisp) ImportMsgpackMap()
- func (env *Glisp) ImportPackageBuilder()
- func (env *Glisp) ImportRandom()
- func (env *Glisp) ImportRegex()
- func (env *Glisp) ImportTime()
- func (env *Glisp) Infix(op string, bp int) *InfixOp
- func (env *Glisp) InfixF(op string, bp int, f func(env *Glisp, op string, bp int) *InfixOp) *InfixOp
- func (env *Glisp) Infixr(op string, bp int) *InfixOp
- func (env *Glisp) InitInfixOps()
- func (env *Glisp) IsBuiltinSym(sym *SexpSymbol) (builtin bool, typ string)
- func (env *Glisp) LeftBindingPower(sx Sexp) (int, error)
- func (env *Glisp) LexicalBindSymbol(sym *SexpSymbol, expr Sexp) error
- func (env *Glisp) LexicalLookupSymbol(sym *SexpSymbol, setVal *Sexp) (Sexp, error, *Scope)
- func (env *Glisp) LoadExpressions(expressions []Sexp) error
- func (env *Glisp) LoadFile(file *os.File) error
- func (env *Glisp) LoadStream(stream io.RuneScanner) error
- func (env *Glisp) LoadString(str string) error
- func (env *Glisp) MakeDotSymbol(name string) *SexpSymbol
- func (env *Glisp) MakeFunction(name string, nargs int, varargs bool, fun GlispFunction, orig Sexp) *SexpFunction
- func (env *Glisp) MakeSymbol(name string) *SexpSymbol
- func (env *Glisp) NewNamedScope(name string) *Scope
- func (env *Glisp) NewParser() *Parser
- func (env *Glisp) NewScope() *Scope
- func (env *Glisp) NewSexpArray(arr []Sexp) *SexpArray
- func (env *Glisp) NewStack(size int) *Stack
- func (env *Glisp) ParseFile(file string) ([]Sexp, error)
- func (env *Glisp) PostfixAssign(op string, bp int) *InfixOp
- func (env *Glisp) Prefix(op string, bp int) *InfixOp
- func (env *Glisp) ReachedEnd() bool
- func (env *Glisp) ReplLineInfixWrap(line string) string
- func (env *Glisp) ResolveDotSym(arg []Sexp) ([]Sexp, error)
- func (env *Glisp) ReturnFromFunction() error
- func (env *Glisp) Run() (Sexp, error)
- func (env *Glisp) ShowGlobalStack() error
- func (env *Glisp) ShowStackStackAndScopeStack() error
- func (env *Glisp) SourceExpressions(expressions []Sexp) error
- func (env *Glisp) SourceFile(file *os.File) error
- func (env *Glisp) SourceStream(stream io.RuneScanner) error
- func (env *Glisp) StandardSetup()
- func (env *Glisp) SubstituteRHS(args []Sexp) ([]Sexp, error)
- type GlispConfig
- type GlispFunction
- type GlispUserFunction
- type GoStructRegistryType
- func (gsr *GoStructRegistryType) GetOrCreatePointerType(pointedToType *RegisteredType) *RegisteredType
- func (gsr *GoStructRegistryType) GetOrCreateSliceType(rt *RegisteredType) *RegisteredType
- func (r *GoStructRegistryType) Lookup(name string) *RegisteredType
- func (r *GoStructRegistryType) RegisterBuiltin(name string, e *RegisteredType)
- func (r *GoStructRegistryType) RegisterPointer(pointedToName string, pointedToType *RegisteredType) *RegisteredType
- func (r *GoStructRegistryType) RegisterUserdef(name string, e *RegisteredType, hasShadowStruct bool)
- type GotoInstr
- type HashFieldDet
- type HashizeInstr
- type Hellcat
- type Hornet
- type InfixOp
- type Instruction
- type IntegerOp
- type JumpInstr
- type KiSlice
- type LabelInstr
- type LeftMuncher
- type Lexer
- func (lex *Lexer) AddNextStream(s io.RuneScanner)
- func (lexer *Lexer) AppendToken(tok Token)
- func (x *Lexer) DecodeAtom(atom string) (Token, error)
- func (x *Lexer) DecodeBrace(brace rune) Token
- func (lex *Lexer) EmptyToken() Token
- func (lexer *Lexer) GetNextToken() (tok Token, err error)
- func (lexer *Lexer) LexNextRune(r rune) error
- func (lexer *Lexer) Linenum() int
- func (lexer *Lexer) PeekNextToken() (tok Token, err error)
- func (lexer *Lexer) PrependToken(tok Token)
- func (lex *Lexer) PromoteNextStream() (ok bool)
- func (lex *Lexer) Reset()
- func (lex *Lexer) Token(typ TokenType, str string) Token
- type LexerState
- type Loop
- type LoopStartInstr
- type MakeGoStructFunc
- type NumericOp
- type Parser
- func (p *Parser) GetMoreInput(deliverThese []Sexp, errorToReport error) error
- func (p *Parser) HaveStuffToSend() chan []ParserReply
- func (p *Parser) InfiniteParsingLoop()
- func (p *Parser) NewInput(s io.RuneScanner)
- func (parser *Parser) ParseArray(depth int) (Sexp, error)
- func (parser *Parser) ParseBlockComment(start *Token) (sx Sexp, err error)
- func (parser *Parser) ParseExpression(depth int) (res Sexp, err error)
- func (parser *Parser) ParseInfix(depth int) (Sexp, error)
- func (parser *Parser) ParseList(depth int) (sx Sexp, err error)
- func (p *Parser) ParseTokens() ([]Sexp, error)
- func (p *Parser) Reset()
- func (p *Parser) ResetAddNewInput(s io.RuneScanner)
- func (p *Parser) Start()
- func (p *Parser) Stop() error
- type ParserReply
- type Person
- type Plane
- type PopInstr
- type PopScopeTransferToDataStackInstr
- type PopStackPutEnvInstr
- type PopUntilStackmarkInstr
- type PostHook
- type Pratt
- type PreHook
- type PrintState
- type Prompter
- type PushInstr
- type PushStackmarkInstr
- type RecordDefn
- type RegisteredType
- type RemoveScopeInstr
- type ReturnInstr
- type RightMuncher
- type Scope
- func (s *Scope) CloneScope() *Scope
- func (scope *Scope) DeleteSymbolInScope(sym *SexpSymbol) error
- func (s Scope) IsStackElem()
- func (s *Scope) SexpString(ps *PrintState) string
- func (scop *Scope) Show(env *Glisp, ps *PrintState, label string) (s string, err error)
- func (s *Scope) Type() *RegisteredType
- func (scope *Scope) UpdateSymbolInScope(sym *SexpSymbol, expr Sexp) error
- type Seen
- type Selector
- type Sexp
- func AddressOfFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func AppendFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func ApplyFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func ArrayAccessFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func ArrayIndexFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func ArrayOfFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func AssignmentFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func BaseTypeConstructorFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func BinaryIntFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func BitwiseFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func CallGoMethodFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func CallZMethodOnRecordFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func ChanTxFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func ColonAccessBuilder(env *Glisp, name string, args []Sexp) (Sexp, error)
- func CommaBuilder(env *Glisp, name string, args []Sexp) (Sexp, error)
- func CompareFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func ComplementFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func ConcatArray(arr *SexpArray, rest []Sexp) (Sexp, error)
- func ConcatFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func ConcatList(a *SexpPair, b Sexp) (Sexp, error)
- func ConsFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func ConstructorFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func CreateGoroutineMacro(env *Glisp, name string, args []Sexp) (Sexp, error)
- func DeclareMsgpackMapFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func DefinedFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func DerefFunction(env *Glisp, name string, args []Sexp) (result Sexp, err error)
- func DotFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func DumpClosureEnvFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func EvalFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func ExitFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func ExpectErrorBuilder(env *Glisp, name string, args []Sexp) (Sexp, error)
- func FirstFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func FlattenToWordsFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func FuncBuilder(env *Glisp, name string, args []Sexp) (Sexp, error)
- func GOOSFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func GenericAccessFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func GenericHpairFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func GensymFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func GoFieldListFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func GoMethodListFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func GoToSexp(iface interface{}, env *Glisp) (Sexp, error)
- func GobDecodeFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func GobEncodeFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func GoonDumpFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func HashAccessFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func HashColonFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func HashIndexFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func ImportPackageBuilder(env *Glisp, name string, args []Sexp) (Sexp, error)
- func InfixBuilder(env *Glisp, name string, args []Sexp) (Sexp, error)
- func IntegerDo(op IntegerOp, a, b Sexp) (Sexp, error)
- func InterfaceBuilder(env *Glisp, name string, args []Sexp) (Sexp, error)
- func JoinSymFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func JsonFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func JsonToSexp(json []byte, env *Glisp) (Sexp, error)
- func LenFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func ListToArray(expr Sexp) ([]Sexp, error)
- func MakeArrayFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func MakeChanFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func MakeList(expressions []Sexp) Sexp
- func MapArray(env *Glisp, fun *SexpFunction, arr *SexpArray) (Sexp, error)
- func MapFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func MapList(env *Glisp, fun *SexpFunction, expr Sexp) (Sexp, error)
- func MsgpackMapMacro(env *Glisp, name string, args []Sexp) (Sexp, error)
- func MsgpackToSexp(msgp []byte, env *Glisp) (Sexp, error)
- func NotFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func NowFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func NumericDo(op NumericOp, a, b Sexp) (Sexp, error)
- func NumericFloatDo(op NumericOp, a, b *SexpFloat) Sexp
- func NumericFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func NumericIntDo(op NumericOp, a, b *SexpInt) Sexp
- func NumericMatchChar(op NumericOp, a *SexpChar, b Sexp) (Sexp, error)
- func NumericMatchFloat(op NumericOp, a *SexpFloat, b Sexp) (Sexp, error)
- func NumericMatchInt(op NumericOp, a *SexpInt, b Sexp) (Sexp, error)
- func OldEvalFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func PointerOrNumericFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func PointerToFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func PrintFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func QuoteListFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func RandomFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func RawToStringFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func ReadFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func RegexpCompile(env *Glisp, name string, args []Sexp) (Sexp, error)
- func RegexpFind(env *Glisp, name string, args []Sexp) (Sexp, error)
- func RemoveSymFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func RestFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func SecondFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func SetPrettyPrintFlag(env *Glisp, name string, args []Sexp) (Sexp, error)
- func SgetFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func SimpleSourceFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func SliceFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func SliceOfFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func SlurpfileFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func SourceFileFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func SplitStringFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func SplitStringOnNewlinesFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func StartGoroutineFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func StopFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func Str2SymFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func StringUtilFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func StringifyFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func StructBuilder(env *Glisp, name string, args []Sexp) (Sexp, error)
- func StructConstructorFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func Sym2StrFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func SymnumFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func SystemBuilder(env *Glisp, name string, args []Sexp) (Sexp, error)
- func SystemFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func ThreadMapFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func TimeitFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func ToGoFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func TypeListFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func TypeQueryFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- func VarBuilder(env *Glisp, name string, args []Sexp) (Sexp, error)
- func WriteToFileFunction(env *Glisp, name string, args []Sexp) (Sexp, error)
- type SexpArray
- type SexpArraySelector
- type SexpBool
- type SexpChannel
- type SexpChar
- type SexpClosureEnv
- type SexpComma
- type SexpComment
- type SexpError
- type SexpField
- type SexpFloat
- type SexpFunction
- func (sf *SexpFunction) ClosingLookupSymbol(sym *SexpSymbol, setVal *Sexp) (Sexp, error, *Scope)
- func (sf *SexpFunction) ClosingLookupSymbolUntilFunction(sym *SexpSymbol) (Sexp, error, *Scope)
- func (sf *SexpFunction) Copy() *SexpFunction
- func (sf *SexpFunction) SetClosing(clos *Closing)
- func (sf *SexpFunction) SexpString(ps *PrintState) string
- func (sf *SexpFunction) ShowClosing(env *Glisp, ps *PrintState, label string) (string, error)
- func (sf *SexpFunction) Type() *RegisteredType
- type SexpGoroutine
- type SexpHash
- func (h *SexpHash) BindSymbol(key *SexpSymbol, val Sexp) error
- func (p *SexpHash) CloneFrom(src *SexpHash)
- func (p *SexpHash) CopyMap() *map[int][]*SexpPair
- func (h *SexpHash) DotPathHashGet(env *Glisp, sym *SexpSymbol) (Sexp, error)
- func (h *SexpHash) FillHashFromShadow(env *Glisp, src interface{}) error
- func (hash *SexpHash) HashDelete(key Sexp) error
- func (hash *SexpHash) HashGet(env *Glisp, key Sexp) (Sexp, error)
- func (hash *SexpHash) HashGetDefault(env *Glisp, key Sexp, defaultval Sexp) (Sexp, error)
- func (hash *SexpHash) HashPairi(pos int) (*SexpPair, error)
- func (hash *SexpHash) HashSet(key Sexp, val Sexp) error
- func (h *SexpHash) Lookup(env *Glisp, key Sexp) (expr Sexp, err error)
- func (h *SexpHash) NewSexpHashSelector(sym *SexpSymbol) *SexpHashSelector
- func (h *SexpHash) RunZmethod(method string, args []Sexp) (Sexp, error)
- func (h *SexpHash) SetDefnEnv(p *SexpHash)
- func (h *SexpHash) SetGoStructFactory(factory *RegisteredType)
- func (h *SexpHash) SetMain(p *SexpFunction)
- func (h *SexpHash) SetMethodList(env *Glisp) error
- func (hash *SexpHash) SexpString(ps *PrintState) string
- func (hash *SexpHash) ShortName() string
- func (r *SexpHash) Type() *RegisteredType
- func (h *SexpHash) TypeCheckField(key Sexp, val Sexp) error
- type SexpHashSelector
- type SexpInt
- type SexpInterfaceDecl
- type SexpPair
- type SexpPointer
- type SexpRaw
- type SexpReflect
- type SexpRegexp
- type SexpSemicolon
- type SexpSentinel
- type SexpStackmark
- type SexpStr
- type SexpSymbol
- type SexpTime
- type SexpUserVarDefn
- type ShortNamer
- type Showable
- type Snoopy
- type SquashInstr
- type Stack
- func (stack *Stack) BindSymbol(sym *SexpSymbol, expr Sexp) error
- func (stack *Stack) Clone() *Stack
- func (stack *Stack) DeleteSymbolFromTopOfStackScope(sym *SexpSymbol) error
- func (stack *Stack) Get(n int) (StackElem, error)
- func (stack *Stack) GetExpr(n int) (Sexp, error)
- func (stack *Stack) GetExpressions(n int) ([]Sexp, error)
- func (stack *Stack) GetTop() StackElem
- func (stack *Stack) IsEmpty() bool
- func (stack *Stack) IsStackElem()
- func (stack *Stack) LookupSymbol(sym *SexpSymbol, setVal *Sexp) (Sexp, error, *Scope)
- func (stack *Stack) LookupSymbolNonGlobal(sym *SexpSymbol) (Sexp, error, *Scope)
- func (stack *Stack) LookupSymbolUntilFunction(sym *SexpSymbol, setVal *Sexp) (Sexp, error, *Scope)
- func (stack *Stack) Pop() (StackElem, error)
- func (stack *Stack) PopAddr() (*SexpFunction, int, error)
- func (stack *Stack) PopExpr() (Sexp, error)
- func (stack *Stack) PopExpressions(n int) ([]Sexp, error)
- func (stack *Stack) PopScope() error
- func (stack *Stack) PrintScopeStack()
- func (stack *Stack) PrintStack()
- func (stack *Stack) Push(elem StackElem)
- func (stack *Stack) PushAddr(function *SexpFunction, pc int)
- func (stack *Stack) PushAllTo(target *Stack) int
- func (stack *Stack) PushExpr(expr Sexp)
- func (stack *Stack) PushExpressions(expr []Sexp) error
- func (stack *Stack) PushScope()
- func (s *Stack) SexpString(ps *PrintState) string
- func (stack *Stack) Show(env *Glisp, ps *PrintState, label string) (string, error)
- func (stack *Stack) Size() int
- func (stack *Stack) Top() int
- func (stack *Stack) TruncateToSize(newsize int)
- func (s *Stack) Type() *RegisteredType
- type StackElem
- type StmtMuncher
- type SymtabE
- type SymtabSorter
- type Token
- type TokenType
- type UpdateInstr
- type VectorizeInstr
- type Weather
- func (z *Weather) DecodeMsg(dc *msgp.Reader) (err error)
- func (z *Weather) EncodeMsg(en *msgp.Writer) (err error)
- func (w *Weather) IsSunny() bool
- func (z *Weather) MarshalMsg(b []byte) (o []byte, err error)
- func (z *Weather) Msgsize() (s int)
- func (z *Weather) UnmarshalMsg(bts []byte) (o []byte, err error)
- type Wings
Constants ¶
const CallStackSize = 25
const DataStackSize = 100
const LoopStackSize = 5
const ScopeStackSize = 50
const SliceDefaultCap = 10
const StackStackSize = 5
const YesIamEmbeddedAbove = true
Variables ¶
var ( BoolRegex = regexp.MustCompile("^(true|false)$") DecimalRegex = regexp.MustCompile("^-?[0-9]+$") HexRegex = regexp.MustCompile("^0x[0-9a-fA-F]+$") OctRegex = regexp.MustCompile("^0o[0-7]+$") BinaryRegex = regexp.MustCompile("^0b[01]+$") // SymbolRegex = regexp.MustCompile("^[^'#]+$") // (Sigil) symbols can begin with #, $, ?, but // sigils cannot appear later in any symbol. // Symbols cannot contain whitespace nor `~`, `@`, `(`, `)`, `[`, `]`, // `{`, `}`, `'`, `#`, `^`, `\`, `|`, `%`, `"`, `;`. They can optionally // end in `:`. // Nor, obviously, can symbols contain backticks, "`". // Symbols cannot start with a number. DotSymbols cannot have a number // as the first character after '.' SymbolRegex = regexp.MustCompile(`^[#$?]?[^#$?':;\\~@\[\]{}\^|"()%0-9,&][^'#:;\\~@\[\]{}\^|"()%,&*\-]*[:]?$`) // dot symbol examples: `.`, `.a`, `.a.b`, `.a.b.c` // dot symbol non-examples: `.a.`, `..` DotSymbolRegex = regexp.MustCompile(`^[.]$|^([.][^'#:;\\~@\[\]{}\^|"()%.0-9,][^'#:;\\~@\[\]{}\^|"()%.,*+\-]*)+$|^[^'#:;\\~@\[\]{}\^|"()%.0-9,][^'#:;\\~@\[\]{}\^|"()%.,*+\-]*([.][^'#:;\\~@\[\]{}\^|"()%.0-9,][^'#:;\\~@\[\]{}\^|"()%.,*+\-]*)+$`) DotPartsRegex = regexp.MustCompile(`[.]?[^'#:;\\~@\[\]{}\^|"()%.0-9,][^'#:;\\~@\[\]{}\^|"()%.,]*`) CharRegex = regexp.MustCompile("^'\\\\?.'$") FloatRegex = regexp.MustCompile("^-?([0-9]+\\.[0-9]*)$|-?(\\.[0-9]+)$|-?([0-9]+(\\.[0-9]*)?[eE](-?[0-9]+))$") ComplexRegex = regexp.MustCompile("^-?([0-9]+\\.[0-9]*)i?$|-?(\\.[0-9]+)i?$|-?([0-9]+(\\.[0-9]*)?[eE](-?[0-9]+))i?$") BuiltinOpRegex = regexp.MustCompile(`^(\+\+|\-\-|\+=|\-=|=|==|:=|\+|\-|\*|<|>|<=|>=|<-|->|\*=|/=|\*\*|!|!=|<!)$`) )
var EndTk = Token{/* contains filtered or unexported fields */}
var ErrBadBreakLabel = fmt.Errorf("bad break label")
var ErrBadContinueLabel = fmt.Errorf("bad continue label")
var ErrBadLoopSyntax = fmt.Errorf("for loop: first argument must be a label or a vector of [init predicate advance]")
var ErrBadQuotedSym = fmt.Errorf("not a quoted symbol")
var ErrMoreInputNeeded = fmt.Errorf("parser needs more input")
var ErrShuttingDown error = fmt.Errorf("lexer shutting down")
var GITLASTCOMMIT string
var GITLASTTAG string
version information. See Makefile and gitcommit.go for update/init.
var KeyNotSymbol = fmt.Errorf("key is not a symbol")
var ListRegisteredTypes = []string{}
consistently ordered list of all registered types (created at init time).
var MethodNotFound = fmt.Errorf("method not found")
var MissingFunction = &SexpFunction{name: "__missing", user: true}
var NoAttachedGoStruct = fmt.Errorf("hash has no attach Go struct")
var NoExpressionsFound = fmt.Errorf("No expressions found")
var NotAList = errors.New("not a list")
var OutOfBounds error = errors.New("jump out of bounds")
var ParserHaltRequested = fmt.Errorf("parser halt requested")
var Q = func(quietly_ignored ...interface{}) {} // quiet
var ReservedWords = []string{"byte", "defbuild", "builder", "field", "and", "or", "cond", "quote", "def", "mdef", "fn", "defn", "begin", "let", "letseq", "assert", "defmac", "macexpand", "syntaxQuote", "include", "for", "set", "break", "continue", "newScope", "_ls", "int8", "int16", "int32", "int64", "uint8", "uint16", "uint32", "uint64", "float32", "float64", "complex64", "complex128", "bool", "string", "any", "break", "case", "chan", "const", "continue", "default", "else", "defer", "fallthrough", "for", "func", "go", "goto", "if", "import", "interface", "map", "package", "range", "return", "select", "struct", "switch", "type", "var", "append", "cap", "close", "complex", "copy", "delete", "imag", "len", "make", "new", "panic", "print", "println", "real", "recover", "null", "nil", "-", "+", "--", "++", "-=", "+=", ":=", "=", ">", "<", ">=", "<=", "send"}
var ResetRequested = fmt.Errorf("parser reset requested")
var SexpEnd = &SexpSentinel{Val: 1}
var SexpFloatSize = 64
var SexpIntSize = 64
var SexpMarker = &SexpSentinel{Val: 2}
var SexpNull = &SexpSentinel{Val: 0}
these are values now so that they also have addresses.
var ShellCmd string = "/bin/bash"
var StackUnderFlowErr = fmt.Errorf("invalid stack access: underflow")
var SymNotFound = errors.New("symbol not found")
var UnexpectedEnd error = errors.New("Unexpected end of input")
var V = VPrintf
var Verbose bool // set to true to debug
var W = WPrintf
var Working bool // currently under investigation
var WrongNargs error = fmt.Errorf("wrong number of arguments")
var WrongType error = errors.New("operands have invalid type")
Functions ¶
func AllBuiltinFunctions ¶
func AllBuiltinFunctions() map[string]GlispUserFunction
AllBuiltinFunctions returns all built in functions
func Blake2bUint64 ¶
Blake2bUint64 returns an 8 byte BLAKE2b cryptographic hash of the raw.
we're using the pure go: https://github.com/dchest/blake2b
but the C-wrapped refence may be helpful as well --
reference: https://godoc.org/github.com/codahale/blake2 reference: https://blake2.net/ reference: https://tools.ietf.org/html/rfc7693
func ClosureToString ¶ added in v1.5.1
func ClosureToString(f *SexpFunction, env *Glisp) string
func CoreFunctions ¶
func CoreFunctions() map[string]GlispUserFunction
CoreFunctions returns all of the core logic
func CountPostHook ¶
func CountPreHook ¶
func DecodeChar ¶
func EncodingFunctions ¶
func EncodingFunctions() map[string]GlispUserFunction
func EscapeChar ¶
func FileExists ¶ added in v1.2.0
func GetEmbedPath ¶ added in v1.3.1
func GoToMsgpack ¶
func HashCountKeys ¶
func HashIsEmpty ¶
func IsExactlyDoublePointer ¶ added in v1.3.1
func IsExactlyDoublePointer(target interface{}) bool
true if target is of type **T where T is a struct/string/int/other-non-pointer type.
func IsExactlySinglePointer ¶ added in v1.3.1
func IsExactlySinglePointer(target interface{}) bool
true if target is type *T where T is a struct/string/int/other-non-pointer type.
func IsExactlySinglePointerType ¶ added in v1.4.7
func MergeFuncMap ¶
func MergeFuncMap(funcs ...map[string]GlispUserFunction) map[string]GlispUserFunction
MergeFuncMap returns the union of the two given maps
func MyWordCompleter ¶
complete phrases that start with '('
func NilOrHoldsNil ¶ added in v1.4.7
func NilOrHoldsNil(iface interface{}) bool
detect if inteface is holding anything
func P ¶ added in v1.5.3
func P(format string, stuff ...interface{})
P is a shortcut for a call to fmt.Printf that implicitly starts and ends its message with a newline.
func PointerDepth ¶ added in v1.4.7
func ReflectionFunctions ¶
func ReflectionFunctions() map[string]GlispUserFunction
func RemoveCommasFilter ¶
detect SexpComma values and return false on them to filter them out.
func RemoveCommentsFilter ¶
func RemoveEndsFilter ¶
detect SexpEnd values and return false on them to filter them out.
func Repl ¶
func Repl(env *Glisp, cfg *GlispConfig)
func SandboxSafeFunctions ¶
func SandboxSafeFunctions() map[string]GlispUserFunction
SandboxSafeFuncs returns all functions that are safe to run in a sandbox
func SetHashKeyOrder ¶
func SexpToGo ¶
translate an Sexpr to a go value that doesn't depend on any Sexp/Glisp types. Glisp maps will get turned into map[string]interface{}. This is mostly just an exercise in type conversion.
func SexpToGoStructs ¶ added in v1.3.1
try to convert to registered go structs if possible, filling in the structure of target (should be a pointer).
func SexpToMsgpack ¶
translate to sexp -> json -> go -> msgpack returns both the msgpack []bytes and the go intermediary
func StrFunctions ¶
func StrFunctions() map[string]GlispUserFunction
func StringToRunes ¶
func SystemFunctions ¶
func SystemFunctions() map[string]GlispUserFunction
func UseConveyDummy ¶ added in v1.3.7
func UseConveyDummy()
don't need to call, here for the import dependency only
Types ¶
type AddFuncScopeHelper ¶
type AddFuncScopeHelper struct {
MyFunction *SexpFunction
}
type AddFuncScopeInstr ¶ added in v1.5.1
type AddFuncScopeInstr struct { Name string Helper *AddFuncScopeHelper // we need a pointer we can update later once we know MyFunction }
func (AddFuncScopeInstr) Execute ¶ added in v1.5.1
func (a AddFuncScopeInstr) Execute(env *Glisp) error
func (AddFuncScopeInstr) InstrString ¶ added in v1.5.1
func (a AddFuncScopeInstr) InstrString() string
type AddScopeInstr ¶
type AddScopeInstr struct {
Name string
}
func (AddScopeInstr) Execute ¶
func (a AddScopeInstr) Execute(env *Glisp) error
func (AddScopeInstr) InstrString ¶
func (a AddScopeInstr) InstrString() string
type Address ¶
type Address struct {
// contains filtered or unexported fields
}
func (Address) IsStackElem ¶
func (a Address) IsStackElem()
type AssignInstr ¶
type AssignInstr struct { }
func (AssignInstr) Execute ¶
func (a AssignInstr) Execute(env *Glisp) error
func (AssignInstr) InstrString ¶
func (a AssignInstr) InstrString() string
type BindlistInstr ¶
type BindlistInstr struct {
// contains filtered or unexported fields
}
bind these symbols to the SexpPair list found at datastack top.
func (BindlistInstr) Execute ¶
func (b BindlistInstr) Execute(env *Glisp) error
func (BindlistInstr) InstrString ¶
func (b BindlistInstr) InstrString() string
type BranchInstr ¶
type BranchInstr struct {
// contains filtered or unexported fields
}
func (BranchInstr) Execute ¶
func (b BranchInstr) Execute(env *Glisp) error
func (BranchInstr) InstrString ¶
func (b BranchInstr) InstrString() string
type BreakInstr ¶
type BreakInstr struct {
// contains filtered or unexported fields
}
func (*BreakInstr) Execute ¶
func (s *BreakInstr) Execute(env *Glisp) error
func (BreakInstr) InstrString ¶
func (s BreakInstr) InstrString() string
type CallInstr ¶
type CallInstr struct {
// contains filtered or unexported fields
}
func (CallInstr) InstrString ¶
type ClearStackmarkInstr ¶
type ClearStackmarkInstr struct {
// contains filtered or unexported fields
}
erase everything up-to-and-including our mark
func (ClearStackmarkInstr) Execute ¶
func (s ClearStackmarkInstr) Execute(env *Glisp) error
func (ClearStackmarkInstr) InstrString ¶
func (s ClearStackmarkInstr) InstrString() string
type Closing ¶ added in v1.5.1
where we store our closure-supporing stack pointers
func NewClosing ¶ added in v1.5.1
func (*Closing) IsStackElem ¶ added in v1.5.1
func (c *Closing) IsStackElem()
func (*Closing) LookupSymbol ¶ added in v1.5.1
func (*Closing) LookupSymbolUntilFunction ¶ added in v1.5.1
func (c *Closing) LookupSymbolUntilFunction(sym *SexpSymbol) (Sexp, error, *Scope)
type ContinueInstr ¶
type ContinueInstr struct {
// contains filtered or unexported fields
}
func (*ContinueInstr) Execute ¶
func (s *ContinueInstr) Execute(env *Glisp) error
func (ContinueInstr) InstrString ¶
func (s ContinueInstr) InstrString() string
type CreateClosureInstr ¶ added in v1.5.1
type CreateClosureInstr struct {
// contains filtered or unexported fields
}
when a defn or fn executes, capture the creation env.
func (CreateClosureInstr) Execute ¶ added in v1.5.1
func (a CreateClosureInstr) Execute(env *Glisp) error
func (CreateClosureInstr) InstrString ¶ added in v1.5.1
func (a CreateClosureInstr) InstrString() string
type DataStackElem ¶
type DataStackElem struct {
// contains filtered or unexported fields
}
func (DataStackElem) IsStackElem ¶
func (d DataStackElem) IsStackElem()
type DebugInstr ¶ added in v1.4.1
type DebugInstr struct {
// contains filtered or unexported fields
}
func (DebugInstr) Execute ¶ added in v1.4.1
func (g DebugInstr) Execute(env *Glisp) error
func (DebugInstr) InstrString ¶ added in v1.4.1
func (g DebugInstr) InstrString() string
type DispatchInstr ¶
type DispatchInstr struct {
// contains filtered or unexported fields
}
func (DispatchInstr) Execute ¶
func (d DispatchInstr) Execute(env *Glisp) error
func (DispatchInstr) InstrString ¶
func (d DispatchInstr) InstrString() string
type EnvToStackInstr ¶
type EnvToStackInstr struct {
// contains filtered or unexported fields
}
func (EnvToStackInstr) Execute ¶
func (g EnvToStackInstr) Execute(env *Glisp) error
func (EnvToStackInstr) InstrString ¶
func (g EnvToStackInstr) InstrString() string
type Event ¶
type Event struct { Id int `json:"id" msg:"id"` User Person `json:"user" msg:"user"` Flight string `json:"flight" msg:"flight"` Pilot []string `json:"pilot" msg:"pilot"` Cancelled bool `json:"cancelled" msg:"cancelled"` }
func (*Event) DisplayEvent ¶
func (*Event) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
type ExplodeInstr ¶
type ExplodeInstr int
func (ExplodeInstr) Execute ¶
func (e ExplodeInstr) Execute(env *Glisp) error
func (ExplodeInstr) InstrString ¶
func (e ExplodeInstr) InstrString() string
type Generator ¶
type Generator struct { Tail bool // contains filtered or unexported fields }
func NewGenerator ¶
func (*Generator) AddInstruction ¶
func (gen *Generator) AddInstruction(instr Instruction)
func (*Generator) AddInstructions ¶
func (gen *Generator) AddInstructions(instr []Instruction)
func (*Generator) GenerateAll ¶
func (*Generator) GenerateArray ¶
func (*Generator) GenerateAssert ¶
func (*Generator) GenerateAssignment ¶
func (*Generator) GenerateBegin ¶
func (*Generator) GenerateBreak ¶
func (*Generator) GenerateBuilder ¶
func (*Generator) GenerateCall ¶
func (*Generator) GenerateCallBySymbol ¶
func (gen *Generator) GenerateCallBySymbol(sym *SexpSymbol, args []Sexp, orig Sexp) error
func (*Generator) GenerateCond ¶
func (*Generator) GenerateContinue ¶
func (*Generator) GenerateDebug ¶ added in v1.4.1
func (*Generator) GenerateDefmac ¶
func (*Generator) GenerateDispatch ¶
func (*Generator) GenerateForLoop ¶
for loops: Just like in C.
(for {optional-label} [init predicate advance] (expr)*)
Each of init, predicate, and advance are expressions that are evaluated during the running of the for loop. The init expression is evaluated once at the top. The predicate is tested. If it is true then the body expressions are run. Then the advance expression is evaluated, and we return to the predicate test.
func (*Generator) GenerateInclude ¶
func (*Generator) GenerateMacexpand ¶
func (*Generator) GenerateMultiDef ¶
(mdef a b c (list 1 2 3)) will bind a:1 b:2 c:3
func (*Generator) GenerateNewScope ¶ added in v1.4.1
like begin, but puts its contents in a new scope
func (*Generator) GeneratePackage ¶
func (*Generator) GenerateQuote ¶
func (*Generator) GenerateReturn ¶
func (*Generator) GenerateShortCircuit ¶
func (*Generator) GenerateSyntaxQuote ¶
side-effect (or main effect) has to be pushing an expression on the top of the datastack that represents the expanded and substituted expression
type Glisp ¶
type Glisp struct { Pretty bool // contains filtered or unexported fields }
func NewGlispSandbox ¶
func NewGlispSandbox() *Glisp
NewGlispSandbox returns a new *Glisp instance that does not allow the user to get to the outside world
func NewGlispWithFuncs ¶
func NewGlispWithFuncs(funcs map[string]GlispUserFunction) *Glisp
NewGlispWithFuncs returns a new *Glisp instance with access to only the given builtin functions
func (*Glisp) AddBuilder ¶
func (env *Glisp) AddBuilder(name string, function GlispUserFunction)
func (*Glisp) AddFunction ¶
func (env *Glisp) AddFunction(name string, function GlispUserFunction)
func (*Glisp) AddMacro ¶
func (env *Glisp) AddMacro(name string, function GlispUserFunction)
func (*Glisp) AddPostHook ¶
func (*Glisp) AddPreHook ¶
func (*Glisp) Assignment ¶
Assignment creates a new assignment operator for infix processing.
func (*Glisp) CallFunction ¶
func (env *Glisp) CallFunction(function *SexpFunction, nargs int) error
func (*Glisp) CallUserFunction ¶
func (*Glisp) CurrentFunctionSize ¶
func (*Glisp) DetectSigils ¶
func (env *Glisp) DetectSigils(sym *SexpSymbol)
func (*Glisp) DumpEnvironment ¶
func (env *Glisp) DumpEnvironment()
func (*Glisp) DumpFunctionByName ¶
func (*Glisp) EliminateColonAndCommaFromArgs ¶
func (*Glisp) EvalExpressions ¶ added in v1.5.9
for most things now (except the main repl), prefer EvalFunction() instead of EvalExpressions.
func (*Glisp) FunctionCallNameTypeCheck ¶
func (env *Glisp) FunctionCallNameTypeCheck(f *SexpFunction, nargs *int) error
FunctionCallNameTypeCheck type checks a function call.
func (*Glisp) GenSymbol ¶
func (env *Glisp) GenSymbol(prefix string) *SexpSymbol
func (*Glisp) GetStackTrace ¶
func (*Glisp) HasMacro ¶
func (env *Glisp) HasMacro(sym *SexpSymbol) bool
func (*Glisp) ImportBaseTypes ¶
func (env *Glisp) ImportBaseTypes()
func (*Glisp) ImportChannels ¶
func (env *Glisp) ImportChannels()
func (*Glisp) ImportEval ¶
func (env *Glisp) ImportEval()
func (*Glisp) ImportGoroutines ¶
func (env *Glisp) ImportGoroutines()
func (*Glisp) ImportMsgpackMap ¶
func (env *Glisp) ImportMsgpackMap()
func (*Glisp) ImportPackageBuilder ¶
func (env *Glisp) ImportPackageBuilder()
A builder is a special kind of function. Like a macro it receives the un-evaluated tree of symbols from its caller. A builder can therefore be used to build new types and declarations new functions/methods.
Like a function, a builder is called at run/evaluation time, not at definition time.
Since it receives an un-evaluated tree of symbols, a builder must manually evaluate any arguments it wishes to find bindings for.
The primary use here is to be able to define packages, structs, interfaces, functions, methods, and type aliases.
func (*Glisp) ImportRandom ¶
func (env *Glisp) ImportRandom()
func (*Glisp) ImportRegex ¶
func (env *Glisp) ImportRegex()
func (*Glisp) ImportTime ¶
func (env *Glisp) ImportTime()
func (*Glisp) Infixr ¶
Infix creates a new (right-associative) short-circuiting infix operator, used for `and` and `or` in infix processing.
func (*Glisp) InitInfixOps ¶
func (env *Glisp) InitInfixOps()
InitInfixOps establishes the env.infixOps definitions required for infix parsing using the Pratt parser.
func (*Glisp) IsBuiltinSym ¶
func (env *Glisp) IsBuiltinSym(sym *SexpSymbol) (builtin bool, typ string)
func (*Glisp) LexicalBindSymbol ¶ added in v1.5.1
func (env *Glisp) LexicalBindSymbol(sym *SexpSymbol, expr Sexp) error
func (*Glisp) LexicalLookupSymbol ¶ added in v1.5.1
func (*Glisp) LoadExpressions ¶
func (*Glisp) LoadStream ¶
func (env *Glisp) LoadStream(stream io.RuneScanner) error
func (*Glisp) LoadString ¶
func (*Glisp) MakeDotSymbol ¶
func (env *Glisp) MakeDotSymbol(name string) *SexpSymbol
func (*Glisp) MakeFunction ¶ added in v1.5.1
func (env *Glisp) MakeFunction(name string, nargs int, varargs bool, fun GlispFunction, orig Sexp) *SexpFunction
func (*Glisp) MakeSymbol ¶
func (env *Glisp) MakeSymbol(name string) *SexpSymbol
func (*Glisp) NewNamedScope ¶ added in v1.5.1
func (*Glisp) NewSexpArray ¶
func (*Glisp) PostfixAssign ¶
PostfixAssign creates a new postfix assignment operator for infix processing.
func (*Glisp) ReachedEnd ¶
func (*Glisp) ReplLineInfixWrap ¶
func (*Glisp) ReturnFromFunction ¶
func (*Glisp) ShowGlobalStack ¶
func (*Glisp) ShowStackStackAndScopeStack ¶ added in v1.4.1
func (*Glisp) SourceExpressions ¶
SourceExpressions, this should be called from a user func context
func (*Glisp) SourceStream ¶
func (env *Glisp) SourceStream(stream io.RuneScanner) error
func (*Glisp) StandardSetup ¶
func (env *Glisp) StandardSetup()
type GlispConfig ¶
type GlispConfig struct { CpuProfile string MemProfile string ExitOnFailure bool CountFuncCalls bool Flags *flag.FlagSet ExtensionsVersion string Command string Sandboxed bool Quiet bool Trace bool }
configure a glisp repl
func NewGlispConfig ¶
func NewGlispConfig(cmdname string) *GlispConfig
func (*GlispConfig) DefineFlags ¶
func (c *GlispConfig) DefineFlags()
call DefineFlags before myflags.Parse()
func (*GlispConfig) ValidateConfig ¶
func (c *GlispConfig) ValidateConfig() error
call c.ValidateConfig() after myflags.Parse()
type GlispFunction ¶
type GlispFunction []Instruction
type GoStructRegistryType ¶
type GoStructRegistryType struct { // comprehensive Registry map[string]*RegisteredType // only init-time builtins Builtin map[string]*RegisteredType // later, user-defined types Userdef map[string]*RegisteredType }
the registry type
var GoStructRegistry GoStructRegistryType
The Go Type Registry ====================
simply decide upon a name, and add a maker function for that returns a pointer to your struct. The simply add to the init() function below.
The env parameter to your MakeGoStructFunc() function is there is case you want to initialize your struct differently depending on the content of its context, but this is not commonly needed. Also, the factory method *must* support the env parameter being nil and still return a sensible, usable value. The factory will be called with env = nil during init() time.
The repl will automatically do a (defmap record) for each record defined in the registry. e.g. for snoopy, hornet, hellcat, etc.
func (*GoStructRegistryType) GetOrCreatePointerType ¶
func (gsr *GoStructRegistryType) GetOrCreatePointerType(pointedToType *RegisteredType) *RegisteredType
func (*GoStructRegistryType) GetOrCreateSliceType ¶
func (gsr *GoStructRegistryType) GetOrCreateSliceType(rt *RegisteredType) *RegisteredType
func (*GoStructRegistryType) Lookup ¶
func (r *GoStructRegistryType) Lookup(name string) *RegisteredType
func (*GoStructRegistryType) RegisterBuiltin ¶
func (r *GoStructRegistryType) RegisterBuiltin(name string, e *RegisteredType)
func (*GoStructRegistryType) RegisterPointer ¶
func (r *GoStructRegistryType) RegisterPointer(pointedToName string, pointedToType *RegisteredType) *RegisteredType
func (*GoStructRegistryType) RegisterUserdef ¶
func (r *GoStructRegistryType) RegisterUserdef( name string, e *RegisteredType, hasShadowStruct bool)
type GotoInstr ¶
type GotoInstr struct {
// contains filtered or unexported fields
}
func (GotoInstr) InstrString ¶
type HashFieldDet ¶ added in v1.3.1
type HashizeInstr ¶
func (HashizeInstr) Execute ¶
func (s HashizeInstr) Execute(env *Glisp) error
func (HashizeInstr) InstrString ¶
func (s HashizeInstr) InstrString() string
type InfixOp ¶
type InfixOp struct { Sym *SexpSymbol Bp int // binding power, aka precedence level. MunchRight RightMuncher // aka nud MunchLeft LeftMuncher // aka led MunchStmt StmtMuncher // aka std. Used only at the beginning of a statement. IsAssign bool }
InfixOp lets us attach led (MunchLeft) and nud (MunchRight) Pratt parsing methods, along with a binding power, to a symbol.
type Instruction ¶
type JumpInstr ¶
type JumpInstr struct {
// contains filtered or unexported fields
}
func (JumpInstr) InstrString ¶
type LabelInstr ¶
type LabelInstr struct {
// contains filtered or unexported fields
}
func (LabelInstr) Execute ¶
func (s LabelInstr) Execute(env *Glisp) error
func (LabelInstr) InstrString ¶
func (s LabelInstr) InstrString() string
type Lexer ¶
type Lexer struct {
// contains filtered or unexported fields
}
func (*Lexer) AddNextStream ¶ added in v1.5.3
func (lex *Lexer) AddNextStream(s io.RuneScanner)
func (*Lexer) AppendToken ¶
func (*Lexer) DecodeBrace ¶
func (*Lexer) EmptyToken ¶
func (*Lexer) GetNextToken ¶
func (*Lexer) LexNextRune ¶
func (*Lexer) PeekNextToken ¶
func (*Lexer) PrependToken ¶
func (*Lexer) PromoteNextStream ¶ added in v1.5.3
type LexerState ¶
type LexerState int
const ( LexerNormal LexerState = iota LexerCommentLine // LexerStrLit // LexerStrEscaped // LexerUnquote // LexerBacktickString // LexerFreshAssignOrColon LexerFirstFwdSlash // could be start of // comment or /* LexerCommentBlock LexerCommentBlockAsterisk // could be end of block comment */ LexerBuiltinOperator )
type Loop ¶
type Loop struct {
// contains filtered or unexported fields
}
func (*Loop) IsStackElem ¶
func (loop *Loop) IsStackElem()
type LoopStartInstr ¶
type LoopStartInstr struct {
// contains filtered or unexported fields
}
func (LoopStartInstr) Execute ¶
func (s LoopStartInstr) Execute(env *Glisp) error
func (LoopStartInstr) InstrString ¶
func (s LoopStartInstr) InstrString() string
type MakeGoStructFunc ¶ added in v1.3.1
the type of all maker functions
type Parser ¶
type Parser struct { Done chan bool AddInput chan io.RuneScanner ReqReset chan io.RuneScanner ParsedOutput chan []ParserReply LastErr chan error FlagSendNeedInput bool // contains filtered or unexported fields }
func (*Parser) GetMoreInput ¶ added in v1.5.9
This function should *return* when it has more input for the parser/lexer, which will call it when they get wedged.
Listeners on p.ParsedOutput should know the Convention: sending a length 0 []ParserReply on p.ParsedOutput channel means: we need more input! They should send some in on p.AddInput channel; or request and reset and simultaneously give us new input with p.ReqReset channel.
func (*Parser) HaveStuffToSend ¶ added in v1.5.9
func (p *Parser) HaveStuffToSend() chan []ParserReply
func (*Parser) InfiniteParsingLoop ¶ added in v1.5.9
func (p *Parser) InfiniteParsingLoop()
func (*Parser) NewInput ¶ added in v1.5.3
func (p *Parser) NewInput(s io.RuneScanner)
func (*Parser) ParseArray ¶ added in v1.5.3
func (*Parser) ParseBlockComment ¶
func (*Parser) ParseExpression ¶ added in v1.5.3
func (*Parser) ParseTokens ¶ added in v1.5.3
ParseTokens is the main service the Parser provides. Currently returns first error encountered, ignoring any expressions after that.
func (*Parser) ResetAddNewInput ¶ added in v1.5.3
func (p *Parser) ResetAddNewInput(s io.RuneScanner)
type ParserReply ¶ added in v1.5.9
type Person ¶
func (Person) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
type Plane ¶ added in v1.3.1
type Plane struct { Wings //Name string `json:"name" msg:"name"` Speed int `json:"speed" msg:"speed"` Chld Flyer `json:"chld" msg:"chld"` Friends []Flyer `json:"friends"` }
the interface Flyer confounds the msgp msgpack code generator, so put the msgp:ignore Plane above
type PopScopeTransferToDataStackInstr ¶
type PopScopeTransferToDataStackInstr struct {
PackageName string
}
PopScopeTransferToDataStackInstr is used to wrap up a package and put it on the data stack as a value.
func (PopScopeTransferToDataStackInstr) Execute ¶
func (a PopScopeTransferToDataStackInstr) Execute(env *Glisp) error
func (PopScopeTransferToDataStackInstr) InstrString ¶
func (a PopScopeTransferToDataStackInstr) InstrString() string
type PopStackPutEnvInstr ¶
type PopStackPutEnvInstr struct {
// contains filtered or unexported fields
}
func (PopStackPutEnvInstr) Execute ¶
func (p PopStackPutEnvInstr) Execute(env *Glisp) error
func (PopStackPutEnvInstr) InstrString ¶
func (p PopStackPutEnvInstr) InstrString() string
type PopUntilStackmarkInstr ¶
type PopUntilStackmarkInstr struct {
// contains filtered or unexported fields
}
cleanup until our stackmark, but leave it in place
func (PopUntilStackmarkInstr) Execute ¶
func (s PopUntilStackmarkInstr) Execute(env *Glisp) error
func (PopUntilStackmarkInstr) InstrString ¶
func (s PopUntilStackmarkInstr) InstrString() string
type Pratt ¶
func (*Pratt) ShowCnodeStack ¶
func (p *Pratt) ShowCnodeStack()
type PrintState ¶
PrintState threads the state of display through SexpString() and Show() calls, to give pretty-printing indentation and to avoid infinite looping on cyclic data structures.
func NewPrintState ¶
func NewPrintState() *PrintState
func NewPrintStateWithIndent ¶
func NewPrintStateWithIndent(indent int) *PrintState
func (*PrintState) AddIndent ¶
func (ps *PrintState) AddIndent(addme int) *PrintState
func (*PrintState) Clear ¶
func (ps *PrintState) Clear()
func (*PrintState) Dump ¶
func (ps *PrintState) Dump()
func (*PrintState) GetIndent ¶
func (ps *PrintState) GetIndent() int
func (*PrintState) GetSeen ¶
func (ps *PrintState) GetSeen(x interface{}) bool
func (*PrintState) SetSeen ¶
func (ps *PrintState) SetSeen(x interface{}, name string)
type Prompter ¶ added in v1.1.9
type Prompter struct {
// contains filtered or unexported fields
}
func NewPrompter ¶ added in v1.1.9
func NewPrompter() *Prompter
type PushInstr ¶
type PushInstr struct {
// contains filtered or unexported fields
}
func (PushInstr) InstrString ¶
type PushStackmarkInstr ¶
type PushStackmarkInstr struct {
// contains filtered or unexported fields
}
create a stack mark
func (PushStackmarkInstr) Execute ¶
func (s PushStackmarkInstr) Execute(env *Glisp) error
func (PushStackmarkInstr) InstrString ¶
func (s PushStackmarkInstr) InstrString() string
type RecordDefn ¶
type RecordDefn struct { Name string Fields []*SexpField FieldType map[string]*RegisteredType }
func NewRecordDefn ¶
func NewRecordDefn() *RecordDefn
func (*RecordDefn) SetFields ¶
func (r *RecordDefn) SetFields(flds []*SexpField)
func (*RecordDefn) SetName ¶
func (r *RecordDefn) SetName(name string)
func (*RecordDefn) SexpString ¶
func (p *RecordDefn) SexpString(ps *PrintState) string
pretty print a struct
func (*RecordDefn) Type ¶
func (p *RecordDefn) Type() *RegisteredType
type RegisteredType ¶
type RegisteredType struct { Constructor *SexpFunction RegisteredName string Factory MakeGoStructFunc GenDefMap bool ValueCache reflect.Value TypeCache reflect.Type PointerName string ReflectName string IsUser bool Aliases map[string]bool DisplayAs string UserStructDefn *RecordDefn IsPointer bool // contains filtered or unexported fields }
var ArraySelectorRT *RegisteredType
var BoolRT *RegisteredType
var ClosureRT *RegisteredType
var ErrorRT *RegisteredType
var Float64RT *RegisteredType
var Int64RT *RegisteredType
var NullRT *RegisteredType
var PairRT *RegisteredType
var RawRT *RegisteredType
var ReflectRT *RegisteredType
var RuneRT *RegisteredType
var SentinelRT *RegisteredType
func NewRegisteredType ¶
func NewRegisteredType(f MakeGoStructFunc) *RegisteredType
func (*RegisteredType) Init ¶
func (e *RegisteredType) Init()
func (*RegisteredType) SexpString ¶
func (p *RegisteredType) SexpString(ps *PrintState) string
func (*RegisteredType) ShortName ¶
func (p *RegisteredType) ShortName() string
func (*RegisteredType) Type ¶
func (r *RegisteredType) Type() *RegisteredType
func (*RegisteredType) TypeCheckRecord ¶
func (p *RegisteredType) TypeCheckRecord(hash *SexpHash) error
type RemoveScopeInstr ¶
type RemoveScopeInstr struct{}
func (RemoveScopeInstr) Execute ¶
func (a RemoveScopeInstr) Execute(env *Glisp) error
func (RemoveScopeInstr) InstrString ¶
func (a RemoveScopeInstr) InstrString() string
type ReturnInstr ¶
type ReturnInstr struct {
// contains filtered or unexported fields
}
func (ReturnInstr) Execute ¶
func (r ReturnInstr) Execute(env *Glisp) error
func (ReturnInstr) InstrString ¶
func (r ReturnInstr) InstrString() string
type Scope ¶
type Scope struct { Map map[int]Sexp IsGlobal bool Name string PackageName string Parent *Scope IsFunction bool // if true, read-only. MyFunction *SexpFunction // so we can query captured closure scopes. IsPackage bool // contains filtered or unexported fields }
Scopes map names to values. Scope nesting avoids variable name collisions and allows namespace maintainance. Most scopes (inside loops, inside functions) are implicitly created. Packages are scopes that the user can manipulate explicitly.
func (*Scope) CloneScope ¶ added in v1.4.1
func (*Scope) DeleteSymbolInScope ¶
func (scope *Scope) DeleteSymbolInScope(sym *SexpSymbol) error
func (Scope) IsStackElem ¶
func (s Scope) IsStackElem()
func (*Scope) SexpString ¶
func (s *Scope) SexpString(ps *PrintState) string
SexpString satisfies the Sexp interface, producing a string presentation of the value.
func (*Scope) Type ¶
func (s *Scope) Type() *RegisteredType
Type() satisfies the Sexp interface, returning the type of the value.
func (*Scope) UpdateSymbolInScope ¶
func (scope *Scope) UpdateSymbolInScope(sym *SexpSymbol, expr Sexp) error
used to implement (set v 10)
type Seen ¶
type Seen map[interface{}]struct{}
Seen tracks if a value has already been displayed, to detect and avoid cycles.
Q: How to do garbage-collection safe graph traversal in a graph of Go objects?
A: "Instead of converting the pointer to a uintptr, just store the pointer itself in a map[interface{}]bool. If you encounter the same pointer again, you will get the same map entry. The GC must guarantee that using pointers as map keys will work even if the pointers move."
- Ian Lance Taylor on golang-nuts (2016 June 20).
type Selector ¶
type Selector interface { // RHS (right-hand-side) is used to dereference // the pointer-like Selector, yielding a value suitable for the // right-hand-side of an assignment statement. // RHS(env *Glisp) (Sexp, error) // AssignToSelection sets the selection to rhs // The selected elements are the left-hand-side of the // assignment *lhs = rhs AssignToSelection(env *Glisp, rhs Sexp) error }
Selector stores indexing information that isn't yet materialized for getting or setting.
type Sexp ¶
type Sexp interface { // SexpString: produce a string from our value. // Single-line strings can ignore indent. // Only multiline strings should follow every // newline with at least indent worth of spaces. SexpString(ps *PrintState) string // Type returns the type of the value. Type() *RegisteredType }
Sexp is the central interface for all S-expressions (Symbol expressions ala lisp).
func ArrayAccessFunction ¶
func ArrayIndexFunction ¶
(arrayidx ar [0 1])
func ArrayOfFunction ¶
generate fixed size array
func AssignmentFunction ¶ added in v1.6.1
the assignment function, =
func CallGoMethodFunction ¶ added in v1.4.7
Using reflection, invoke a Go method on a struct or interface. args[0] is a hash with an an attached GoStruct args[1] is a hash representing a method call on that struct. The returned Sexp is a hash that represents the result of that call.
func CallZMethodOnRecordFunction ¶ added in v1.5.1
func ColonAccessBuilder ¶
func CommaBuilder ¶
CommaBuilder turns expressions on the LHS and RHS like {a,b,c = 1,2,3} into arrays (set [a b c] [1 2 3])
func ComplementFunction ¶
func ConstructorFunction ¶
func CreateGoroutineMacro ¶
func DefinedFunction ¶
check is a symbol/string/value is defined
func DerefFunction ¶
func DotFunction ¶ added in v1.6.1
"." dot operator
func DumpClosureEnvFunction ¶ added in v1.5.1
_closdump : show the closed over env attached to an *SexpFunction
func EvalFunction ¶
EvalFunction: new version doesn't use a duplicated environment, allowing eval to create closures under the lexical scope and to allow proper scoping in a package.
func ExitFunction ¶ added in v1.4.5
func ExpectErrorBuilder ¶
func FlattenToWordsFunction ¶ added in v1.2.0
given strings/lists of strings with possible whitespace flatten out to a array of SexpStr with no internal whitespace, suitable for passing along to (system) / exec.Command()
func GenericAccessFunction ¶ added in v1.4.5
handles arrays or hashes
func GenericHpairFunction ¶ added in v1.4.3
works over hashes and arrays
func GoFieldListFunction ¶ added in v1.3.1
func GoMethodListFunction ¶ added in v1.3.1
func GobDecodeFunction ¶ added in v1.4.9
func GobEncodeFunction ¶ added in v1.4.9
func HashAccessFunction ¶
func HashIndexFunction ¶
(arrayidx ar [0 1]) refers here
func ImportPackageBuilder ¶
import a package, analagous to Golang.
func JoinSymFunction ¶ added in v1.6.2
func JsonFunction ¶
Conversion map Go map[string]interface{} <--(1)--> lisp ^ ^ | | / | (2) ------------ (4) -----------/ (5) | / | V V V msgpack <--(3)--> go struct, strongly typed
(1) we provide these herein; see jsonmsgp_test.go too.
(a) SexpToGo() (b) GoToSexp()
(2) provided by ugorji/go/codec; see examples also herein
(a) MsgpackToGo() / JsonToGo() (b) GoToMsgpack() / GoToJson()
(3) provided by tinylib/msgp, and by ugorji/go/codec
by using pre-compiled or just decoding into an instance of the struct.
(4) see herein
(a) SexpToMsgpack() and SexpToJson() (b) MsgpackToSexp(); uses (4) = (2) + (1)
(5) The SexpToGoStructs() and ToGoFunction() in this
file provide the capability of marshaling an s-expression to a Go-struct that has been registered to be associated with a named hash map using (defmap). See repl/gotypereg.go to add your Go-struct constructor. From the prompt, the (togo) function instantiates a 'shadow' Go-struct whose data matches that configured in the record.
func JsonToSexp ¶
json -> sexp. env is needed to handle symbols correctly
func ListToArray ¶
func MsgpackMapMacro ¶
declare a new record type
func NumericFloatDo ¶
func NumericIntDo ¶
func QuoteListFunction ¶ added in v1.6.2
'(a b c) -> ('a 'b 'c)
func RawToStringFunction ¶
func SetPrettyPrintFlag ¶
func SimpleSourceFunction ¶ added in v1.3.1
alternative. simpler, currently panics.
func SlurpfileFunction ¶ added in v1.2.0
read new-line delimited text from a file into an array (slurpf "path-to-file")
func SourceFileFunction ¶
func SplitStringFunction ¶
SplitStringFunction splits a string based on an arbitrary delimiter
func SplitStringOnNewlinesFunction ¶ added in v1.3.1
(nsplit "a\nb") -> ["a" "b"]
func StartGoroutineFunction ¶
func StopFunction ¶ added in v1.5.1
func StringUtilFunction ¶ added in v1.3.1
func SystemBuilder ¶
sys is a builder. shell out, return the combined output.
func SystemFunction ¶ added in v1.2.0
type SexpArray ¶
type SexpArray struct { Val []Sexp Typ *RegisteredType IsFuncDeclTypeArray bool Infix bool Env *Glisp }
func (*SexpArray) IndexBy ¶
IndexBy subsets one array (possibly multidimensional) by another. e.g. if arr is [a b c] and idx is [0], we'll return a.
func (*SexpArray) SexpString ¶
func (arr *SexpArray) SexpString(ps *PrintState) string
func (*SexpArray) Type ¶
func (r *SexpArray) Type() *RegisteredType
type SexpArraySelector ¶
SexpSelector: select a subset of an array: can be multidimensional index/slice and hence know its container and its position(s), and thus be able to read and write that position as need be.
func (*SexpArraySelector) AssignToSelection ¶
func (x *SexpArraySelector) AssignToSelection(env *Glisp, rhs Sexp) error
func (*SexpArraySelector) RHS ¶
func (x *SexpArraySelector) RHS(env *Glisp) (Sexp, error)
RHS applies the selector to the contain and returns the value obtained.
func (*SexpArraySelector) SexpString ¶
func (si *SexpArraySelector) SexpString(ps *PrintState) string
func (*SexpArraySelector) Type ¶
func (si *SexpArraySelector) Type() *RegisteredType
Type returns the type of the value.
type SexpBool ¶
type SexpBool struct { Val bool Typ *RegisteredType }
func (*SexpBool) SexpString ¶
func (b *SexpBool) SexpString(ps *PrintState) string
func (*SexpBool) Type ¶
func (r *SexpBool) Type() *RegisteredType
type SexpChannel ¶
type SexpChannel struct { Val chan Sexp Typ *RegisteredType }
func (*SexpChannel) SexpString ¶
func (ch *SexpChannel) SexpString(ps *PrintState) string
func (*SexpChannel) Type ¶
func (ch *SexpChannel) Type() *RegisteredType
type SexpChar ¶
type SexpChar struct { Val rune Typ *RegisteredType }
func (*SexpChar) SexpString ¶
func (c *SexpChar) SexpString(ps *PrintState) string
func (*SexpChar) Type ¶
func (r *SexpChar) Type() *RegisteredType
type SexpClosureEnv ¶ added in v1.5.1
type SexpClosureEnv Scope
func (*SexpClosureEnv) SexpString ¶ added in v1.5.1
func (c *SexpClosureEnv) SexpString(ps *PrintState) string
func (*SexpClosureEnv) Type ¶
func (r *SexpClosureEnv) Type() *RegisteredType
type SexpComma ¶
type SexpComma struct{}
func (*SexpComma) SexpString ¶
func (s *SexpComma) SexpString(ps *PrintState) string
func (*SexpComma) Type ¶
func (r *SexpComma) Type() *RegisteredType
type SexpComment ¶
func (*SexpComment) SexpString ¶
func (p *SexpComment) SexpString(ps *PrintState) string
func (*SexpComment) Type ¶
func (p *SexpComment) Type() *RegisteredType
type SexpError ¶ added in v1.4.7
type SexpError struct {
// contains filtered or unexported fields
}
func (*SexpError) SexpString ¶ added in v1.4.7
func (e *SexpError) SexpString(ps *PrintState) string
func (*SexpError) Type ¶
func (r *SexpError) Type() *RegisteredType
type SexpField ¶
type SexpField SexpHash
func (*SexpField) AlignString ¶
func (*SexpField) FieldWidths ¶
compute key and value widths to assist alignment
func (*SexpField) SexpString ¶
func (f *SexpField) SexpString(ps *PrintState) string
func (SexpField) Type ¶
func (r SexpField) Type() *RegisteredType
type SexpFloat ¶
type SexpFloat struct { Val float64 Typ *RegisteredType }
func (*SexpFloat) SexpString ¶
func (f *SexpFloat) SexpString(ps *PrintState) string
func (*SexpFloat) Type ¶
func (r *SexpFloat) Type() *RegisteredType
type SexpFunction ¶
type SexpFunction struct {
// contains filtered or unexported fields
}
SexpFunction
func MakeBuilderFunction ¶
func MakeBuilderFunction(name string, ufun GlispUserFunction) *SexpFunction
func MakeUserFunction ¶
func MakeUserFunction(name string, ufun GlispUserFunction) *SexpFunction
func (*SexpFunction) ClosingLookupSymbol ¶ added in v1.5.1
func (sf *SexpFunction) ClosingLookupSymbol(sym *SexpSymbol, setVal *Sexp) (Sexp, error, *Scope)
func (*SexpFunction) ClosingLookupSymbolUntilFunction ¶ added in v1.5.1
func (sf *SexpFunction) ClosingLookupSymbolUntilFunction(sym *SexpSymbol) (Sexp, error, *Scope)
func (*SexpFunction) Copy ¶ added in v1.5.1
func (sf *SexpFunction) Copy() *SexpFunction
func (*SexpFunction) SetClosing ¶ added in v1.5.1
func (sf *SexpFunction) SetClosing(clos *Closing)
func (*SexpFunction) SexpString ¶
func (sf *SexpFunction) SexpString(ps *PrintState) string
func (*SexpFunction) ShowClosing ¶ added in v1.5.1
func (sf *SexpFunction) ShowClosing(env *Glisp, ps *PrintState, label string) (string, error)
func (*SexpFunction) Type ¶
func (sf *SexpFunction) Type() *RegisteredType
type SexpGoroutine ¶
type SexpGoroutine struct {
// contains filtered or unexported fields
}
func (*SexpGoroutine) SexpString ¶
func (goro *SexpGoroutine) SexpString(ps *PrintState) string
func (*SexpGoroutine) Type ¶
func (goro *SexpGoroutine) Type() *RegisteredType
type SexpHash ¶
type SexpHash struct { TypeName string Map map[int][]*SexpPair KeyOrder []Sexp GoStructFactory *RegisteredType NumKeys int GoMethods []reflect.Method GoFields []reflect.StructField GoMethSx SexpArray GoFieldSx SexpArray GoType reflect.Type NumMethod int GoShadowStruct interface{} GoShadowStructVa reflect.Value // json tag name -> pointers to example values, as factories for SexpToGoStructs() JsonTagMap map[string]*HashFieldDet DetOrder []*HashFieldDet // for using these as a scoping model DefnEnv *SexpHash SuperClass *SexpHash ZMain SexpFunction ZMethods map[string]*SexpFunction // contains filtered or unexported fields }
func GetFuncArgArray ¶
func (*SexpHash) BindSymbol ¶ added in v1.5.1
func (h *SexpHash) BindSymbol(key *SexpSymbol, val Sexp) error
func (*SexpHash) CloneFrom ¶
CloneFrom copys all the internals of src into p, effectively blanking out whatever p held and replacing it with a copy of src.
func (*SexpHash) DotPathHashGet ¶
func (h *SexpHash) DotPathHashGet(env *Glisp, sym *SexpSymbol) (Sexp, error)
func (*SexpHash) FillHashFromShadow ¶ added in v1.4.7
func (*SexpHash) HashDelete ¶
func (*SexpHash) HashGetDefault ¶
func (*SexpHash) NewSexpHashSelector ¶
func (h *SexpHash) NewSexpHashSelector(sym *SexpSymbol) *SexpHashSelector
func (*SexpHash) RunZmethod ¶ added in v1.5.1
func (*SexpHash) SetDefnEnv ¶ added in v1.5.1
func (*SexpHash) SetGoStructFactory ¶ added in v1.3.1
func (h *SexpHash) SetGoStructFactory(factory *RegisteredType)
func (*SexpHash) SetMain ¶ added in v1.5.1
func (h *SexpHash) SetMain(p *SexpFunction)
func (*SexpHash) SetMethodList ¶ added in v1.3.1
func (*SexpHash) SexpString ¶
func (hash *SexpHash) SexpString(ps *PrintState) string
func (*SexpHash) Type ¶
func (r *SexpHash) Type() *RegisteredType
type SexpHashSelector ¶
SexpHashSelector: reference to a symbol in a hash table.
func (*SexpHashSelector) AssignToSelection ¶
func (x *SexpHashSelector) AssignToSelection(env *Glisp, rhs Sexp) error
func (*SexpHashSelector) RHS ¶
func (x *SexpHashSelector) RHS(env *Glisp) (sx Sexp, err error)
RHS applies the selector to the contain and returns the value obtained.
func (*SexpHashSelector) SexpString ¶
func (si *SexpHashSelector) SexpString(ps *PrintState) string
func (*SexpHashSelector) Type ¶
func (si *SexpHashSelector) Type() *RegisteredType
Type returns the type of the value.
type SexpInt ¶
type SexpInt struct { Val int64 Typ *RegisteredType }
func (*SexpInt) SexpString ¶
func (i *SexpInt) SexpString(ps *PrintState) string
func (*SexpInt) Type ¶
func (r *SexpInt) Type() *RegisteredType
type SexpInterfaceDecl ¶
type SexpInterfaceDecl struct {
// contains filtered or unexported fields
}
SexpInterfaceDecl
func (*SexpInterfaceDecl) SexpString ¶
func (r *SexpInterfaceDecl) SexpString(ps *PrintState) string
func (*SexpInterfaceDecl) Type ¶
func (r *SexpInterfaceDecl) Type() *RegisteredType
type SexpPair ¶
func (*SexpPair) SexpString ¶
func (pair *SexpPair) SexpString(ps *PrintState) string
func (*SexpPair) Type ¶
func (r *SexpPair) Type() *RegisteredType
type SexpPointer ¶
type SexpPointer struct { ReflectTarget reflect.Value Target Sexp PointedToType *RegisteredType MyType *RegisteredType }
func NewSexpPointer ¶
func NewSexpPointer(pointedTo Sexp) *SexpPointer
func (*SexpPointer) SexpString ¶
func (p *SexpPointer) SexpString(ps *PrintState) string
func (*SexpPointer) Type ¶
func (p *SexpPointer) Type() *RegisteredType
type SexpRaw ¶
type SexpRaw struct { Val []byte Typ *RegisteredType }
func (*SexpRaw) SexpString ¶
func (r *SexpRaw) SexpString(ps *PrintState) string
func (*SexpRaw) Type ¶
func (r *SexpRaw) Type() *RegisteredType
type SexpReflect ¶ added in v1.4.7
func (*SexpReflect) SexpString ¶ added in v1.4.7
func (r *SexpReflect) SexpString(ps *PrintState) string
func (*SexpReflect) Type ¶
func (r *SexpReflect) Type() *RegisteredType
type SexpRegexp ¶
func (*SexpRegexp) SexpString ¶
func (re *SexpRegexp) SexpString(ps *PrintState) string
func (*SexpRegexp) Type ¶
func (r *SexpRegexp) Type() *RegisteredType
type SexpSemicolon ¶
type SexpSemicolon struct{}
func (*SexpSemicolon) SexpString ¶
func (s *SexpSemicolon) SexpString(ps *PrintState) string
func (*SexpSemicolon) Type ¶
func (r *SexpSemicolon) Type() *RegisteredType
type SexpSentinel ¶
type SexpSentinel struct {
Val int
}
func (*SexpSentinel) SexpString ¶
func (sent *SexpSentinel) SexpString(ps *PrintState) string
func (*SexpSentinel) Type ¶
func (r *SexpSentinel) Type() *RegisteredType
type SexpStackmark ¶
type SexpStackmark struct {
// contains filtered or unexported fields
}
func (*SexpStackmark) SexpString ¶
func (mark *SexpStackmark) SexpString(ps *PrintState) string
func (*SexpStackmark) Type ¶
func (r *SexpStackmark) Type() *RegisteredType
type SexpStr ¶
type SexpStr struct { S string Typ *RegisteredType // contains filtered or unexported fields }
func (*SexpStr) SexpString ¶
func (s *SexpStr) SexpString(ps *PrintState) string
func (SexpStr) Type ¶
func (r SexpStr) Type() *RegisteredType
type SexpSymbol ¶
type SexpSymbol struct {
// contains filtered or unexported fields
}
func (*SexpSymbol) AssignToSelection ¶
func (sym *SexpSymbol) AssignToSelection(env *Glisp, rhs Sexp) error
func (SexpSymbol) Name ¶
func (sym SexpSymbol) Name() string
func (SexpSymbol) Number ¶
func (sym SexpSymbol) Number() int
func (*SexpSymbol) SexpString ¶
func (sym *SexpSymbol) SexpString(ps *PrintState) string
func (*SexpSymbol) Type ¶
func (r *SexpSymbol) Type() *RegisteredType
type SexpTime ¶
func (*SexpTime) SexpString ¶
func (t *SexpTime) SexpString(ps *PrintState) string
func (*SexpTime) Type ¶
func (r *SexpTime) Type() *RegisteredType
type SexpUserVarDefn ¶
type SexpUserVarDefn struct {
Name string
}
type ShortNamer ¶
type ShortNamer interface {
ShortName() string
}
type Showable ¶ added in v1.4.1
type Showable interface {
Show(env *Glisp, ps *PrintState, label string) (string, error)
}
type Snoopy ¶ added in v1.3.1
type Snoopy struct { Plane `json:"plane" msg:"plane"` Cry string `json:"cry" msg:"cry"` Pack []int `json:"pack"` Carrying []Flyer `json:"carrying"` }
func (*Snoopy) EchoWeather ¶ added in v1.4.7
func (*Snoopy) Sideeffect ¶ added in v1.3.1
func (p *Snoopy) Sideeffect()
type SquashInstr ¶
type SquashInstr int
func (SquashInstr) Execute ¶
func (s SquashInstr) Execute(env *Glisp) error
func (SquashInstr) InstrString ¶
func (s SquashInstr) InstrString() string
type Stack ¶
type Stack struct { Name string // type name // package support: PackageName string IsPackage bool // contains filtered or unexported fields }
func (*Stack) BindSymbol ¶
func (stack *Stack) BindSymbol(sym *SexpSymbol, expr Sexp) error
func (*Stack) DeleteSymbolFromTopOfStackScope ¶
func (stack *Stack) DeleteSymbolFromTopOfStackScope(sym *SexpSymbol) error
func (*Stack) IsStackElem ¶
func (stack *Stack) IsStackElem()
func (*Stack) LookupSymbol ¶
func (*Stack) LookupSymbolNonGlobal ¶
func (stack *Stack) LookupSymbolNonGlobal(sym *SexpSymbol) (Sexp, error, *Scope)
LookupSymbolNonGlobal - closures use this to only find symbols below the global scope, to avoid copying globals it'll always be-able to ref
func (*Stack) LookupSymbolUntilFunction ¶ added in v1.5.1
lookup symbols, but don't go beyond a function boundary -- a user-defined function boundary that is. We certainly have to go up beyond all built-in operators like '+' and '-', '*' and '/'.
func (*Stack) PrintScopeStack ¶ added in v1.5.1
func (stack *Stack) PrintScopeStack()
func (*Stack) PrintStack ¶
func (stack *Stack) PrintStack()
func (*Stack) PushAddr ¶
func (stack *Stack) PushAddr(function *SexpFunction, pc int)
func (*Stack) PushExpressions ¶
func (*Stack) SexpString ¶
func (s *Stack) SexpString(ps *PrintState) string
func (*Stack) TruncateToSize ¶ added in v1.5.1
set newsize to 0 to truncate everything
func (*Stack) Type ¶
func (s *Stack) Type() *RegisteredType
Type() satisfies the Sexp interface, returning the type of the value.
type SymtabSorter ¶ added in v1.3.1
type SymtabSorter []*SymtabE
func (SymtabSorter) Len ¶ added in v1.3.1
func (a SymtabSorter) Len() int
func (SymtabSorter) Less ¶ added in v1.3.1
func (a SymtabSorter) Less(i, j int) bool
func (SymtabSorter) Swap ¶ added in v1.3.1
func (a SymtabSorter) Swap(i, j int)
type TokenType ¶
type TokenType int
const ( TokenTypeEmpty TokenType = iota TokenLParen TokenRParen TokenLSquare TokenRSquare TokenLCurly TokenRCurly TokenDot TokenQuote TokenBacktick TokenTilde TokenTildeAt TokenSymbol TokenBool TokenDecimal TokenHex TokenOct TokenBinary TokenFloat TokenChar TokenString TokenCaret TokenColonOperator TokenThreadingOperator TokenBackslash TokenDollar TokenDotSymbol TokenFreshAssign TokenBacktickString TokenComment TokenBeginBlockComment TokenEndBlockComment TokenSemicolon TokenSymbolColon TokenComma TokenEnd )
type UpdateInstr ¶
type UpdateInstr struct {
// contains filtered or unexported fields
}
Update takes top of datastack and assigns it to sym when sym is found already in the current scope or up the stack. Used to implement (set v 10) when v is not in the local scope.
func (UpdateInstr) Execute ¶
func (p UpdateInstr) Execute(env *Glisp) error
func (UpdateInstr) InstrString ¶
func (p UpdateInstr) InstrString() string
type VectorizeInstr ¶
type VectorizeInstr int
func (VectorizeInstr) Execute ¶
func (s VectorizeInstr) Execute(env *Glisp) error
func (VectorizeInstr) InstrString ¶
func (s VectorizeInstr) InstrString() string
type Weather ¶ added in v1.3.1
type Weather struct { Time time.Time `json:"time" msg:"time"` Size int64 `json:"size" msg:"size"` Type string `json:"type" msg:"type"` Details []byte `json:"details" msg:"details"` }
func (*Weather) MarshalMsg ¶ added in v1.3.5
MarshalMsg implements msgp.Marshaler
Source Files ¶
- address.go
- arrayutils.go
- basetypes.go
- blake2.go
- builders.go
- callgo.go
- cfg.go
- channels.go
- check.go
- closing.go
- comment.go
- comparisons.go
- coroutines.go
- datastack.go
- demo_go_structs.go
- demo_go_structs_gen.go
- depend.go
- doc.go
- environment.go
- exists.go
- expressions.go
- func.go
- functions.go
- generator.go
- gitcommit.go
- gob.go
- gotypereg.go
- hashutils.go
- import.go
- jsonmsgp.go
- lexer.go
- liner.go
- listutils.go
- makego.go
- msgpackmap.go
- numerictower.go
- panicon.go
- parser.go
- pratt.go
- printstate.go
- ptrcheck.go
- random.go
- rawutils.go
- regexp.go
- repl.go
- scopes.go
- slurp.go
- source.go
- stack.go
- strutils.go
- system.go
- time.go
- typeutils.go
- version.go
- vm.go
- vprint.go