package
0.14.1
Repository: https://github.com/bufbuild/protocompile.git
Documentation: pkg.go.dev

# Functions

AsInt32 range checks the given int value and returns its value is in the range or 0, false if it is outside the range.
NewAnyTypeReferenceNode creates a new *FieldReferenceNode for an "any" type reference.
NewArrayLiteralNode creates a new *ArrayLiteralNode.
NewCompactOptionNode creates a new *OptionNode for a full compact declaration (as used in fields, enum values, and extension ranges).
NewCompactOptionsNode creates a *CompactOptionsNode.
NewCompoundIdentNode creates a *CompoundIdentNode.
NewCompoundLiteralStringNode creates a new *CompoundStringLiteralNode that consists of the given string components.
NewEditionNode creates a new *EditionNode.
NewEmptyDeclNode creates a new *EmptyDeclNode.
NewEmptyFileNode returns an empty AST for a file with the given name.
NewEnumNode creates a new *EnumNode.
NewEnumValueNode creates a new *EnumValueNode.
NewExtendNode creates a new *ExtendNode.
NewExtensionFieldReferenceNode creates a new *FieldReferenceNode for an extension field.
NewExtensionRangeNode creates a new *ExtensionRangeNode.
NewFieldNode creates a new *FieldNode.
NewFieldReferenceNode creates a new *FieldReferenceNode for a regular field.
NewFileInfo creates a new instance for the given file.
NewFileNode creates a new *FileNode.
NewFileNodeWithEdition creates a new *FileNode.
NewFloatLiteralNode creates a new *FloatLiteralNode with the given val.
NewGroupNode creates a new *GroupNode.
NewIdentNode creates a new *IdentNode.
NewImportNode creates a new *ImportNode.
NewKeywordNode creates a new *KeywordNode.
NewMapFieldNode creates a new *MapFieldNode.
NewMapTypeNode creates a new *MapTypeNode.
NewMessageFieldNode creates a new *MessageFieldNode.
NewMessageLiteralNode creates a new *MessageLiteralNode.
NewMessageNode creates a new *MessageNode.
NewNegativeIntLiteralNode creates a new *NegativeIntLiteralNode.
NewNoSourceNode creates a new NoSourceNode for the given filename.
NewOneofNode creates a new *OneofNode.
NewOptionNameNode creates a new *OptionNameNode.
NewOptionNode creates a new *OptionNode for a full option declaration (as used in files, messages, oneofs, enums, services, and methods).
NewPackageNode creates a new *PackageNode.
NewRangeNode creates a new *RangeNode.
NewReservedIdentifiersNode creates a new *ReservedNode that represents reserved names.
NewReservedNamesNode creates a new *ReservedNode that represents reserved names.
NewReservedRangesNode creates a new *ReservedNode that represents reserved numeric ranges.
NewRPCNode creates a new *RPCNode with no body.
NewRPCNodeWithBody creates a new *RPCNode that includes a body (and possibly options).
NewRPCTypeNode creates a new *RPCTypeNode.
NewRuneNode creates a new *RuneNode with the given properties.
NewServiceNode creates a new *ServiceNode.
NewSignedFloatLiteralNode creates a new *SignedFloatLiteralNode.
NewSourceSpan creates a new span that covers the given range.
NewSpecialFloatLiteralNode returns a new *SpecialFloatLiteralNode for the given keyword.
NewStringLiteralNode creates a new *StringLiteralNode with the given val.
NewSyntaxNode creates a new *SyntaxNode.
NewSyntheticMapField creates a new *SyntheticMapField for the given identifier (either a key or value type in a map declaration) and tag number (1 for key, 2 for value).
NewSyntheticOneof creates a new *SyntheticOneof that corresponds to the given proto3 optional field.
NewUintLiteralNode creates a new *UintLiteralNode with the given val.
UnknownPos is a placeholder position when only the source file name is known.
UnknownSpan is a placeholder span when only the source file name is known.
Visit implements the double-dispatch idiom and visits the given node by calling the appropriate method of the given visitor.
VisitChildren visits all direct children of the given node using the given visitor.
Walk conducts a walk of the AST rooted at the given root using the given visitor.
WithAfter returns a WalkOption that will cause the given function to be invoked after a node (as well as any descendants) is visited during a walk operation.
WithBefore returns a WalkOption that will cause the given function to be invoked before a node is visited during a walk operation.

# Constants

TokenError indicates an invalid token.

# Variables

EmptyComments is an empty set of comments.

# Structs

