Documentation ¶
Index ¶
- func Parse(r io.Reader, filename string, dp DirectiveProcessor, out interface{}) (o interface{}, e error)
- func ParseFile(filename string, dp DirectiveProcessor, out interface{}) (interface{}, error)
- type ASTNode
- func (a ASTNode) Evaluate(object interface{}, processor DirectiveProcessor)
- func (a ASTNode) Float() float64
- func (a ASTNode) ForEach(f func(i int, v ASTNode))
- func (a ASTNode) Index(n int) ASTNode
- func (a ASTNode) Int() int
- func (a ASTNode) IsArr() bool
- func (a ASTNode) IsBracket() bool
- func (a ASTNode) IsDir() bool
- func (a ASTNode) IsValue() bool
- func (a ASTNode) Len() int
- func (a ASTNode) Position() scanner.Position
- func (a ASTNode) Text() string
- type ConfErr
- type Directive
- type DirectiveProcessor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Parse ¶
func Parse(r io.Reader, filename string, dp DirectiveProcessor, out interface{}) (o interface{}, e error)
Parse parses a config from a reader using the given DirectiveProcessor for the root node into out Out is returned for convenience
func ParseFile ¶
func ParseFile(filename string, dp DirectiveProcessor, out interface{}) (interface{}, error)
ParseFile parses a config file - like Parse but opens and reads from a file
Types ¶
type ASTNode ¶
type ASTNode struct {
// contains filtered or unexported fields
}
ASTNode is an AST node
func ParseFileAST ¶
ParseFileAST parses AST from a config at the given file path
func (ASTNode) Evaluate ¶
func (a ASTNode) Evaluate(object interface{}, processor DirectiveProcessor)
Evaluate evaluates the directive or bracket into the provided object using the specified DirectiveProcessor
func (ASTNode) Index ¶
Index returns the value in the array at index n If used on a bracketed value, it will return the n'th directive
func (ASTNode) Len ¶
Len returns the number of elements in the array If used on a bracketed value, it will return the number of directives
type DirectiveProcessor ¶
type DirectiveProcessor struct {
// contains filtered or unexported fields
}
DirectiveProcessor is a utility object used to execute directives
func NewDirectiveProcessor ¶
func NewDirectiveProcessor(ds ...Directive) (dp DirectiveProcessor)
NewDirectiveProcessor creates a DirectiveProcessor using the specified set of directives