parseutil

package
v1.58.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2026 License: MPL-2.0 Imports: 17 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var KebabName = resourceNameSpec{
	// contains filtered or unexported fields
}
View Source
var SnakeName = resourceNameSpec{
	// contains filtered or unexported fields
}

Functions

func FindPkgNameRefs

func FindPkgNameRefs(pkg *pkginfo.Package, pkgNames []pkginfo.QualifiedName, fn func(f *pkginfo.File, name pkginfo.QualifiedName, stack []ast.Node))

FindPkgNameRefs finds all references in the given package that references any of the given pkgNames. For each such reference it calls fn.

func NodeType

func NodeType(node ast.Node) string

NodeType converts a node to a string that can be used in an error message. such as a ast.CallExpr will return "a function call to foo.Blah"

func ParseReference

func ParseReference(p *resourceparser.Pass, spec *ReferenceSpec, data ReferenceData)

func ParseResourceName

func ParseResourceName(errs *perr.List, resourceType string, paramName string, node ast.Expr, nameSpec resourceNameSpec, reservedPrefix string) string

ParseResourceName checks the given node is a string literal and that it conforms to the given spec.

If an error is encountered, it will report a parse error and return an empty string otherwise it will return the parsed resource name

Types

type ReferenceData

type ReferenceData struct {
	File         *pkginfo.File
	Stack        []ast.Node
	ResourceFunc pkginfo.QualifiedName
}

type ReferenceInfo

type ReferenceInfo struct {
	Pass         *resourceparser.Pass
	ResourceFunc pkginfo.QualifiedName
	File         *pkginfo.File

	Stack    []ast.Node
	Call     *ast.CallExpr
	TypeArgs []schema.Type
	Doc      string

	// Ident is the identifier this reference is assigned to, if any.
	Ident option.Option[*ast.Ident]
}

type ReferenceSpec

type ReferenceSpec struct {
	MinTypeArgs int
	MaxTypeArgs int
	Parse       func(ReferenceInfo)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL