bufmoduleprotoparse

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFileAnnotation

func GetFileAnnotation(
	ctx context.Context,
	parserAccessorHandler ParserAccessorHandler,
	errorWithPos protoparse.ErrorWithPos,
) (bufanalysis.FileAnnotation, error)

GetFileAnnotation gets the FileAnnotation for the ErrorWithPos error.

func GetFileAnnotations

func GetFileAnnotations(
	ctx context.Context,
	parserAccessorHandler ParserAccessorHandler,
	errorsWithPos []protoparse.ErrorWithPos,
) ([]bufanalysis.FileAnnotation, error)

GetFileAnnotations gets the FileAnnotations for the ErrorWithPos errors.

Types

type ParserAccessorHandler

type ParserAccessorHandler interface {
	// Open opens the given path, and tracks the external path and import status.
	//
	// This function can be used as a ParserAccessor for protoparse.
	Open(path string) (io.ReadCloser, error)
	// ExternalPath returns the external path for the input path.
	//
	// Returns the input path if the external path is not known.
	ExternalPath(path string) string
	// IsImport returns true if the path is an import.
	IsImport(path string) bool
	// Returns nil if not available.
	ModuleIdentity(path string) bufmoduleref.ModuleIdentity
	// Returns empty if not available.
	Commit(path string) string
}

ParserAccessorHandler handles ParserAccessor operations for protoparse..

func NewParserAccessorHandler

func NewParserAccessorHandler(ctx context.Context, module bufmodule.Module) ParserAccessorHandler

NewParserAccessorHandler returns a new ParserAccessorHandler.

The given module should be a bufmodule.ModuleFileSet for image builds, as it needs access to not just the target files, but all dependency files as well.

For AST building, this can just be a bufmodule.Module.

Jump to

Keyboard shortcuts

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