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

Function LexTemplate

hclsyntax/public.go:187–191  ·  view source on GitHub ↗

LexTemplate performs lexical analysis on the given buffer, treating it as a standalone HCL template, and returns the resulting tokens. Only minimal validation is done during lexical analysis, so the returned diagnostics may include errors about lexical issues such as bad character encodings or unre

(src []byte, filename string, start hcl.Pos)

Source from the content-addressed store, hash-verified

185// encodings or unrecognized characters, but full parsing is required to
186// detect _all_ syntax errors.
187func LexTemplate(src []byte, filename string, start hcl.Pos) (Tokens, hcl.Diagnostics) {
188 tokens := scanTokens(src, filename, start, scanTemplate)
189 diags := checkInvalidTokens(tokens)
190 return tokens, diags
191}
192
193// ValidIdentifier tests if the given string could be a valid identifier in
194// a native syntax expression.

Callers 1

ParseTemplateFunction · 0.85

Calls 2

scanTokensFunction · 0.85
checkInvalidTokensFunction · 0.85

Tested by

no test coverage detected