parse

package
v0.0.0-...-215933a Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2016 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("key does not exist")

ErrNotFound is returned from Get and friends when the key does not exist

Functions

This section is empty.

Types

type Node

type Node struct {
	*ast.ObjectItem
	// contains filtered or unexported fields
}

Node represents a node in the parsed module

func NewNode

func NewNode(item *ast.ObjectItem) *Node

NewNode constructs a new Node from the given ObjectItem

func Parse

func Parse(content []byte) (resources []*Node, err error)

Parse content into a bunch of nodes

func (*Node) Get

func (n *Node) Get(key string) (val interface{}, err error)

Get a value from the values

func (*Node) GetString

func (n *Node) GetString(key string) (val string, err error)

GetString retrieves string value from the values

func (*Node) GetStringSlice

func (n *Node) GetStringSlice(key string) (val []string, err error)

GetStringSlice retrieves a slice of string from the values

func (*Node) GetStrings

func (n *Node) GetStrings() (vals []string, err error)

GetStrings retrieves all the strings in the node

func (*Node) IsModule

func (n *Node) IsModule() bool

IsModule tests whether this node is a module call

func (*Node) Kind

func (n *Node) Kind() string

Kind returns the kind of resource this is

func (*Node) Name

func (n *Node) Name() string

Name returns the name of the resource

func (*Node) Source

func (n *Node) Source() string

Source returns where a module call is to be loaded from

func (*Node) String

func (n *Node) String() string

func (*Node) Validate

func (n *Node) Validate() error

Validate this node

Jump to

Keyboard shortcuts

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