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

Method asHCLSyntax

hclwrite/tokens.go:36–44  ·  view source on GitHub ↗

asHCLSyntax returns the receiver expressed as an incomplete hclsyntax.Token. A complete token is not possible since we don't have source location information here, and so this method is unexported so we can be sure it will only be used for internal purposes where we know the range isn't important.

()

Source from the content-addressed store, hash-verified

34// This is primarily intended to allow us to re-use certain functionality from
35// hclsyntax rather than re-implementing it against our own token type here.
36func (t *Token) asHCLSyntax() hclsyntax.Token {
37 return hclsyntax.Token{
38 Type: t.Type,
39 Bytes: t.Bytes,
40 Range: hcl.Range{
41 Filename: "<invalid>",
42 },
43 }
44}
45
46// Tokens is a flat list of tokens.
47type Tokens []*Token

Callers 2

CurrentMethod · 0.80
spaceAfterTokenFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected