reader

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2024 License: EPL-1.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrEOF is returned when the end of the input is reached after
	// all input has been read. Callers can check for this error to
	// determine if an error is due to malformed input or exhausted
	// input.
	ErrEOF = errors.New("EOF")
)

Functions

This section is empty.

Types

type Error

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

func (*Error) Error

func (e *Error) Error() string

func (*Error) Unwrap

func (e *Error) Unwrap() error

type Option

type Option func(*options)

Option represents an option that can be passed to New.

func WithFilename

func WithFilename(filename string) Option

WithFilename sets the filename to be associated with the input.

func WithGetCurrentNS

func WithGetCurrentNS(getCurrentNS func() *value.Namespace) Option

WithGetCurrentNS sets the function to be used to get the current namespace.

func WithSymbolResolver

func WithSymbolResolver(resolver SymbolResolver) Option

WithSymbolResolver sets the symbol resolver to be used when reading.

type Reader

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

func New

func New(r io.RuneScanner, opts ...Option) *Reader

func (*Reader) ReadAll

func (r *Reader) ReadAll() ([]interface{}, error)

Read reads all expressions from the input until a read error occurs or io.EOF is reached. A final io.EOF will not be returned if the input ends with a valid expression or if it contains no expressions at all.

func (*Reader) ReadOne

func (r *Reader) ReadOne() (interface{}, error)

ReadOne reads the next expression from the input. If the input contains more than one expression, subsequent calls to ReadOne will return the next expression. If the input contains no expressions, ErrEOF will be returned.

type SymbolResolver

type SymbolResolver interface {
	CurrentNS() *value.Symbol
	ResolveStruct(*value.Symbol) *value.Symbol
	ResolveAlias(*value.Symbol) *value.Symbol
	ResolveVar(*value.Symbol) *value.Symbol
}

Jump to

Keyboard shortcuts

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