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)
| 37 | // could be appended to some other expression tokens to traverse into the |
| 38 | // represented expression. |
| 39 | func 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. |