parse

package
v0.0.0-...-02c76fb Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2020 License: Apache-2.0 Imports: 9 Imported by: 6

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) Group

func (n *Node) Group() string

Group returns the group that the node is a member of

func (*Node) ID

func (n *Node) ID() string

ID formats and returns the node ID as kind.name

func (*Node) IsCase

func (n *Node) IsCase() bool

IsCase tests whether this node is a case statement

func (*Node) IsDefault

func (n *Node) IsDefault() bool

IsDefault tests whether this node is a default case statement

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

String returns the node ID

func (*Node) Validate

func (n *Node) Validate() error

Validate this node

Directories

Path Synopsis
preprocessor

Jump to

Keyboard shortcuts

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