AncestorTracker is used to track the path of nodes during a walk operation.
ArrayLiteralNode represents an array literal, which is only allowed inside of a MessageLiteralNode, to indicate values for a repeated field.
Comment represents a single comment in a source file.
Comments represents a range of sequential comments in a source file (e.g.
CompactOptionsNode represents a compact options declaration, as used with fields, enum values, and extension ranges.
CompoundIdentNode represents a qualified identifier.
CompoundStringLiteralNode represents a compound string literal, which is the concatenaton of adjacent string literals.
EditionNode represents an edition declaration, which if present must be the first non-comment content.
EmptyDeclNode represents an empty declaration in protobuf source.
EnumNode represents an enum declaration.
EnumValueNode represents an enum declaration.
ExtendNode represents a declaration of extension fields.
ExtensionRangeNode represents an extension range declaration in an extendable message.
FieldLabel represents the label of a field, which indicates its cardinality (i.e.
FieldNode represents a normal field declaration (not groups or maps).
FieldReferenceNode is a reference to a field name.
FileInfo contains information about the contents of a source file, including details about comments and items.
FileNode is the root of the AST hierarchy.
FloatLiteralNode represents a floating point numeric literal.
GroupNode represents a group declaration, which doubles as a field and inline message declaration.
IdentNode represents a simple, unqualified identifier.
ImportNode represents an import statement.
MapFieldNode represents a map field declaration.
MapTypeNode represents the type declaration for a map field.
MessageBody represents the body of a message.
MessageFieldNode represents a single field (name and value) inside of a message literal.
MessageLiteralNode represents a message literal, which is compatible with the protobuf text format and can be used for custom options with message types.
MessageNode represents a message declaration.
NegativeIntLiteralNode represents an integer literal with a negative (-) sign.
NodeInfo represents the details for a node or token in the source file's AST.
NoOpVisitor is a visitor implementation that does nothing.
OneofNode represents a one-of declaration.
OptionNameNode represents an option name or even a traversal through message types to name a nested option field.
OptionNode represents the declaration of a single option for an element.
PackageNode represents a package declaration.
RangeNode represents a range expression, used in both extension ranges and reserved ranges.
ReservedNode represents reserved declaration, which can be used to reserve either names or numbers.
RPCNode represents an RPC declaration.
RPCTypeNode represents the declaration of a request or response type for an RPC.
RuneNode represents a single rune in protobuf source.
ServiceNode represents a service declaration.
SignedFloatLiteralNode represents a signed floating point number.
SimpleVisitor is a visitor implementation that uses numerous function fields.
SourcePos identifies a location in a proto source file.
SpecialFloatLiteralNode represents a special floating point numeric literal for "inf" and "nan" values.
StringLiteralNode represents a simple string literal.
SyntaxNode represents a syntax declaration, which if present must be the first non-comment content.
SyntheticMapField is not an actual node in the AST but a synthetic node that implements FieldDeclNode.
SyntheticOneof is not an actual node in the AST but a synthetic node that represents the oneof implied by a proto3 optional field.
UintLiteralNode represents a simple integer literal with no sign character.

# Interfaces

CompositeNode represents any non-terminal node in the tree.
EnumElement is an interface implemented by all AST nodes that can appear in the body of an enum declaration.
EnumValueDeclNode is a placeholder interface for AST nodes that represent enum values.
ExtendElement is an interface implemented by all AST nodes that can appear in the body of an extends declaration.
FieldDeclNode is a node in the AST that defines a field.
FileDeclNode is a placeholder interface for AST nodes that represent files.
FileElement is an interface implemented by all AST nodes that are allowed as top-level declarations in the file.
FloatValueNode is an AST node that represents a numeric literal with a floating point, in scientific notation, or too large to fit in an int64 or uint64.
IdentValueNode is an AST node that represents an identifier.
IntValueNode is an AST node that represents an integer literal.
ItemInfo provides details about an item's location in the source file and its contents.
MessageDeclNode is a node in the AST that defines a message type.
MessageElement is an interface implemented by all AST nodes that can appear in a message body.
Node is the interface implemented by all nodes in the AST.
NodeWithOptions represents a node in the AST that contains option statements.
OneofDeclNode is a node in the AST that defines a oneof.
OneofElement is an interface implemented by all AST nodes that can appear in the body of a oneof declaration.
OptionDeclNode is a placeholder interface for AST nodes that represent options.
RangeDeclNode is a placeholder interface for AST nodes that represent numeric values.
RPCDeclNode is a placeholder interface for AST nodes that represent RPC declarations.
RPCElement is an interface implemented by all AST nodes that can appear in the body of an rpc declaration (aka method).
Sequence represents a navigable sequence of elements.
ServiceElement is an interface implemented by all AST nodes that can appear in the body of a service declaration.
SourceSpan represents a range of source positions.
StringValueNode is an AST node that represents a string literal.
TerminalNode represents a leaf in the AST.
ValueNode is an AST node that represents a literal value.
Visitor provides a technique for walking the AST that allows for dynamic dispatch, where a particular function is invoked based on the runtime type of the argument.

# Type aliases

Identifier is a possibly-qualified name.
Item represents an item lexed from source.
KeywordNode is an AST node that represents a keyword.
NoSourceNode is a placeholder AST node that implements numerous interfaces in this package.
SyntheticGroupMessageNode is a view of a GroupNode that implements MessageDeclNode.
SyntheticMapEntryNode is a view of a MapFieldNode that implements MessageDeclNode.
Token represents a single lexed token.
WalkOption represents an option used with the Walk function.