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

Method PartitionBlockItem

hclwrite/parser.go:131–136  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

129// AST attributes. It makes assumptions that apply only to block items, so
130// should not be used for other constructs.
131func (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
138func (it inputTokens) PartitionLeadComments() (before, within inputTokens) {
139 start := partitionLeadCommentTokens(it.nativeTokens)

Callers 1

parseBodyItemFunction · 0.80

Calls 3

PartitionMethod · 0.95
PartitionLeadCommentsMethod · 0.80

Tested by

no test coverage detected