hclsyntax
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Overview¶
Package hclsyntax contains the parser, AST, etc for HCL's native language,as opposed to the JSON variant.
In normal use applications should rarely depend on this package directly,instead preferring the higher-level interface of the main hcl package andits companion package hclparse.
Index¶
- Variables
- func ParseConfig(src []byte, filename string, start hcl.Pos) (*hcl.File, hcl.Diagnostics)
- func ParseTraversalAbs(src []byte, filename string, start hcl.Pos) (hcl.Traversal, hcl.Diagnostics)
- func ValidIdentifier(s string) bool
- func Variables(expr Expression) []hcl.Traversal
- func VisitAll(node Node, f VisitFunc) hcl.Diagnostics
- func Walk(node Node, w Walker) hcl.Diagnostics
- type AnonSymbolExpr
- type Attribute
- type Attributes
- type BinaryOpExpr
- type Block
- type Blocks
- type Body
- func (b *Body) AttributeAtPos(pos hcl.Pos) *hcl.Attribute
- func (b *Body) BlocksAtPos(pos hcl.Pos) []*hcl.Block
- func (b *Body) Content(schema *hcl.BodySchema) (*hcl.BodyContent, hcl.Diagnostics)
- func (b *Body) InnermostBlockAtPos(pos hcl.Pos) *hcl.Block
- func (b *Body) JustAttributes() (hcl.Attributes, hcl.Diagnostics)
- func (b *Body) MissingItemRange() hcl.Range
- func (b *Body) OutermostBlockAtPos(pos hcl.Pos) *hcl.Block
- func (b *Body) OutermostExprAtPos(pos hcl.Pos) hcl.Expression
- func (b *Body) PartialContent(schema *hcl.BodySchema) (*hcl.BodyContent, hcl.Body, hcl.Diagnostics)
- func (b *Body) Range() hcl.Range
- type ChildScope
- type ConditionalExpr
- type Expression
- type File
- type ForExpr
- type FunctionCallExpr
- type IndexExpr
- type Keyword
- type LiteralValueExpr
- type Node
- type ObjectConsExpr
- type ObjectConsItem
- type ObjectConsKeyExpr
- func (e *ObjectConsKeyExpr) AsTraversal() hcl.Traversal
- func (e *ObjectConsKeyExpr) Range() hcl.Range
- func (e *ObjectConsKeyExpr) StartRange() hcl.Range
- func (e *ObjectConsKeyExpr) UnwrapExpression() Expression
- func (e *ObjectConsKeyExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics)
- func (e *ObjectConsKeyExpr) Variables() []hcl.Traversal
- type Operation
- type RelativeTraversalExpr
- func (e *RelativeTraversalExpr) AsTraversal() hcl.Traversal
- func (e *RelativeTraversalExpr) Range() hcl.Range
- func (e *RelativeTraversalExpr) StartRange() hcl.Range
- func (e *RelativeTraversalExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics)
- func (e *RelativeTraversalExpr) Variables() []hcl.Traversal
- type ScopeTraversalExpr
- type SplatExpr
- type TemplateExpr
- type TemplateJoinExpr
- type TemplateWrapExpr
- type Token
- type TokenType
- type Tokens
- type TupleConsExpr
- type UnaryOpExpr
- type VisitFunc
- type Walker
Constants¶
This section is empty.
Variables¶
var (OpLogicalOr = &Operation{Impl:stdlib.OrFunc,Type:cty.Bool,}OpLogicalAnd = &Operation{Impl:stdlib.AndFunc,Type:cty.Bool,}OpLogicalNot = &Operation{Impl:stdlib.NotFunc,Type:cty.Bool,}OpEqual = &Operation{Impl:stdlib.EqualFunc,Type:cty.Bool,}OpNotEqual = &Operation{Impl:stdlib.NotEqualFunc,Type:cty.Bool,}OpGreaterThan = &Operation{Impl:stdlib.GreaterThanFunc,Type:cty.Bool,}OpGreaterThanOrEqual = &Operation{Impl:stdlib.GreaterThanOrEqualToFunc,Type:cty.Bool,}OpLessThan = &Operation{Impl:stdlib.LessThanFunc,Type:cty.Bool,}OpLessThanOrEqual = &Operation{Impl:stdlib.LessThanOrEqualToFunc,Type:cty.Bool,}OpAdd = &Operation{Impl:stdlib.AddFunc,Type:cty.Number,}OpSubtract = &Operation{Impl:stdlib.SubtractFunc,Type:cty.Number,}OpMultiply = &Operation{Impl:stdlib.MultiplyFunc,Type:cty.Number,}OpDivide = &Operation{Impl:stdlib.DivideFunc,Type:cty.Number,}OpModulo = &Operation{Impl:stdlib.ModuloFunc,Type:cty.Number,}OpNegate = &Operation{Impl:stdlib.NegateFunc,Type:cty.Number,})
Functions¶
funcParseConfig¶
ParseConfig parses the given buffer as a whole HCL config file, returninga *hcl.File representing its contents. If HasErrors called on the returneddiagnostics returns true, the returned body is likely to be incompleteand should therefore be used with care.
The body in the returned file has dynamic type *hclsyntax.Body, so callersmay freely type-assert this to get access to the full hclsyntax API insituations where detailed access is required. However, most common use-casesshould be served using the hcl.Body interface to ensure compatibility withother configurationg syntaxes, such as JSON.
funcParseTraversalAbs¶
ParseTraversalAbs parses the given buffer as a standalone absolute traversal.
Parsing as a traversal is more limited than parsing as an expession sinceit allows only attribute and indexing operations on variables. Traveralsare useful as a syntax for referring to objects without necessarilyevaluating them.
funcValidIdentifier¶
ValidIdentifier tests if the given string could be a valid identifier ina native syntax expression.
This is useful when accepting names from the user that will be used asvariable or attribute names in the scope, to ensure that any name chosenwill be traversable using the variable or attribute traversal syntax.
funcVariables¶
func Variables(exprExpression) []hcl.Traversal
Variables returns all of the variables referenced within a given experssion.
This is the implementation of the "Variables" method on every nativeexpression.
funcVisitAll¶
func VisitAll(nodeNode, fVisitFunc)hcl.Diagnostics
VisitAll is a basic way to traverse the AST beginning with a particularnode. The given function will be called once for each AST node indepth-first order, but no context is provided about the shape of the tree.
The VisitFunc may return diagnostics, in which case they will be accumulatedand returned as a single set.
Types¶
typeAnonSymbolExpr¶
AnonSymbolExpr is used as a placeholder for a value in an expression thatcan be applied dynamically to any value at runtime.
This is a rather odd, synthetic expression. It is used as part of therepresentation of splat expressions as a placeholder for the current itembeing visited in the splat evaluation.
AnonSymbolExpr cannot be evaluated in isolation. If its Value is calleddirectly then cty.DynamicVal will be returned. Instead, it is evaluatedin terms of another node (i.e. a splat expression) which temporarilyassigns it a value.
func (*AnonSymbolExpr)Range¶
func (e *AnonSymbolExpr) Range()hcl.Range
func (*AnonSymbolExpr)StartRange¶
func (e *AnonSymbolExpr) StartRange()hcl.Range
func (*AnonSymbolExpr)Value¶
func (e *AnonSymbolExpr) Value(ctx *hcl.EvalContext) (cty.Value,hcl.Diagnostics)
func (*AnonSymbolExpr)Variables¶
func (e *AnonSymbolExpr) Variables() []hcl.Traversal
typeAttribute¶
type Attribute struct {NamestringExprExpressionSrcRangehcl.RangeNameRangehcl.RangeEqualsRangehcl.Range}Attribute represents a single attribute definition within a body.
func (*Attribute)AsHCLAttribute¶
AsHCLAttribute returns the block data expressed as a *hcl.Attribute.
typeAttributes¶
Attributes is the collection of attribute definitions within a body.
func (Attributes)Range¶
func (aAttributes) Range()hcl.Range
Range returns the range of some arbitrary point within the set ofattributes, or an invalid range if there are no attributes.
This is provided only to complete the Node interface, but has no practicaluse.
typeBinaryOpExpr¶
type BinaryOpExpr struct {LHSExpressionOp *OperationRHSExpressionSrcRangehcl.Range}func (*BinaryOpExpr)Range¶
func (e *BinaryOpExpr) Range()hcl.Range
func (*BinaryOpExpr)StartRange¶
func (e *BinaryOpExpr) StartRange()hcl.Range
func (*BinaryOpExpr)Value¶
func (e *BinaryOpExpr) Value(ctx *hcl.EvalContext) (cty.Value,hcl.Diagnostics)
func (*BinaryOpExpr)Variables¶
func (e *BinaryOpExpr) Variables() []hcl.Traversal
typeBlock¶
type Block struct {TypestringLabels []stringBody *BodyTypeRangehcl.RangeLabelRanges []hcl.RangeOpenBraceRangehcl.RangeCloseBraceRangehcl.Range}Block represents a nested block structure
func (*Block)AsHCLBlock¶
AsHCLBlock returns the block data expressed as a *hcl.Block.
typeBody¶
type Body struct {AttributesAttributesBlocksBlocksSrcRangehcl.RangeEndRangehcl.Range// Final token of the body, for reporting missing items// contains filtered or unexported fields}Body is the implementation of hcl.Body for the HCL native syntax.
func (*Body)AttributeAtPos¶
AttributeAtPos implements the method of the same name for an *hcl.Filethat is backed by a *Body.
func (*Body)BlocksAtPos¶
BlocksAtPos implements the method of the same name for an *hcl.File thatis backed by a *Body.
func (*Body)Content¶
func (b *Body) Content(schema *hcl.BodySchema) (*hcl.BodyContent,hcl.Diagnostics)
func (*Body)InnermostBlockAtPos¶
InnermostBlockAtPos implements the method of the same name for an *hcl.Filethat is backed by a *Body.
func (*Body)JustAttributes¶
func (b *Body) JustAttributes() (hcl.Attributes,hcl.Diagnostics)
func (*Body)MissingItemRange¶
func (*Body)OutermostBlockAtPos¶
OutermostBlockAtPos implements the method of the same name for an *hcl.Filethat is backed by a *Body.
func (*Body)OutermostExprAtPos¶
func (b *Body) OutermostExprAtPos(poshcl.Pos)hcl.Expression
OutermostExprAtPos implements the method of the same name for an *hcl.Filethat is backed by a *Body.
func (*Body)PartialContent¶
func (b *Body) PartialContent(schema *hcl.BodySchema) (*hcl.BodyContent,hcl.Body,hcl.Diagnostics)
typeChildScope¶
type ChildScope struct {LocalNames map[string]struct{}ExprExpression}ChildScope is a synthetic AST node that is visited during a walk toindicate that its descendent will be evaluated in a child scope, whichmay mask certain variables from the parent scope as locals.
ChildScope nodes don't really exist in the AST, but are rather synthesizedon the fly during walk. Therefore it doesn't do any good to transform them;instead, transform either parent node that created a scope or the expressionthat the child scope struct wraps.
func (ChildScope)Range¶
func (eChildScope) Range()hcl.Range
Range returns the range of the expression that the ChildScope isencapsulating. It isn't really very useful to call Range on a ChildScope.
typeConditionalExpr¶
type ConditionalExpr struct {ConditionExpressionTrueResultExpressionFalseResultExpressionSrcRangehcl.Range}func (*ConditionalExpr)Range¶
func (e *ConditionalExpr) Range()hcl.Range
func (*ConditionalExpr)StartRange¶
func (e *ConditionalExpr) StartRange()hcl.Range
func (*ConditionalExpr)Value¶
func (e *ConditionalExpr) Value(ctx *hcl.EvalContext) (cty.Value,hcl.Diagnostics)
func (*ConditionalExpr)Variables¶
func (e *ConditionalExpr) Variables() []hcl.Traversal
typeExpression¶
type Expression interface {NodeValue(ctx *hcl.EvalContext) (cty.Value,hcl.Diagnostics)Variables() []hcl.TraversalStartRange()hcl.Range}Expression is the abstract type for nodes that behave as HCL expressions.
funcParseExpression¶
func ParseExpression(src []byte, filenamestring, starthcl.Pos) (Expression,hcl.Diagnostics)
ParseExpression parses the given buffer as a standalone HCL expression,returning it as an instance of Expression.
funcParseTemplate¶
func ParseTemplate(src []byte, filenamestring, starthcl.Pos) (Expression,hcl.Diagnostics)
ParseTemplate parses the given buffer as a standalone HCL template,returning it as an instance of Expression.
typeForExpr¶
type ForExpr struct {KeyVarstring// empty if ignoring the keyValVarstringCollExprExpressionKeyExprExpression// nil when producing a tupleValExprExpressionCondExprExpression// null if no "if" clause is presentGroupbool// set if the ellipsis is used on the value in an object forSrcRangehcl.RangeOpenRangehcl.RangeCloseRangehcl.Range}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...}func (*ForExpr)StartRange¶
func (*ForExpr)Value¶
func (e *ForExpr) Value(ctx *hcl.EvalContext) (cty.Value,hcl.Diagnostics)
typeFunctionCallExpr¶
type FunctionCallExpr struct {NamestringArgs []Expression// If true, the final argument should be a tuple, list or set which will// expand to be one argument per element.ExpandFinalboolNameRangehcl.RangeOpenParenRangehcl.RangeCloseParenRangehcl.Range}FunctionCallExpr is an Expression that calls a function from the EvalContextand returns its result.
func (*FunctionCallExpr)ExprCall¶
func (e *FunctionCallExpr) ExprCall() *hcl.StaticCall
Implementation for hcl.ExprCall.
func (*FunctionCallExpr)Range¶
func (e *FunctionCallExpr) Range()hcl.Range
func (*FunctionCallExpr)StartRange¶
func (e *FunctionCallExpr) StartRange()hcl.Range
func (*FunctionCallExpr)Value¶
func (e *FunctionCallExpr) Value(ctx *hcl.EvalContext) (cty.Value,hcl.Diagnostics)
func (*FunctionCallExpr)Variables¶
func (e *FunctionCallExpr) Variables() []hcl.Traversal
typeIndexExpr¶
type IndexExpr struct {CollectionExpressionKeyExpressionSrcRangehcl.RangeOpenRangehcl.Range}func (*IndexExpr)StartRange¶
func (*IndexExpr)Value¶
func (e *IndexExpr) Value(ctx *hcl.EvalContext) (cty.Value,hcl.Diagnostics)
typeLiteralValueExpr¶
LiteralValueExpr is an expression that just always returns a given value.
func (*LiteralValueExpr)AsTraversal¶
func (e *LiteralValueExpr) AsTraversal()hcl.Traversal
Implementation for hcl.AbsTraversalForExpr.
func (*LiteralValueExpr)Range¶
func (e *LiteralValueExpr) Range()hcl.Range
func (*LiteralValueExpr)StartRange¶
func (e *LiteralValueExpr) StartRange()hcl.Range
func (*LiteralValueExpr)Value¶
func (e *LiteralValueExpr) Value(ctx *hcl.EvalContext) (cty.Value,hcl.Diagnostics)
func (*LiteralValueExpr)Variables¶
func (e *LiteralValueExpr) Variables() []hcl.Traversal
typeNode¶
Node is the abstract type that every AST node implements.
This is a closed interface, so it cannot be implemented from outside ofthis package.
typeObjectConsExpr¶
type ObjectConsExpr struct {Items []ObjectConsItemSrcRangehcl.RangeOpenRangehcl.Range}func (*ObjectConsExpr)ExprMap¶
func (e *ObjectConsExpr) ExprMap() []hcl.KeyValuePair
Implementation for hcl.ExprMap
func (*ObjectConsExpr)Range¶
func (e *ObjectConsExpr) Range()hcl.Range
func (*ObjectConsExpr)StartRange¶
func (e *ObjectConsExpr) StartRange()hcl.Range
func (*ObjectConsExpr)Value¶
func (e *ObjectConsExpr) Value(ctx *hcl.EvalContext) (cty.Value,hcl.Diagnostics)
func (*ObjectConsExpr)Variables¶
func (e *ObjectConsExpr) Variables() []hcl.Traversal
typeObjectConsItem¶
type ObjectConsItem struct {KeyExprExpressionValueExprExpression}typeObjectConsKeyExpr¶
type ObjectConsKeyExpr struct {WrappedExpression}ObjectConsKeyExpr is a special wrapper used only for ObjectConsExpr keys,which deals with the special case that a naked identifier in that positionmust be interpreted as a literal string rather than evaluated directly.
func (*ObjectConsKeyExpr)AsTraversal¶
func (e *ObjectConsKeyExpr) AsTraversal()hcl.Traversal
Implementation for hcl.AbsTraversalForExpr.
func (*ObjectConsKeyExpr)Range¶
func (e *ObjectConsKeyExpr) Range()hcl.Range
func (*ObjectConsKeyExpr)StartRange¶
func (e *ObjectConsKeyExpr) StartRange()hcl.Range
func (*ObjectConsKeyExpr)UnwrapExpression¶
func (e *ObjectConsKeyExpr) UnwrapExpression()Expression
func (*ObjectConsKeyExpr)Value¶
func (e *ObjectConsKeyExpr) Value(ctx *hcl.EvalContext) (cty.Value,hcl.Diagnostics)
func (*ObjectConsKeyExpr)Variables¶
func (e *ObjectConsKeyExpr) Variables() []hcl.Traversal
typeRelativeTraversalExpr¶
type RelativeTraversalExpr struct {SourceExpressionTraversalhcl.TraversalSrcRangehcl.Range}RelativeTraversalExpr is an Expression that retrieves a value from anothervalue using a _relative_ traversal.
func (*RelativeTraversalExpr)AsTraversal¶
func (e *RelativeTraversalExpr) AsTraversal()hcl.Traversal
Implementation for hcl.AbsTraversalForExpr.
func (*RelativeTraversalExpr)Range¶
func (e *RelativeTraversalExpr) Range()hcl.Range
func (*RelativeTraversalExpr)StartRange¶
func (e *RelativeTraversalExpr) StartRange()hcl.Range
func (*RelativeTraversalExpr)Value¶
func (e *RelativeTraversalExpr) Value(ctx *hcl.EvalContext) (cty.Value,hcl.Diagnostics)
func (*RelativeTraversalExpr)Variables¶
func (e *RelativeTraversalExpr) Variables() []hcl.Traversal
typeScopeTraversalExpr¶
ScopeTraversalExpr is an Expression that retrieves a value from the scopeusing a traversal.
func (*ScopeTraversalExpr)AsTraversal¶
func (e *ScopeTraversalExpr) AsTraversal()hcl.Traversal
Implementation for hcl.AbsTraversalForExpr.
func (*ScopeTraversalExpr)Range¶
func (e *ScopeTraversalExpr) Range()hcl.Range
func (*ScopeTraversalExpr)StartRange¶
func (e *ScopeTraversalExpr) StartRange()hcl.Range
func (*ScopeTraversalExpr)Value¶
func (e *ScopeTraversalExpr) Value(ctx *hcl.EvalContext) (cty.Value,hcl.Diagnostics)
func (*ScopeTraversalExpr)Variables¶
func (e *ScopeTraversalExpr) Variables() []hcl.Traversal
typeSplatExpr¶
type SplatExpr struct {SourceExpressionEachExpressionItem *AnonSymbolExprSrcRangehcl.RangeMarkerRangehcl.Range}func (*SplatExpr)StartRange¶
func (*SplatExpr)Value¶
func (e *SplatExpr) Value(ctx *hcl.EvalContext) (cty.Value,hcl.Diagnostics)
typeTemplateExpr¶
type TemplateExpr struct {Parts []ExpressionSrcRangehcl.Range}func (*TemplateExpr)IsStringLiteral¶
func (e *TemplateExpr) IsStringLiteral()bool
IsStringLiteral returns true if and only if the template consists only ofsingle string literal, as would be created for a simple quoted string like"foo".
If this function returns true, then calling Value on the same expressionwith a nil EvalContext will return the literal value.
Note that "${"foo"}", "${1}", etc aren't considered literal values for thepurposes of this method, because the intent of this method is to identifysituations where the user seems to be explicitly intending literal stringinterpretation, not situations that result in literals as a technicalityof the template expression unwrapping behavior.
func (*TemplateExpr)Range¶
func (e *TemplateExpr) Range()hcl.Range
func (*TemplateExpr)StartRange¶
func (e *TemplateExpr) StartRange()hcl.Range
func (*TemplateExpr)Value¶
func (e *TemplateExpr) Value(ctx *hcl.EvalContext) (cty.Value,hcl.Diagnostics)
func (*TemplateExpr)Variables¶
func (e *TemplateExpr) Variables() []hcl.Traversal
typeTemplateJoinExpr¶
type TemplateJoinExpr struct {TupleExpression}TemplateJoinExpr is used to convert tuples of strings produced by templateconstructs (i.e. for loops) into flat strings, by converting the valuestos strings and joining them. This AST node is not used directly; it'sproduced as part of the AST of a "for" loop in a template.
func (*TemplateJoinExpr)Range¶
func (e *TemplateJoinExpr) Range()hcl.Range
func (*TemplateJoinExpr)StartRange¶
func (e *TemplateJoinExpr) StartRange()hcl.Range
func (*TemplateJoinExpr)Value¶
func (e *TemplateJoinExpr) Value(ctx *hcl.EvalContext) (cty.Value,hcl.Diagnostics)
func (*TemplateJoinExpr)Variables¶
func (e *TemplateJoinExpr) Variables() []hcl.Traversal
typeTemplateWrapExpr¶
type TemplateWrapExpr struct {WrappedExpressionSrcRangehcl.Range}TemplateWrapExpr is used instead of a TemplateExpr when a templateconsists _only_ of a single interpolation sequence. In that case, thetemplate's result is the single interpolation's result, verbatim withno type conversions.
func (*TemplateWrapExpr)Range¶
func (e *TemplateWrapExpr) Range()hcl.Range
func (*TemplateWrapExpr)StartRange¶
func (e *TemplateWrapExpr) StartRange()hcl.Range
func (*TemplateWrapExpr)Value¶
func (e *TemplateWrapExpr) Value(ctx *hcl.EvalContext) (cty.Value,hcl.Diagnostics)
func (*TemplateWrapExpr)Variables¶
func (e *TemplateWrapExpr) Variables() []hcl.Traversal
typeToken¶
Token represents a sequence of bytes from some HCL code that has beentagged with a type and its range within the source file.
typeTokenType¶
type TokenTyperune
TokenType is an enumeration used for the Type field on Token.
const (TokenOBraceTokenType = '{'TokenCBraceTokenType = '}'TokenOBrackTokenType = '['TokenCBrackTokenType = ']'TokenOParenTokenType = '('TokenCParenTokenType = ')'TokenOQuoteTokenType = '«'TokenCQuoteTokenType = '»'TokenOHeredocTokenType = 'H'TokenCHeredocTokenType = 'h'TokenStarTokenType = '*'TokenSlashTokenType = '/'TokenPlusTokenType = '+'TokenMinusTokenType = '-'TokenPercentTokenType = '%'TokenEqualTokenType = '='TokenEqualOpTokenType = '≔'TokenNotEqualTokenType = '≠'TokenLessThanTokenType = '<'TokenLessThanEqTokenType = '≤'TokenGreaterThanTokenType = '>'TokenGreaterThanEqTokenType = '≥'TokenAndTokenType = '∧'TokenOrTokenType = '∨'TokenBangTokenType = '!'TokenDotTokenType = '.'TokenCommaTokenType = ','TokenEllipsisTokenType = '…'TokenFatArrowTokenType = '⇒'TokenQuestionTokenType = '?'TokenColonTokenType = ':'TokenTemplateInterpTokenType = '∫'TokenTemplateControlTokenType = 'λ'TokenTemplateSeqEndTokenType = '∎'TokenQuotedLitTokenType = 'Q'// might contain backslash escapesTokenStringLitTokenType = 'S'// cannot contain backslash escapesTokenNumberLitTokenType = 'N'TokenIdentTokenType = 'I'TokenCommentTokenType = 'C'TokenNewlineTokenType = '\n'TokenEOFTokenType = '␄'TokenBitwiseAndTokenType = '&'TokenBitwiseOrTokenType = '|'TokenBitwiseNotTokenType = '~'TokenBitwiseXorTokenType = '^'TokenStarStarTokenType = '➚'TokenApostropheTokenType = '\''TokenBacktickTokenType = '`'TokenSemicolonTokenType = ';'TokenTabsTokenType = '␉'TokenInvalidTokenType = '�'TokenBadUTF8TokenType = '💩'TokenQuotedNewlineTokenType = ''// TokenNil is a placeholder for when a token is required but none is// available, e.g. when reporting errors. The scanner will never produce// this as part of a token stream.TokenNilTokenType = '\x00')
typeTokens¶
type Tokens []Token
Tokens is a slice of Token.
funcLexConfig¶
LexConfig performs lexical analysis on the given buffer, treating it as awhole HCL config file, and returns the resulting tokens.
Only minimal validation is done during lexical analysis, so the returneddiagnostics may include errors about lexical issues such as bad characterencodings or unrecognized characters, but full parsing is required todetect _all_ syntax errors.
funcLexExpression¶
LexExpression performs lexical analysis on the given buffer, treating it asa standalone HCL expression, and returns the resulting tokens.
Only minimal validation is done during lexical analysis, so the returneddiagnostics may include errors about lexical issues such as bad characterencodings or unrecognized characters, but full parsing is required todetect _all_ syntax errors.
funcLexTemplate¶
LexTemplate performs lexical analysis on the given buffer, treating it as astandalone HCL template, and returns the resulting tokens.
Only minimal validation is done during lexical analysis, so the returneddiagnostics may include errors about lexical issues such as bad characterencodings or unrecognized characters, but full parsing is required todetect _all_ syntax errors.
typeTupleConsExpr¶
type TupleConsExpr struct {Exprs []ExpressionSrcRangehcl.RangeOpenRangehcl.Range}func (*TupleConsExpr)ExprList¶
func (e *TupleConsExpr) ExprList() []hcl.Expression
Implementation for hcl.ExprList
func (*TupleConsExpr)Range¶
func (e *TupleConsExpr) Range()hcl.Range
func (*TupleConsExpr)StartRange¶
func (e *TupleConsExpr) StartRange()hcl.Range
func (*TupleConsExpr)Value¶
func (e *TupleConsExpr) Value(ctx *hcl.EvalContext) (cty.Value,hcl.Diagnostics)
func (*TupleConsExpr)Variables¶
func (e *TupleConsExpr) Variables() []hcl.Traversal
typeUnaryOpExpr¶
func (*UnaryOpExpr)Range¶
func (e *UnaryOpExpr) Range()hcl.Range
func (*UnaryOpExpr)StartRange¶
func (e *UnaryOpExpr) StartRange()hcl.Range
func (*UnaryOpExpr)Value¶
func (e *UnaryOpExpr) Value(ctx *hcl.EvalContext) (cty.Value,hcl.Diagnostics)
func (*UnaryOpExpr)Variables¶
func (e *UnaryOpExpr) Variables() []hcl.Traversal
typeVisitFunc¶
type VisitFunc func(nodeNode)hcl.Diagnostics
VisitFunc is the callback signature for VisitAll.
typeWalker¶
type Walker interface {Enter(nodeNode)hcl.DiagnosticsExit(nodeNode)hcl.Diagnostics}Walker is an interface used with Walk.
Source Files¶
- diagnostics.go
- didyoumean.go
- doc.go
- expression.go
- expression_ops.go
- expression_template.go
- expression_vars.go
- file.go
- generate.go
- keywords.go
- navigation.go
- node.go
- parser.go
- parser_template.go
- parser_traversal.go
- peeker.go
- public.go
- scan_string_lit.rl
- scan_tokens.rl
- structure.go
- structure_at_pos.go
- token.go
- token_type_string.go
- variables.go
- walk.go