parser

package
v1.2.31 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2024 License: AGPL-3.0 Imports: 7 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// DONE for undefined/success
	DONE = iota
	// ERROR from callback
	ERROR
	// EMPTY parameter
	EMPTY
	// VAR is a generic parameter
	VAR
	// VALUE denotes a parameter value
	VALUE
	// LIST denotes a parameter list
	LIST
)

Variables

This section is empty.

Functions

func Parser

func Parser(rdr *bufio.Reader, cb Callback) error

Parser reads data definitions from reader and pass parameters to callback.

Types

type Callback

type Callback func(mode int, param *Parameter) bool

Callback prototype

type Data

type Data struct {
	Parameter
	data.Vector
	// contains filtered or unexported fields
}

Data represents parsed data

func (*Data) Elem

func (d *Data) Elem(n int) *Data

Elem accesses the n.th sub-element of nested data structure.

func (*Data) GetPath

func (d *Data) GetPath() string

GetPath returns the access path for current object from root.

func (*Data) Lookup

func (d *Data) Lookup(path string) *Data

Lookup element in nested data structure by a path description. allows for automatic reference resolution (link processing)

func (*Data) Read

func (d *Data) Read(rdr *bufio.Reader) error

Read data definition from reader and re-built as internal data structure.

func (*Data) Write

func (d *Data) Write(wrt *bufio.Writer) error

Write data structure to stream writer.

type Parameter

type Parameter struct {
	Name  string // name of parameter
	Value string // value of parameter (encoded as string)
}

Parameter type declaration.

func (*Parameter) String

func (p *Parameter) String() string

String returns a human-readable parameter instance.

Jump to

Keyboard shortcuts

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