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

Method parseTemplateInner

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

Source from the content-addressed store, hash-verified

37}
38
39func (p *parser) parseTemplateInner(end TokenType, flushHeredoc bool) ([]Expression, bool, hcl.Range, hcl.Diagnostics) {
40 parts, diags := p.parseTemplateParts(end)
41 if flushHeredoc {
42 flushHeredocTemplateParts(parts) // Trim off leading spaces on lines per the flush heredoc spec
43 }
44 meldConsecutiveStringLiterals(parts)
45 tp := templateParser{
46 Tokens: parts.Tokens,
47 SrcRange: parts.SrcRange,
48 }
49 exprs, exprsDiags := tp.parseRoot()
50 diags = append(diags, exprsDiags...)
51
52 passthru := false
53 if len(parts.Tokens) == 2 { // one real token and one synthetic "end" token
54 if _, isInterp := parts.Tokens[0].(*templateInterpToken); isInterp {
55 passthru = true
56 }
57 }
58
59 return exprs, passthru, parts.SrcRange, diags
60}
61
62type templateParser struct {
63 Tokens []templateToken

Callers 2

parseTemplateMethod · 0.95
parseExpressionTermMethod · 0.95

Calls 4

parseTemplatePartsMethod · 0.95
parseRootMethod · 0.95

Tested by

no test coverage detected