PartitionBlockItem is similar to PartitionIncludeComments but it returns the comments as separate token sequences so that they can be captured into AST attributes. It makes assumptions that apply only to block items, so should not be used for other constructs.
(rng hcl.Range)
| 129 | // AST attributes. It makes assumptions that apply only to block items, so |
| 130 | // should not be used for other constructs. |
| 131 | func (it inputTokens) PartitionBlockItem(rng hcl.Range) (before, leadComments, within, lineComments, newline, after inputTokens) { |
| 132 | before, within, after = it.Partition(rng) |
| 133 | before, leadComments = before.PartitionLeadComments() |
| 134 | lineComments, newline, after = after.PartitionLineEndTokens() |
| 135 | return |
| 136 | } |
| 137 | |
| 138 | func (it inputTokens) PartitionLeadComments() (before, within inputTokens) { |
| 139 | start := partitionLeadCommentTokens(it.nativeTokens) |
no test coverage detected