format

package
v0.0.0-...-5599ccc Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DumpAST

func DumpAST(node ast.Node, parseRes parser.Result) string

func File

func File(filename string, out io.Writer) error

func FileInPlace

func FileInPlace(filename string) error

func Format

func Format(in io.Reader, out io.Writer) error

func NewDefaultPrinter

func NewDefaultPrinter() *protoprint.Printer

func NewFormatter

func NewFormatter(
	writer io.Writer,
	fileNode FileNodeInterface,
) *formatter

NewFormatter returns a new formatter for the given file.

func PrintAndFormatFileDescriptor

func PrintAndFormatFileDescriptor(fd protoreflect.FileDescriptor, out io.Writer) error

func PrintDescriptor

func PrintDescriptor(d protoreflect.Descriptor) (string, error)

func PrintNode

func PrintNode(fileNode FileNodeInterface, node ast.Node) (string, error)

func SortElements

func SortElements(a, b protoprint.Element, ignore func() bool) (less bool)

func StringForFieldReference

func StringForFieldReference(fieldReference *ast.FieldReferenceNode) string

StringForFieldReference returns the string representation of the given field reference. This is used for sorting file-level options.

func StringForOptionName

func StringForOptionName(optionNameNode *ast.OptionNameNode) string

StringForOptionName returns the string representation of the given option name node. This is used for sorting file-level options.

Types

type FileNodeInterface

type FileNodeInterface interface {
	GetSyntax() *ast.SyntaxNode
	GetEdition() *ast.EditionNode
	GetDecls() []*ast.FileElement
	GetEOF() *ast.RuneNode

	NodeInfo(node ast.Node) ast.NodeInfo
}

func NodeInfoOverlay

func NodeInfoOverlay(fileNode FileNodeInterface, infos map[ast.Node]ast.NodeInfo) FileNodeInterface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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