func ParseTemplate(src []byte, filename string, start hcl.Pos) (Expression, hcl.Diagnostics) {
	tokens, diags := LexTemplate(src, filename, start)
	peeker := newPeeker(tokens, false)
	parser := &parser{peeker: peeker}
	expr, parseDiags := parser.ParseTemplate()
	diags = append(diags, parseDiags...)
	peeker.AssertEmptyIncludeNewlinesStack()
	return expr, diags
}
ParseTemplate parses the given buffer as a standalone HCL template,
returning it as an instance of Expression.
package hclsyntax
import (
	"github.com/hashicorp/hcl/v2"
)
func ParseConfig(src []byte, filename string, start hcl.Pos) (*hcl.File, hcl.Diagnostics) {
	tokens, diags := LexConfig(src, filename, start)
	peeker := newPeeker(tokens, false)
	parser := &parser{peeker: peeker}
	body, parseDiags := parser.ParseBody(TokenEOF)
	diags = append(diags, parseDiags...)
	peeker.AssertEmptyIncludeNewlinesStack()
	return &hcl.File{
		Body:  body,
		Bytes: src,
		Nav: navigation{
			root: body,
		},
	}, diags
}
func ParseExpression(src []byte, filename string, start hcl.Pos) (Expression, hcl.Diagnostics) {
	tokens, diags := LexExpression(src, filename, start)
	peeker := newPeeker(tokens, false)
	parser := &parser{peeker: peeker}
	parser.PushIncludeNewlines(false)
	expr, parseDiags := parser.ParseExpression()
	diags = append(diags, parseDiags...)
	next := parser.Peek()
	if next.Type != TokenEOF && !parser.recovery {
		diags = append(diags, &hcl.Diagnostic{
			Severity: hcl.DiagError,
			Summary:  "Extra characters after expression",
			Detail:   "An expression was successfully parsed, but extra characters were found after it.",
			Subject:  &next.Range,
		})
	}
	parser.PopIncludeNewlines()
	peeker.AssertEmptyIncludeNewlinesStack()
	return expr, diags
}