(end TokenType, flushHeredoc bool)
| 37 | } |
| 38 | |
| 39 | func (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 | |
| 62 | type templateParser struct { |
| 63 | Tokens []templateToken |
no test coverage detected