-
Notifications
You must be signed in to change notification settings - Fork 602
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
hclwrite: Various new "TokensFor..." functions
The "TokensFor..." family of functions all aim to construct valid raw token sequences representing particular syntax constructs. Previously we had only "leaf" functions TokensForValue and TokensForTraversal, but nothing to help with constructing compound structures. Here we add TokensForTuple, TokensForObject, and TokensForFunctionCall which together cover all of the constructs that HCL allows static analysis of, and thus constructs where it's likely that someone would want to generate an expression that is interpreted purely by its syntax and not resolved into a value. What all of these have in common is that they take other Tokens values as arguments and include them verbatim as part of their result, with the caller being responsible for making sure these smaller units are themselves valid expression tokens. This also adds TokensForIdentifier as a convenient shorthand for generating single-identifier tokens, which is particularly useful for populating the attribute names in TokensForObject.
- Loading branch information
1 parent
21d379f
commit 962b970
Showing
3 changed files
with
480 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.