MCPcopy
hub / github.com/hashicorp/hcl / TokensForTraversal

Function TokensForTraversal

hclwrite/generate.go:39–43  ·  view source on GitHub ↗

TokensForTraversal returns a sequence of tokens that represents the given traversal. If the traversal is absolute then the result is a self-contained, valid reference expression. If the traversal is relative then the returned tokens could be appended to some other expression tokens to traverse into

(traversal hcl.Traversal)

Source from the content-addressed store, hash-verified

37// could be appended to some other expression tokens to traverse into the
38// represented expression.
39func TokensForTraversal(traversal hcl.Traversal) Tokens {
40 toks := appendTokensForTraversal(traversal, nil)
41 format(toks) // fiddle with the SpacesBefore field to get canonical spacing
42 return toks
43}
44
45// TokensForIdentifier returns a sequence of tokens representing just the
46// given identifier.

Callers 3

TestTokensForTraversalFunction · 0.85
TestTokensForTupleFunction · 0.85
TestTokensForObjectFunction · 0.85

Calls 2

appendTokensForTraversalFunction · 0.85
formatFunction · 0.85

Tested by 3

TestTokensForTraversalFunction · 0.68
TestTokensForTupleFunction · 0.68
TestTokensForObjectFunction · 0.68