Documentation ¶
Overview ¶
The parser package takes a sequence of tokens and transforms it into a representation graph (and optionally into native data structures). This corresponds to the composing and constructing stages in the YAML 1.2 specification.
Index ¶
Constants ¶
const DefaultPrefix = "tag:yaml.org,2002:"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Constructor ¶
type Constructor interface {
Construct(node Node, userData interface{}) (data interface{}, err error)
}
A Constructor converts a Node into a Go data structure.
type Empty ¶
type Empty struct {
// contains filtered or unexported fields
}
An Empty indicates a lack of a value.
type KeyValuePair ¶
type KeyValuePair struct {
Key, Value Node
}
A KeyValuePair stores a single pair in a mapping.
type Mapping ¶
type Mapping struct { Pairs []KeyValuePair // contains filtered or unexported fields }
Mapping stores a key-value mapping of nodes.
type Node ¶
type Node interface { Start() token.Position Tag() string Data() interface{} // contains filtered or unexported methods }
Node defines a node of the representation graph.
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
A Parser transforms a YAML stream into data structures.
func New ¶
func New(r io.Reader, s Schema, c Constructor, userData interface{}) *Parser
New creates a new parser that reads from the given reader.
func NewWithScanner ¶
func NewWithScanner(scan *scanner.Scanner, schema Schema, con Constructor, userData interface{}) (p *Parser)
NewWithScanner creates a new parser that reads from an existing scanner.
func (*Parser) ParseDocument ¶
ParseDocument returns the next document in the stream.
type Scalar ¶
type Scalar struct { Value string // contains filtered or unexported fields }
Scalar stores a text value.
type Sequence ¶
type Sequence struct { Nodes []Node // contains filtered or unexported fields }
Sequence stores an ordered collection of nodes.