package
0.0.0-20191002203319-fb75b3253c80
Repository: https://github.com/hashicorp/hcl2.git
Documentation: pkg.go.dev
# Functions
LexConfig performs lexical analysis on the given buffer, treating it as a whole HCL config file, and returns the resulting tokens.
LexExpression performs lexical analysis on the given buffer, treating it as a standalone HCL expression, and returns the resulting tokens.
LexTemplate performs lexical analysis on the given buffer, treating it as a standalone HCL template, and returns the resulting tokens.
ParseConfig parses the given buffer as a whole HCL config file, returning a *hcl.File representing its contents.
ParseExpression parses the given buffer as a standalone HCL expression, returning it as an instance of Expression.
ParseTemplate parses the given buffer as a standalone HCL template, returning it as an instance of Expression.
ParseTraversalAbs parses the given buffer as a standalone absolute traversal.
ValidIdentifier tests if the given string could be a valid identifier in a native syntax expression.
Variables returns all of the variables referenced within a given experssion.
VisitAll is a basic way to traverse the AST beginning with a particular node.
Walk is a more complex way to traverse the AST starting with a particular node, which provides information about the tree structure via separate Enter and Exit functions.
# Constants
TokenNil is a placeholder for when a token is required but none is available, e.g.
might contain backslash escapes.
cannot contain backslash escapes.
# Structs
AnonSymbolExpr is used as a placeholder for a value in an expression that can be applied dynamically to any value at runtime.
Attribute represents a single attribute definition within a body.
Block represents a nested block structure.
Body is the implementation of hcl.Body for the HCL native syntax.
ChildScope is a synthetic AST node that is visited during a walk to indicate that its descendent will be evaluated in a child scope, which may mask certain variables from the parent scope as locals.
File is the top-level object resulting from parsing a configuration file.
ForExpr represents iteration constructs:
tuple = [for i, v in list: upper(v) if i > 2] object = {for k, v in map: k => upper(v)} object_of_tuples = {for v in list: v.key: v...}.
FunctionCallExpr is an Expression that calls a function from the EvalContext and returns its result.
LiteralValueExpr is an expression that just always returns a given value.
ObjectConsKeyExpr is a special wrapper used only for ObjectConsExpr keys, which deals with the special case that a naked identifier in that position must be interpreted as a literal string rather than evaluated directly.
RelativeTraversalExpr is an Expression that retrieves a value from another value using a _relative_ traversal.
ScopeTraversalExpr is an Expression that retrieves a value from the scope using a traversal.
TemplateJoinExpr is used to convert tuples of strings produced by template constructs (i.e.
TemplateWrapExpr is used instead of a TemplateExpr when a template consists _only_ of a single interpolation sequence.
Token represents a sequence of bytes from some HCL code that has been tagged with a type and its range within the source file.
# Interfaces
Expression is the abstract type for nodes that behave as HCL expressions.
Node is the abstract type that every AST node implements.
Walker is an interface used with Walk.
# Type aliases
Attributes is the collection of attribute definitions within a body.
Blocks is the list of nested blocks within a body.
Tokens is a slice of Token.
TokenType is an enumeration used for the Type field on Token.
VisitFunc is the callback signature for VisitAll.