Documentation ¶
Overview ¶
Package parse builds parse trees for configurations as defined by conf. Clients should use that package to construct configurations rather than this one, which provides shared internal data structures not intended for general use.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Node ¶
type Node interface { Type() NodeType String() string Position() Pos // byte position of start of node in full original input string // contains filtered or unexported methods }
A Node is an element in the parse tree. The interface is trivial. The interface contains an unexported method so that only types local to this package can satisfy it.
type PairNode ¶
type PairNode struct { NodeType Pos Key, Val *StringNode }
PairNode holds a key=value pair.
type Pos ¶
type Pos int
Pos represents a byte position in the original input text from which this template was parsed.
type SectionNode ¶
type SectionNode struct { NodeType Pos RawText string SectionType *StringNode Name *StringNode Nodes *ListNode }
SectionNode holds a section name and children
func (*SectionNode) String ¶
func (s *SectionNode) String() string
type StringNode ¶
type StringNode struct { NodeType Pos Quoted string // The original text of the string, with possible quotes. Text string // The string, after quote processing. }
StringNode holds a string constant. The value has been "unquoted".
func (*StringNode) String ¶
func (s *StringNode) String() string
type Tree ¶
type Tree struct { Name string // name of the template represented by the tree. Root *ListNode // top-level root of the tree. // contains filtered or unexported fields }
Tree is the representation of a single parsed configuration.
func Parse ¶
Parse returns a Tree, created by parsing the configuration described in the argument string. If an error is encountered, parsing stops and an empty Tree is returned with the error.
func (*Tree) ErrorContext ¶
ErrorContext returns a textual representation of the location of the node in the input text.