sexp

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2016 License: GPL-3.0, GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadBigNumEnd

func ReadBigNumEnd(r *bufio.Reader) bool

ReadBigNumEnd will expect the end character for an S-Expression bignum and return false if not encountered

func ReadBigNumStart

func ReadBigNumStart(r *bufio.Reader) bool

ReadBigNumStart will expect the start character for an S-Expression bignum and return false if not encountered

func ReadDataUntil

func ReadDataUntil(r *bufio.Reader, until func(byte) bool) []byte

ReadDataUntil will read and collect bytes from the reader until it encounters EOF or the given function returns true.

func ReadListEnd

func ReadListEnd(r *bufio.Reader) bool

ReadListEnd will expect the end character for an S-Expression list and return false if not encountered

func ReadListStart

func ReadListStart(r *bufio.Reader) bool

ReadListStart will expect the start character for an S-Expression list and return false if not encountered

func ReadStringEnd

func ReadStringEnd(r *bufio.Reader) bool

ReadStringEnd will read the string end character and return false if it is not encountered

func ReadStringStart

func ReadStringStart(r *bufio.Reader) bool

ReadStringStart will read the string start character and return false if it is not encountered

func ReadWhitespace

func ReadWhitespace(r *bufio.Reader)

ReadWhitespace will read from the reader until no whitespace is encountered

Types

type BigNum

type BigNum struct {
	// contains filtered or unexported fields
}

BigNum is an S-Expression big number

func NewBigNum

func NewBigNum(s string) BigNum

NewBigNum creates a new BigNum from the hex formatted string given

func (BigNum) First

func (s BigNum) First() Value

First will cause an error when called on a BigNum

func (BigNum) Second

func (s BigNum) Second() Value

Second will cause an error when called on a BigNum

func (BigNum) String

func (s BigNum) String() string

String returns the BigNum formatted for printing in an S-Expression

func (BigNum) Value

func (s BigNum) Value() interface{}

Value returns the *big.Int value inside of this BigNum

type Cons

type Cons struct {
	// contains filtered or unexported fields
}

Cons is an S-Expression cons cell

func (Cons) First

func (l Cons) First() Value

First returns the first value of the cons

func (Cons) Second

func (l Cons) Second() Value

Second returns the second value of the cons

func (Cons) String

func (l Cons) String() string

String returns the Cons formatted for printing in an S-Expression

func (Cons) Value

func (l Cons) Value() interface{}

Value returns the first value inside this Cons

type Snil

type Snil struct{}

Snil is a representation of nil in an S-Expression.

func (Snil) First

func (l Snil) First() Value

First will return the nil value.

func (Snil) Second

func (l Snil) Second() Value

Second will return the nil value.

func (Snil) String

func (l Snil) String() string

String will return an empty list as a representation of nil.

func (Snil) Value

func (l Snil) Value() interface{}

Value will return the Golang nil.

type Sstring

type Sstring string

Sstring represents an S-Expression symbol.

func (Sstring) First

func (s Sstring) First() Value

First will fail if called on an Sstring

func (Sstring) Second

func (s Sstring) Second() Value

Second will fail if called on an Sstring

func (Sstring) String

func (s Sstring) String() string

String returns the string quoted as a string in an S-Expression

func (Sstring) Value

func (s Sstring) Value() interface{}

Value returns the string as a string

type Symbol

type Symbol string

Symbol represents an S-Expression symbol.

func (Symbol) First

func (s Symbol) First() Value

First will fail if called on a symbol

func (Symbol) Second

func (s Symbol) Second() Value

Second will fail if called on a symbol

func (Symbol) String

func (s Symbol) String() string

String returns the symbol as a string

func (Symbol) Value

func (s Symbol) Value() interface{}

Value returns the symbol as a string

type Value

type Value interface {
	First() Value
	Second() Value
	Value() interface{}
	String() string
}

Value is an S-Expression value

func List

func List(values ...Value) Value

List creates a chain of Cons cells ended with a nil

func Read

func Read(r *bufio.Reader) Value

Read will read an S-Expression from the given reader

func ReadBigNum

func ReadBigNum(r *bufio.Reader) Value

ReadBigNum will read a bignum from the given reader and return it

func ReadList

func ReadList(r *bufio.Reader) Value

ReadList will read a list and return it

func ReadListItem

func ReadListItem(r *bufio.Reader) Value

ReadListItem recursively read a list item and the next potential item

func ReadString

func ReadString(r *bufio.Reader) Value

ReadString will read a string from the reader

func ReadSymbol

func ReadSymbol(r *bufio.Reader) Value

ReadSymbol will read a symbol from the reader

func ReadValue

func ReadValue(r *bufio.Reader) (Value, bool)

ReadValue will read and return an S-Expression value from the reader

Jump to

Keyboard shortcuts

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