sexp

package module
v0.0.0-...-abe2944 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2023 License: MIT Imports: 8 Imported by: 0

README

sexp

Go module to parse and serialize S-Expressions

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotASCII                    = errors.New("only ASCII encoding supported")
	ErrParseUnacceptableWhitespace = errors.New("unacceptable whitespace char")
	ErrUnexpectedChar              = errors.New("unexpected character")
	ErrInvalidLengthPrefix         = errors.New("invalid length prefix")
	ErrInvalidTokenChar            = errors.New("invalid token character")
)
View Source
var FullParser = parser{/* contains filtered or unexported fields */}
View Source
var FullProducer = producer{/* contains filtered or unexported fields */}
View Source
var LimitedParser = parser{/* contains filtered or unexported fields */}
View Source
var LimitedProducer = producer{/* contains filtered or unexported fields */}

Functions

This section is empty.

Types

type Kind

type Kind int
const (
	KindList Kind = iota
	KindToken
	KindHexadecimal
	KindBase64
)

type LengthHint

type LengthHint struct {
	Has    bool
	Length uint64
}

type Node

type Node struct {
	Kind
	OctetString []byte
	List        []*Node
}

func MustBase64

func MustBase64(s []byte) (n *Node)

func MustHexadecimal

func MustHexadecimal(s []byte) (n *Node)

func MustList

func MustList(children ...*Node) (n *Node)

func MustToken

func MustToken(s string) (n *Node)

func Parse

func Parse(s io.RuneScanner) (n *Node, err error)

func (*Node) String

func (n *Node) String() string

type Parser

type Parser interface {
	ParseNode(s io.RuneScanner) (n *Node, err error)
	ParseList(s io.RuneScanner) (n *Node, err error)
	ParseToken(s io.RuneScanner) (n *Node, err error)
	ParseHexadecimal(s io.RuneScanner, h LengthHint) (n *Node, err error)
	ParseBase64(s io.RuneScanner, h LengthHint) (n *Node, err error)
}

type Producer

type Producer interface {
	Token(s string) (n *Node, err error)
	Hexadecimal(s []byte) (n *Node, err error)
	Base64(s []byte) (n *Node, err error)
	List(children ...*Node) (n *Node, err error)
}

Jump to

Keyboard shortcuts

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