sexp

package
v0.0.0-...-d73c989 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2025 License: EUPL-1.2 Imports: 5 Imported by: 2

Documentation

Overview

Package sexp contains helper function to work with s-expression in an alien environment.

Index

Constants

This section is empty.

Variables

View Source
var ErrElementsMissing = errors.New("spec contains more data")

ErrElementsMissing is returned, if ParseList is called with a list smaller than the number of type specifications.

View Source
var ErrNoSpec = errors.New("no spec for elements")

ErrNoSpec is returned, if ParseList if called with a list greater than the number of type specifications.

Functions

func CheckSymbol

func CheckSymbol(obj sx.Object, name string) error

CheckSymbol ensures that the given object is a symbol with the given name.

func EncodeMetaRights

func EncodeMetaRights(mr api.MetaRights) *sx.Pair

EncodeMetaRights translates metadata/rights into a sx object.

func EncodeZettel

func EncodeZettel(zettel api.ZettelData) sx.Object

EncodeZettel transforms zettel data into a sx object.

func ParseList

func ParseList(obj sx.Object, spec string) (sx.Vector, error)

ParseList parses the given object as a proper list, based on a type specification.

'b' expects a boolean, 'i' an int64, 'o' any object, 'p' a pair, 's' a string, and 'y' expects a symbol. A 'r' as the last type spracification matches all remaining values, including a non existent object.

func ParseMeta

func ParseMeta(pair *sx.Pair) (api.ZettelMeta, error)

ParseMeta translates the given list to metadata.

func ParseRights

func ParseRights(obj sx.Object) (api.ZettelRights, error)

ParseRights returns the rights values of the given object.

func ParseZettel

func ParseZettel(obj sx.Object) (api.ZettelData, error)

ParseZettel parses an object to contain all needed data for a zettel.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