Documentation
¶
Index ¶
- Constants
- func Builtins(s *Serializer) []*libutil.Builtin
- func Dump(v *lisp.LVal, stringNums bool) ([]byte, error)
- func Load(b []byte, stringNums bool) *lisp.LVal
- func LoadPackage(env *lisp.LEnv) *lisp.LVal
- type Serializer
- func (s *Serializer) Dump(v *lisp.LVal, stringNums bool) ([]byte, error)
- func (s *Serializer) DumpBytesBuiltin(env *lisp.LEnv, args *lisp.LVal) *lisp.LVal
- func (s *Serializer) DumpMessageBuiltin(env *lisp.LEnv, args *lisp.LVal) *lisp.LVal
- func (s *Serializer) DumpStringBuiltin(env *lisp.LEnv, args *lisp.LVal) *lisp.LVal
- func (s *Serializer) GoError(v *lisp.LVal) error
- func (s *Serializer) GoFloat64(v *lisp.LVal) (float64, bool)
- func (s *Serializer) GoInt(v *lisp.LVal) (int, bool)
- func (s *Serializer) GoMap(v *lisp.LVal, stringNums bool) (SortedMap, bool)
- func (s *Serializer) GoSlice(v *lisp.LVal, stringNums bool) ([]interface{}, bool)
- func (s *Serializer) GoString(v *lisp.LVal) (string, bool)
- func (s *Serializer) GoValue(v *lisp.LVal, stringNums bool) interface{}
- func (s *Serializer) Load(b []byte, stringNums bool) *lisp.LVal
- func (s *Serializer) LoadBytesBuiltin(env *lisp.LEnv, args *lisp.LVal) *lisp.LVal
- func (s *Serializer) LoadMessageBuiltin(env *lisp.LEnv, args *lisp.LVal) *lisp.LVal
- func (s *Serializer) LoadStringBuiltin(env *lisp.LEnv, args *lisp.LVal) *lisp.LVal
- func (s *Serializer) MessageBytesBuiltin(env *lisp.LEnv, args *lisp.LVal) *lisp.LVal
- func (s *Serializer) SymbolName(v *lisp.LVal) (string, bool)
- func (s *Serializer) UseStringNumbersBuiltin(env *lisp.LEnv, args *lisp.LVal) *lisp.LVal
- type SortedMap
Constants ¶
const DefaultPackageName = "json"
DeafultPackageName is the package name used by LoadPackage.
Variables ¶
This section is empty.
Functions ¶
func Builtins ¶
func Builtins(s *Serializer) []*libutil.Builtin
Builtins takes the default serializer for a lisp environment and returns a set of package builtin functions that use it.
Types ¶
type Serializer ¶
Serializer defines JSON serialization rules for lisp values.
func DefaultSerializer ¶
func DefaultSerializer() *Serializer
func (*Serializer) DumpBytesBuiltin ¶
func (*Serializer) DumpMessageBuiltin ¶
func (*Serializer) DumpStringBuiltin ¶
func (*Serializer) GoError ¶
func (s *Serializer) GoError(v *lisp.LVal) error
GoError returns an error that represents v. If v is not LError then nil is returned.
func (*Serializer) GoFloat64 ¶
func (s *Serializer) GoFloat64(v *lisp.LVal) (float64, bool)
GoFloat64 converts the numeric value that v represents to a float64 and returns it with the value true. If v does not represent a number GoFloat64 returns a false second argument
func (*Serializer) GoInt ¶
func (s *Serializer) GoInt(v *lisp.LVal) (int, bool)
GoInt converts the numeric value that v represents to and int and returns it with the value true. If v does not represent a number GoInt returns a false second argument
func (*Serializer) GoMap ¶
GoMap converts an LSortMap to its Go equivalent and returns it with a true second argument. If v does not represent a map json serializable map GoMap returns a false second argument
func (*Serializer) GoSlice ¶
func (s *Serializer) GoSlice(v *lisp.LVal, stringNums bool) ([]interface{}, bool)
GoSlice returns the string that v represents and the value true. If v does not represent a string GoSlice returns a false second argument
func (*Serializer) GoString ¶
func (s *Serializer) GoString(v *lisp.LVal) (string, bool)
GoString returns the string that v represents and the value true. If v does not represent a string GoString returns a false second argument
func (*Serializer) GoValue ¶
func (s *Serializer) GoValue(v *lisp.LVal, stringNums bool) interface{}
GoValue converts v to its natural representation in Go. Quotes are ignored and all lists are turned into slices. Symbols are converted to strings. The value Nil() is converted to nil. Functions are returned as is.
func (*Serializer) Load ¶
func (s *Serializer) Load(b []byte, stringNums bool) *lisp.LVal
Load parses b and returns an LVal representing its structure.
func (*Serializer) LoadBytesBuiltin ¶
func (*Serializer) LoadMessageBuiltin ¶
func (*Serializer) LoadStringBuiltin ¶
func (*Serializer) MessageBytesBuiltin ¶
func (*Serializer) SymbolName ¶
func (s *Serializer) SymbolName(v *lisp.LVal) (string, bool)
SymbolName returns the name of the symbol that v represents and the value true. If v does not represent a symbol SymbolName returns a false second argument