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

Function parseExpression

json/parser.go:29–42  ·  view source on GitHub ↗
(buf []byte, filename string, start hcl.Pos)

Source from the content-addressed store, hash-verified

27}
28
29func parseExpression(buf []byte, filename string, start hcl.Pos) (node, hcl.Diagnostics) {
30 tokens := scan(buf, pos{Filename: filename, Pos: start})
31 p := newPeeker(tokens)
32 node, diags := parseValue(p)
33 if len(diags) == 0 && p.Peek().Type != tokenEOF {
34 diags = diags.Append(&hcl.Diagnostic{
35 Severity: hcl.DiagError,
36 Summary: "Extraneous data after value",
37 Detail: "Extra characters appear after the JSON value.",
38 Subject: p.Peek().Range.Ptr(),
39 })
40 }
41 return node, diags
42}
43
44func parseValue(p *peeker) (node, hcl.Diagnostics) {
45 tok := p.Peek()

Callers 1

Calls 6

scanFunction · 0.85
parseValueFunction · 0.85
PtrMethod · 0.80
newPeekerFunction · 0.70
PeekMethod · 0.45
AppendMethod · 0.45

Tested by

no test coverage detected