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

Method parseTemplate

hclsyntax/parser_template.go:20–37  ·  view source on GitHub ↗
(end TokenType, flushHeredoc bool)

Source from the content-addressed store, hash-verified

18}
19
20func (p *parser) parseTemplate(end TokenType, flushHeredoc bool) (Expression, hcl.Diagnostics) {
21 exprs, passthru, rng, diags := p.parseTemplateInner(end, flushHeredoc)
22
23 if passthru {
24 if len(exprs) != 1 {
25 panic("passthru set with len(exprs) != 1")
26 }
27 return &TemplateWrapExpr{
28 Wrapped: exprs[0],
29 SrcRange: rng,
30 }, diags
31 }
32
33 return &TemplateExpr{
34 Parts: exprs,
35 SrcRange: rng,
36 }, diags
37}
38
39func (p *parser) parseTemplateInner(end TokenType, flushHeredoc bool) ([]Expression, bool, hcl.Range, hcl.Diagnostics) {
40 parts, diags := p.parseTemplateParts(end)

Callers 1

ParseTemplateMethod · 0.95

Calls 1

parseTemplateInnerMethod · 0.95

Tested by

no test coverage detected