Documentation
¶
Index ¶
- Variables
- func NewDiagnosticWriter(w io.Writer, files []*File, width uint, color bool) hcl.DiagnosticWriter
- type AttributeTokens
- type BinaryOpTokens
- type BlockTokens
- type BodyTokens
- type BracketTraverserTokens
- type Comment
- type ConditionalTokens
- type DotTraverserTokens
- type File
- type ForTokens
- type FunctionCallTokens
- type IndexTokens
- type LiteralValueTokens
- type NodeTokens
- type ObjectConsItemTokens
- type ObjectConsTokens
- type Parser
- type RelativeTraversalTokens
- type ScopeTraversalTokens
- type SplatTokens
- type TemplateTokens
- type Token
- type TokenMap
- type TraverserTokens
- type Trivia
- type TupleConsTokens
- type UnaryOpTokens
- type Whitespace
Constants ¶
This section is empty.
Variables ¶
var None hclsyntax.Node = &hclsyntax.Body{}
None is an HCL syntax node that can be used when a syntax node is required but none is appropriate.
Functions ¶
func NewDiagnosticWriter ¶
NewDiagnosticWriter creates a new diagnostic writer for the given list of HCL2 files.
Types ¶
type AttributeTokens ¶
AttributeTokens records the tokens associated with an *hclsyntax.Attribute.
type BinaryOpTokens ¶
type BinaryOpTokens struct {
Operator Token
}
BinaryOpTokens records the tokens associated with an *hclsyntax.BinaryOpExpr.
type BlockTokens ¶
BlockTokens records the tokens associated with an *hclsyntax.Block.
type BodyTokens ¶
type BodyTokens struct {
EndOfFile Token
}
BodyTokens records the tokens associated with an *hclsyntax.Body.
type BracketTraverserTokens ¶
BracketTraverserTokens records the tokens associated with a bracketed traverser (i.e. '[' <index> ']').
type Comment ¶
type Comment struct {
// Lines contains the lines of the comment without leading comment characters or trailing newlines.
Lines []string
// contains filtered or unexported fields
}
Comment is a piece of trivia that represents a line or block comment in a source file.
type ConditionalTokens ¶
ConditionalTokens records the tokens associated with an *hclsyntax.ConditionalExpr.
type DotTraverserTokens ¶
DotTraverserTokens records the tokens associated with dotted traverser (i.e. '.' <attr>).
type File ¶
type File struct {
Name string // The name of the file.
Body *hclsyntax.Body // The body of the parsed file.
Bytes []byte // The raw bytes of the source file.
Tokens TokenMap // A map from syntax nodes to token information.
}
File represents a single parsed HCL2 source file.
type ForTokens ¶
type ForTokens struct {
Open Token
For Token
Key *Token
Comma *Token
Value Token
In Token
Colon Token
Arrow *Token
Group *Token
If *Token
Close Token
}
ForTokens records the tokens associated with an *hclsyntax.ForExpr.
type FunctionCallTokens ¶
FunctionCallTokens records the tokens associated with an *hclsyntax.FunctionCallExpr.
type IndexTokens ¶
IndexTokens records the tokens associated with an *hclsyntax.IndexExpr.
type LiteralValueTokens ¶
type LiteralValueTokens struct {
Value []Token
}
LiteralValueTokens records the tokens associated with an *hclsyntax.LiteralValueExpr.
type NodeTokens ¶
type NodeTokens interface {
// contains filtered or unexported methods
}
NodeTokens is a closed interface that is used to represent arbitrary *Tokens types in this package.
type ObjectConsItemTokens ¶
ObjectConsItemTokens records the tokens associated with an hclsyntax.ObjectConsItem.
type ObjectConsTokens ¶
type ObjectConsTokens struct {
OpenBrace Token
Items []ObjectConsItemTokens
CloseBrace Token
}
ObjectConsTokens records the tokens associated with an *hclsyntax.ObjectConsExpr.
type Parser ¶
type Parser struct {
Files []*File // The parsed files.
Diagnostics hcl.Diagnostics // The diagnostics, if any, produced during parsing.
// contains filtered or unexported fields
}
Parser is a parser for HCL2 source files.
func (*Parser) NewDiagnosticWriter ¶
NewDiagnosticWriter creates a new diagnostic writer for the files parsed by the parser.
type RelativeTraversalTokens ¶
type RelativeTraversalTokens struct {
Traversal []TraverserTokens
}
RelativeTraversalTokens records the tokens associated with an *hclsyntax.RelativeTraversalExpr.
type ScopeTraversalTokens ¶
type ScopeTraversalTokens struct {
Root Token
Traversal []TraverserTokens
}
ScopeTraversalTokens records the tokens associated with an *hclsyntax.ScopeTraversalExpr.
type SplatTokens ¶
SplatTokens records the tokens associated with an *hclsyntax.SplatExpr.
type TemplateTokens ¶
TemplateTokens records the tokens associated with an *hclsyntax.TemplateExpr.
type TokenMap ¶
type TokenMap interface {
ForNode(n hclsyntax.Node) NodeTokens
// contains filtered or unexported methods
}
A TokenMap is used to map from syntax nodes to information about their tokens and leading whitespace/comments.
func NewTokenMapForFiles ¶
NewTokenMapForFiles creates a new token map that can be used to look up tokens for nodes in any of the given files.
func ParseExpression ¶ added in v1.13.0
func ParseExpression(expression, filename string, start hcl.Pos) (hclsyntax.Expression, TokenMap, hcl.Diagnostics)
ParseExpression attempts to parse the given string as an HCL2 expression.
type TraverserTokens ¶
type TraverserTokens interface {
// contains filtered or unexported methods
}
TraverserTokens is a closed interface implemented by DotTraverserTokens and BracketTraverserTokens
type Trivia ¶
type Trivia interface {
// Range returns the range of the trivia in the source file.
Range() hcl.Range
// Bytes returns the raw bytes that comprise the trivia.
Bytes() []byte
// contains filtered or unexported methods
}
Trivia represents bytes in a source file that are not syntactically meaningful. This includes whitespace and comments.
type TupleConsTokens ¶
TupleConsTokens records the tokens associated with an *hclsyntax.TupleConsExpr.
type UnaryOpTokens ¶
type UnaryOpTokens struct {
Operator Token
}
UnaryOpTokens records the tokens associated with an *hclsyntax.UnaryOpExpr.
type Whitespace ¶
type Whitespace struct {
// contains filtered or unexported fields
}
Whitespace is a piece of trivia that represents a sequence of whitespace characters in a source file.
func (Whitespace) Bytes ¶
func (w Whitespace) Bytes() []byte
Bytes returns the raw bytes that comprise the whitespace.
func (Whitespace) Range ¶
func (w Whitespace) Range() hcl.Range
Range returns the range of the whitespace in the source file.