Versions in this module Expand all Collapse all v2 v2.1.0 Nov 20, 2022 v2.0.0 Oct 26, 2022 Changes in this version + var InitialPos = Pos + func AbsTraversalForExpr(expr Expression) (Traversal, Diagnostics) + func DiagnosticExtra(diag *Diagnostic) (T, bool) + func ExprAsKeyword(expr Expression) string + func ExprCall(expr Expression) (*StaticCall, Diagnostics) + func ExprList(expr Expression) ([]Expression, Diagnostics) + func ExprMap(expr Expression) ([]KeyValuePair, Diagnostics) + func RelTraversalForExpr(expr Expression) (Traversal, Diagnostics) + type Attribute struct + Expr Expression + Name string + NameRange Range + Range Range + type AttributeSchema struct + Name string + Required bool + type Attributes map[string]*Attribute + type Block struct + Body Body + DefRange Range + LabelRanges []Range + Labels []string + Type string + TypeRange Range + type BlockHeaderSchema struct + LabelNames []string + Type string + type Blocks []*Block + func (els Blocks) ByType() map[string]Blocks + func (els Blocks) OfType(typeName string) Blocks + type Body interface + Content func(schema *BodySchema) (*BodyContent, Diagnostics) + JustAttributes func() (Attributes, Diagnostics) + MissingItemRange func() Range + PartialContent func(schema *BodySchema) (*BodyContent, Body, Diagnostics) + func EmptyBody() Body + func MergeBodies(bodies []Body) Body + func MergeFiles(files []*File) Body + type BodyContent struct + Attributes Attributes + Blocks Blocks + MissingItemRange Range + type BodySchema struct + Attributes []AttributeSchema + Blocks []BlockHeaderSchema + type Diagnostic struct + Context *Range + Detail string + EvalContext *EvalContext + Expression Expression + Extra interface{} + Severity DiagnosticSeverity + Subject *Range + Summary string + func (d *Diagnostic) Error() string + type DiagnosticExtraUnwrapper interface + UnwrapDiagnosticExtra func() interface{} + type DiagnosticSeverity int + const DiagError + const DiagInvalid + const DiagWarning + type DiagnosticWriter interface + WriteDiagnostic func(*Diagnostic) error + WriteDiagnostics func(Diagnostics) error + func NewDiagnosticTextWriter(wr io.Writer, files map[string]*File, width uint, color bool) DiagnosticWriter + type Diagnostics []*Diagnostic + func ApplyPath(val cty.Value, path cty.Path, srcRange *Range) (cty.Value, Diagnostics) + func GetAttr(obj cty.Value, attrName string, srcRange *Range) (cty.Value, Diagnostics) + func Index(collection, key cty.Value, srcRange *Range) (cty.Value, Diagnostics) + func (d Diagnostics) Append(diag *Diagnostic) Diagnostics + func (d Diagnostics) Error() string + func (d Diagnostics) Errs() []error + func (d Diagnostics) Extend(diags Diagnostics) Diagnostics + func (d Diagnostics) HasErrors() bool + type EvalContext struct + Functions map[string]function.Function + Variables map[string]cty.Value + func (ctx *EvalContext) NewChild() *EvalContext + func (ctx *EvalContext) Parent() *EvalContext + type Expression interface + Range func() Range + StartRange func() Range + Value func(ctx *EvalContext) (cty.Value, Diagnostics) + Variables func() []Traversal + func StaticExpr(val cty.Value, rng Range) Expression + func UnwrapExpression(expr Expression) Expression + func UnwrapExpressionUntil(expr Expression, until func(Expression) bool) Expression + type File struct + Body Body + Bytes []byte + Nav interface{} + func (f *File) AttributeAtPos(pos Pos) *Attribute + func (f *File) BlocksAtPos(pos Pos) []*Block + func (f *File) InnermostBlockAtPos(pos Pos) *Block + func (f *File) OutermostBlockAtPos(pos Pos) *Block + func (f *File) OutermostExprAtPos(pos Pos) Expression + type KeyValuePair struct + Key Expression + Value Expression + type Pos struct + Byte int + Column int + Line int + type Range struct + End Pos + Filename string + Start Pos + func RangeBetween(start, end Range) Range + func RangeOver(a, b Range) Range + func (r Range) CanSliceBytes(b []byte) bool + func (r Range) ContainsOffset(offset int) bool + func (r Range) ContainsPos(pos Pos) bool + func (r Range) Empty() bool + func (r Range) Overlap(other Range) Range + func (r Range) Overlaps(other Range) bool + func (r Range) PartitionAround(other Range) (before, overlap, after Range) + func (r Range) Ptr() *Range + func (r Range) SliceBytes(b []byte) []byte + func (r Range) String() string + type RangeScanner struct + func NewRangeScanner(b []byte, filename string, cb bufio.SplitFunc) *RangeScanner + func NewRangeScannerFragment(b []byte, filename string, start Pos, cb bufio.SplitFunc) *RangeScanner + func (sc *RangeScanner) Bytes() []byte + func (sc *RangeScanner) Err() error + func (sc *RangeScanner) Range() Range + func (sc *RangeScanner) Scan() bool + type StaticCall struct + ArgsRange Range + Arguments []Expression + Name string + NameRange Range + type Traversal []Traverser + func TraversalJoin(abs Traversal, rel Traversal) Traversal + func (t Traversal) IsRelative() bool + func (t Traversal) RootName() string + func (t Traversal) SimpleSplit() TraversalSplit + func (t Traversal) SourceRange() Range + func (t Traversal) TraverseAbs(ctx *EvalContext) (cty.Value, Diagnostics) + func (t Traversal) TraverseRel(val cty.Value) (cty.Value, Diagnostics) + type TraversalSplit struct + Abs Traversal + Rel Traversal + func (t TraversalSplit) Join() Traversal + func (t TraversalSplit) RootName() string + func (t TraversalSplit) Traverse(ctx *EvalContext) (cty.Value, Diagnostics) + func (t TraversalSplit) TraverseAbs(ctx *EvalContext) (cty.Value, Diagnostics) + func (t TraversalSplit) TraverseRel(val cty.Value) (cty.Value, Diagnostics) + type TraverseAttr struct + Name string + SrcRange Range + func (tn TraverseAttr) SourceRange() Range + func (tn TraverseAttr) TraversalStep(val cty.Value) (cty.Value, Diagnostics) + type TraverseIndex struct + Key cty.Value + SrcRange Range + func (tn TraverseIndex) SourceRange() Range + func (tn TraverseIndex) TraversalStep(val cty.Value) (cty.Value, Diagnostics) + type TraverseRoot struct + Name string + SrcRange Range + func (tn TraverseRoot) SourceRange() Range + func (tn TraverseRoot) TraversalStep(cty.Value) (cty.Value, Diagnostics) + type TraverseSplat struct + Each Traversal + SrcRange Range + func (tn TraverseSplat) SourceRange() Range + func (tn TraverseSplat) TraversalStep(val cty.Value) (cty.Value, Diagnostics) + type Traverser interface + SourceRange func() Range + TraversalStep func(cty.Value) (cty.Value, Diagnostics)