ast

package
v0.0.0-...-6cf7a4f Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2024 License: Apache-2.0 Imports: 16 Imported by: 3

Documentation

Overview

Package ast defines types for modeling the AST (Abstract Syntax Tree) for the Protocol Buffers interface definition language.

Nodes

All nodes of the tree implement the Node interface. Leaf nodes in the tree implement TerminalNode, and all others implement [CompositeNode]. The root of the tree for a proto source file is a *FileNode.

A TerminalNode represents a single lexical element, or Token. A [CompositeNode] represents a sub-tree of the AST and range of tokens.

Position information is tracked using a *FileInfo. The lexer invokes its various Add* methods to add details as the file is tokenized. Storing the position information in the *FileInfo, instead of in each AST node, allows the AST to have a much more compact representation. To extract detailed position information, you must use the NodeInfo method, available on either the *FileInfo which produced the node's items or the *FileNode root of the tree that contains the node.

Items, Tokens, and Comments

An Item represents a lexical item, excluding whitespace. This can be either a Token or a Comment.

Comments are not represented as nodes in the tree. Instead, they are attributed to terminal nodes in the tree. So, when lexing, comments are accumulated until the next non-comment token is found. The AST model in this package thus provides access to all comments in the file, regardless of location (unlike the SourceCodeInfo present in descriptor protos, which is lossy). The comments associated with a non-leaf/non-token node (i.e. a CompositeNode) come from the first and last nodes in its sub-tree, for leading and trailing comments respectively.

A Comment value corresponds to a line ("//") or block ("/*") style comment in the source. These have no bearing on the grammar and are effectively ignored as the parser is determining the shape of the syntax tree.

A Token value corresponds to a component of the grammar, that is used to produce an AST. They correspond to leaves in the AST (i.e. TerminalNode).

The *FileInfo and *FileNode types provide methods for querying and iterating through all the items or tokens in the file. They also include a method for resolving an Item into a Token or Comment.

Factory Functions

Creation of AST nodes should use the factory functions in this package instead of struct literals. Some factory functions accept optional arguments, which means the arguments can be nil. If nil values are provided for other (non-optional) arguments, the resulting node may be invalid and cause panics later in the program.

This package defines numerous interfaces. However, user code should not attempt to implement any of them. Most consumers of an AST will not work correctly if they encounter concrete implementations other than the ones defined in this package.

Index

Constants

View Source
const (
	TokenError   = Token_Error
	TokenUnknown = Token_Unknown
)

Variables

View Source
var (
	Token_name = map[int32]string{
		0:  "Unknown",
		-1: "Error",
	}
	Token_value = map[string]int32{
		"Unknown": 0,
		"Error":   -1,
	}
)

Enum value maps for Token.

View Source
var (
	FileInfo_PositionEncoding_name = map[int32]string{
		0: "PositionEncodingByteOffset",
		1: "PositionEncodingProtocCompatible",
	}
	FileInfo_PositionEncoding_value = map[string]int32{
		"PositionEncodingByteOffset":       0,
		"PositionEncodingProtocCompatible": 1,
	}
)

Enum value maps for FileInfo_PositionEncoding.

View Source
var (
	// optional ast.FileInfo fileInfo = 7;
	E_FileInfo = &file_github_com_kralicky_protocompile_ast_filenode_proto_extTypes[0]
	// optional ast.ExtendedAttributes extendedAttributes = 8;
	E_ExtendedAttributes = &file_github_com_kralicky_protocompile_ast_filenode_proto_extTypes[1]
)

Extension fields to FileNode.

View Source
var EmptyComments = Comments{}

EmptyComments is an empty set of comments.

View Source
var ExtendedSyntaxEnabled = true
View Source
var File_github_com_kralicky_protocompile_ast_ast_proto protoreflect.FileDescriptor
View Source
var File_github_com_kralicky_protocompile_ast_filenode_proto protoreflect.FileDescriptor
View Source
var PragmaKey = "pragma"

Functions

func AsInt32

func AsInt32[T interface{ AsInt64() (int64, bool) }](n T, min, max int32) (int32, bool)

AsInt32 range checks the given int value and returns its value is in the range or 0, false if it is outside the range.

func Clone

func Clone[T Node](n T) T

Clone returns a deep copy of the AST rooted at n. As a special case, when n is a *FileNode, its FileInfo is shared with the original node.

func Inspect

func Inspect(node Node, visit func(Node) bool, opts ...WalkOption)

Inspect traverses an AST in depth-first order: It starts by calling f(node); node must not be nil. If f returns true, Inspect invokes f recursively for each of the non-nil children of node.

func IsCompositeNode

func IsCompositeNode(n Node) bool

func IsNil

func IsNil(n Node) bool

func IsTerminalNode

func IsTerminalNode(n Node) bool

func IsVirtualNode

func IsVirtualNode(n Node) bool

Types

type AnyArrayLiteralElement

type AnyArrayLiteralElement interface {
	Node
	AsArrayLiteralElement() *ArrayLiteralElement
}

type AnyComplexIdentComponent

type AnyComplexIdentComponent interface {
	Node
	AsComplexIdentComponent() *ComplexIdentComponent
}

type AnyEnumElement

type AnyEnumElement interface {
	Node
	AsEnumElement() *EnumElement
}

type AnyExtendElement

type AnyExtendElement interface {
	Node
	AsExtendElement() *ExtendElement
}

type AnyFieldDeclNode

type AnyFieldDeclNode interface {
	Node
	AsFieldDeclNode() *FieldDeclNode
	GetLabel() *IdentNode
	GetName() *IdentNode
	GetFieldTypeNode() Node
	GetTag() *UintLiteralNode
	GetOptions() *CompactOptionsNode
}

type AnyFileElement

type AnyFileElement interface {
	Node
	AsFileElement() *FileElement
}

type AnyFloatValueNode

type AnyFloatValueNode interface {
	Node
	AsFloatValueNode() *FloatValueNode
	AsFloat() float64
}

type AnyIdentValueNode

type AnyIdentValueNode interface {
	Node
	AsIdentValueNode() *IdentValueNode
	AsIdentifier() Identifier
}

type AnyIntValueNode

type AnyIntValueNode interface {
	Node
	AsIntValueNode() *IntValueNode
	AsInt64() (int64, bool)
	AsUint64() (uint64, bool)
	Value() any
}

type AnyMessageDeclNode

type AnyMessageDeclNode interface {
	Node
	AsMessageDeclNode() *MessageDeclNode
	GetName() *IdentNode
}

type AnyMessageElement

type AnyMessageElement interface {
	Node
	AsMessageElement() *MessageElement
}

type AnyOneofElement

type AnyOneofElement interface {
	Node
	AsOneofElement() *OneofElement
}

type AnyRPCElement

type AnyRPCElement interface {
	Node
	AsRPCElement() *RPCElement
}

type AnyRangeElement

type AnyRangeElement interface {
	Node
	AsRangeElement() *RangeElement
}

type AnyReservedElement

type AnyReservedElement interface {
	Node
	AsReservedElement() *ReservedElement
}

type AnyServiceElement

type AnyServiceElement interface {
	Node
	AsServiceElement() *ServiceElement
}

type AnyStringValueNode

type AnyStringValueNode interface {
	Node
	AsStringValueNode() *StringValueNode
	AsString() string
}

type AnyValueNode

type AnyValueNode interface {
	Node
	AsValueNode() *ValueNode
	Value() any
}

type ArrayLiteralElement

type ArrayLiteralElement struct {

	// Types that are assignable to Val:
	//
	//	*ArrayLiteralElement_Value
	//	*ArrayLiteralElement_Comma
	Val isArrayLiteralElement_Val `protobuf_oneof:"val"`
	// contains filtered or unexported fields
}

func (*ArrayLiteralElement) Descriptor deprecated

func (*ArrayLiteralElement) Descriptor() ([]byte, []int)

Deprecated: Use ArrayLiteralElement.ProtoReflect.Descriptor instead.

func (*ArrayLiteralElement) End

func (n *ArrayLiteralElement) End() Token

func (*ArrayLiteralElement) GetComma

func (x *ArrayLiteralElement) GetComma() *RuneNode

func (*ArrayLiteralElement) GetVal

func (m *ArrayLiteralElement) GetVal() isArrayLiteralElement_Val

func (*ArrayLiteralElement) GetValue

func (x *ArrayLiteralElement) GetValue() *ValueNode

func (*ArrayLiteralElement) ProtoMessage

func (*ArrayLiteralElement) ProtoMessage()

func (*ArrayLiteralElement) ProtoPath

func (*ArrayLiteralElement) ProtoPath() arrayLiteralElementPathBuilder

func (*ArrayLiteralElement) ProtoReflect

func (x *ArrayLiteralElement) ProtoReflect() protoreflect.Message

func (*ArrayLiteralElement) Reset

func (x *ArrayLiteralElement) Reset()

func (*ArrayLiteralElement) Start

func (n *ArrayLiteralElement) Start() Token

func (*ArrayLiteralElement) String

func (x *ArrayLiteralElement) String() string

func (*ArrayLiteralElement) Unwrap

type ArrayLiteralElement_Comma

type ArrayLiteralElement_Comma struct {
	Comma *RuneNode `protobuf:"bytes,2,opt,name=comma,proto3,oneof"`
}

type ArrayLiteralElement_Value

type ArrayLiteralElement_Value struct {
	Value *ValueNode `protobuf:"bytes,1,opt,name=value,proto3,oneof"`
}

type ArrayLiteralNode

type ArrayLiteralNode struct {
	OpenBracket  *RuneNode              `protobuf:"bytes,1,opt,name=openBracket,proto3" json:"openBracket,omitempty"`
	Elements     []*ArrayLiteralElement `protobuf:"bytes,2,rep,name=elements,proto3" json:"elements,omitempty"`
	CloseBracket *RuneNode              `protobuf:"bytes,3,opt,name=closeBracket,proto3" json:"closeBracket,omitempty"`
	Semicolon    *RuneNode              `protobuf:"bytes,4,opt,name=semicolon,proto3" json:"semicolon,omitempty"`
	// contains filtered or unexported fields
}

ArrayLiteralNode represents an array literal, which is only allowed inside of a MessageLiteralNode, to indicate values for a repeated field. Example:

["foo", "bar", "baz"]

func (*ArrayLiteralNode) AsValueNode

func (n *ArrayLiteralNode) AsValueNode() *ValueNode

func (*ArrayLiteralNode) Descriptor deprecated

func (*ArrayLiteralNode) Descriptor() ([]byte, []int)

Deprecated: Use ArrayLiteralNode.ProtoReflect.Descriptor instead.

func (*ArrayLiteralNode) End

func (n *ArrayLiteralNode) End() Token

func (*ArrayLiteralNode) FilterValues

func (n *ArrayLiteralNode) FilterValues() []*ValueNode

func (*ArrayLiteralNode) GetCloseBracket

func (x *ArrayLiteralNode) GetCloseBracket() *RuneNode

func (*ArrayLiteralNode) GetElements

func (x *ArrayLiteralNode) GetElements() []*ArrayLiteralElement

func (*ArrayLiteralNode) GetOpenBracket

func (x *ArrayLiteralNode) GetOpenBracket() *RuneNode

func (*ArrayLiteralNode) GetSemicolon

func (x *ArrayLiteralNode) GetSemicolon() *RuneNode

func (*ArrayLiteralNode) ProtoMessage

func (*ArrayLiteralNode) ProtoMessage()

func (*ArrayLiteralNode) ProtoPath

func (*ArrayLiteralNode) ProtoPath() arrayLiteralNodePathBuilder

func (*ArrayLiteralNode) ProtoReflect

func (x *ArrayLiteralNode) ProtoReflect() protoreflect.Message

func (*ArrayLiteralNode) Reset

func (x *ArrayLiteralNode) Reset()

func (*ArrayLiteralNode) Split

func (n *ArrayLiteralNode) Split() ([]*ValueNode, []*RuneNode)

func (*ArrayLiteralNode) Start

func (n *ArrayLiteralNode) Start() Token

func (*ArrayLiteralNode) String

func (x *ArrayLiteralNode) String() string

func (*ArrayLiteralNode) Value

func (n *ArrayLiteralNode) Value() interface{}

type Comment

type Comment struct {
	// contains filtered or unexported fields
}

Comment represents a single comment in a source file. It indicates the position of the comment and its contents. A single comment means one line-style comment ("//" to end of line) or one block comment ("/*" through "*/"). If a longer comment uses multiple line comments, each line is considered to be a separate comment. For example:

// This is a single comment, and
// this is a separate comment.

func (Comment) AsItem

func (c Comment) AsItem() Item

AsItem returns the Item that corresponds to c.

func (Comment) AttributedTo

func (c Comment) AttributedTo() Item

func (Comment) End

func (c Comment) End() SourcePos

TODO: for some reason, this returns the position of the last character in the comment, not the character after the last one, as is the case for tokens. Unsure why this is the case, possibly unintentional?

func (Comment) IsValid

func (c Comment) IsValid() bool

IsValid returns true if this comment is valid. If this comment is a zero-value struct, it is not valid.

func (Comment) IsVirtual

func (c Comment) IsVirtual() bool

func (Comment) LeadingWhitespace

func (c Comment) LeadingWhitespace() string

func (Comment) RawText

func (c Comment) RawText() string

func (Comment) Start

func (c Comment) Start() SourcePos

func (Comment) String

func (c Comment) String() string

func (Comment) VirtualItem

func (c Comment) VirtualItem() Item

type Comments

type Comments struct {
	// contains filtered or unexported fields
}

Comments represents a range of sequential comments in a source file (e.g. no interleaving items or AST nodes).

func (Comments) Index

func (c Comments) Index(i int) Comment

func (Comments) Len

func (c Comments) Len() int

Len returns the number of comments in c.

type CompactOptionsNode

type CompactOptionsNode struct {
	OpenBracket  *RuneNode     `protobuf:"bytes,1,opt,name=openBracket,proto3" json:"openBracket,omitempty"`
	Options      []*OptionNode `protobuf:"bytes,2,rep,name=options,proto3" json:"options,omitempty"`
	CloseBracket *RuneNode     `protobuf:"bytes,3,opt,name=closeBracket,proto3" json:"closeBracket,omitempty"`
	Semicolon    *RuneNode     `protobuf:"bytes,4,opt,name=semicolon,proto3" json:"semicolon,omitempty"`
	// contains filtered or unexported fields
}

CompactOptionsNode represents a compact options declaration, as used with fields, enum values, and extension ranges. Example:

[deprecated = true, json_name = "foo_bar"]

func (*CompactOptionsNode) Descriptor deprecated

func (*CompactOptionsNode) Descriptor() ([]byte, []int)

Deprecated: Use CompactOptionsNode.ProtoReflect.Descriptor instead.

func (*CompactOptionsNode) End

func (e *CompactOptionsNode) End() Token

func (*CompactOptionsNode) GetCloseBracket

func (x *CompactOptionsNode) GetCloseBracket() *RuneNode

func (*CompactOptionsNode) GetElements

func (e *CompactOptionsNode) GetElements() []*OptionNode

func (*CompactOptionsNode) GetOpenBracket

func (x *CompactOptionsNode) GetOpenBracket() *RuneNode

func (*CompactOptionsNode) GetOptions

func (x *CompactOptionsNode) GetOptions() []*OptionNode

func (*CompactOptionsNode) GetSemicolon

func (x *CompactOptionsNode) GetSemicolon() *RuneNode

func (*CompactOptionsNode) ProtoMessage

func (*CompactOptionsNode) ProtoMessage()

func (*CompactOptionsNode) ProtoPath

func (*CompactOptionsNode) ProtoPath() compactOptionsNodePathBuilder

func (*CompactOptionsNode) ProtoReflect

func (x *CompactOptionsNode) ProtoReflect() protoreflect.Message

func (*CompactOptionsNode) Reset

func (x *CompactOptionsNode) Reset()

func (*CompactOptionsNode) Start

func (e *CompactOptionsNode) Start() Token

func (*CompactOptionsNode) String

func (x *CompactOptionsNode) String() string

type ComplexIdentComponent

type ComplexIdentComponent struct {

	// Types that are assignable to Val:
	//
	//	*ComplexIdentComponent_Ident
	//	*ComplexIdentComponent_Dot
	//	*ComplexIdentComponent_FieldRef
	Val isComplexIdentComponent_Val `protobuf_oneof:"val"`
	// contains filtered or unexported fields
}

func (*ComplexIdentComponent) Descriptor deprecated

func (*ComplexIdentComponent) Descriptor() ([]byte, []int)

Deprecated: Use ComplexIdentComponent.ProtoReflect.Descriptor instead.

func (*ComplexIdentComponent) End

func (c *ComplexIdentComponent) End() Token

func (*ComplexIdentComponent) GetDot

func (x *ComplexIdentComponent) GetDot() *RuneNode

func (*ComplexIdentComponent) GetFieldRef

func (x *ComplexIdentComponent) GetFieldRef() *FieldReferenceNode

func (*ComplexIdentComponent) GetIdent

func (x *ComplexIdentComponent) GetIdent() *IdentNode

func (*ComplexIdentComponent) GetVal

func (m *ComplexIdentComponent) GetVal() isComplexIdentComponent_Val

func (*ComplexIdentComponent) ProtoMessage

func (*ComplexIdentComponent) ProtoMessage()

func (*ComplexIdentComponent) ProtoPath

func (*ComplexIdentComponent) ProtoPath() complexIdentComponentPathBuilder

func (*ComplexIdentComponent) ProtoReflect

func (x *ComplexIdentComponent) ProtoReflect() protoreflect.Message

func (*ComplexIdentComponent) Reset

func (x *ComplexIdentComponent) Reset()

func (*ComplexIdentComponent) Start

func (c *ComplexIdentComponent) Start() Token

func (*ComplexIdentComponent) String

func (x *ComplexIdentComponent) String() string

func (*ComplexIdentComponent) Unwrap

type ComplexIdentComponent_Dot

type ComplexIdentComponent_Dot struct {
	Dot *RuneNode `protobuf:"bytes,2,opt,name=dot,proto3,oneof"`
}

type ComplexIdentComponent_FieldRef

type ComplexIdentComponent_FieldRef struct {
	FieldRef *FieldReferenceNode `protobuf:"bytes,3,opt,name=fieldRef,proto3,oneof"`
}

type ComplexIdentComponent_Ident

type ComplexIdentComponent_Ident struct {
	Ident *IdentNode `protobuf:"bytes,1,opt,name=ident,proto3,oneof"`
}

type CompoundIdentNode

type CompoundIdentNode struct {

	// List of components in the compound identifier in token order. Values in
	// this list are either idents or dots.
	Components []*ComplexIdentComponent `protobuf:"bytes,1,rep,name=components,proto3" json:"components,omitempty"`
	// contains filtered or unexported fields
}

CompoundIdentNode represents a qualified identifier. A qualified identifier has at least one dot and possibly multiple identifier names (all separated by dots). If the identifier has a leading dot, then it is a *fully* qualified identifier. Example:

.com.foobar.Baz

func (*CompoundIdentNode) AsIdentValueNode

func (n *CompoundIdentNode) AsIdentValueNode() *IdentValueNode

func (*CompoundIdentNode) AsIdentifier

func (n *CompoundIdentNode) AsIdentifier() Identifier

func (*CompoundIdentNode) AsValueNode

func (n *CompoundIdentNode) AsValueNode() *ValueNode

func (*CompoundIdentNode) Descriptor deprecated

func (*CompoundIdentNode) Descriptor() ([]byte, []int)

Deprecated: Use CompoundIdentNode.ProtoReflect.Descriptor instead.

func (*CompoundIdentNode) End

func (n *CompoundIdentNode) End() Token

func (*CompoundIdentNode) FilterIdents

func (n *CompoundIdentNode) FilterIdents() []*IdentNode

func (*CompoundIdentNode) GetComponents

func (x *CompoundIdentNode) GetComponents() []*ComplexIdentComponent

func (*CompoundIdentNode) ProtoMessage

func (*CompoundIdentNode) ProtoMessage()

func (*CompoundIdentNode) ProtoPath

func (*CompoundIdentNode) ProtoPath() compoundIdentNodePathBuilder

func (*CompoundIdentNode) ProtoReflect

func (x *CompoundIdentNode) ProtoReflect() protoreflect.Message

func (*CompoundIdentNode) Reset

func (x *CompoundIdentNode) Reset()

func (*CompoundIdentNode) Split

func (n *CompoundIdentNode) Split() (idents []*IdentNode, dots []*RuneNode)

func (*CompoundIdentNode) Start

func (n *CompoundIdentNode) Start() Token

func (*CompoundIdentNode) String

func (x *CompoundIdentNode) String() string

func (*CompoundIdentNode) Value

func (n *CompoundIdentNode) Value() interface{}

type CompoundStringLiteralNode

type CompoundStringLiteralNode struct {
	Elements []*StringValueNode `protobuf:"bytes,1,rep,name=elements,proto3" json:"elements,omitempty"`
	// contains filtered or unexported fields
}

CompoundStringLiteralNode represents a compound string literal, which is the concatenaton of adjacent string literals. Example:

"this "  "is"   " all one "   "string"

func (*CompoundStringLiteralNode) AsString

func (n *CompoundStringLiteralNode) AsString() string

func (*CompoundStringLiteralNode) AsStringValueNode

func (n *CompoundStringLiteralNode) AsStringValueNode() *StringValueNode

func (*CompoundStringLiteralNode) AsValueNode

func (n *CompoundStringLiteralNode) AsValueNode() *ValueNode

func (*CompoundStringLiteralNode) Descriptor deprecated

func (*CompoundStringLiteralNode) Descriptor() ([]byte, []int)

Deprecated: Use CompoundStringLiteralNode.ProtoReflect.Descriptor instead.

func (*CompoundStringLiteralNode) End

func (*CompoundStringLiteralNode) GetElements

func (x *CompoundStringLiteralNode) GetElements() []*StringValueNode

func (*CompoundStringLiteralNode) ProtoMessage

func (*CompoundStringLiteralNode) ProtoMessage()

func (*CompoundStringLiteralNode) ProtoPath

func (*CompoundStringLiteralNode) ProtoPath() compoundStringLiteralNodePathBuilder

func (*CompoundStringLiteralNode) ProtoReflect

func (*CompoundStringLiteralNode) Reset

func (x *CompoundStringLiteralNode) Reset()

func (*CompoundStringLiteralNode) Start

func (n *CompoundStringLiteralNode) Start() Token

func (*CompoundStringLiteralNode) String

func (x *CompoundStringLiteralNode) String() string

func (*CompoundStringLiteralNode) Value

func (n *CompoundStringLiteralNode) Value() interface{}

type EditionNode

type EditionNode struct {
	Keyword   *IdentNode       `protobuf:"bytes,1,opt,name=keyword,proto3" json:"keyword,omitempty"`
	Equals    *RuneNode        `protobuf:"bytes,2,opt,name=equals,proto3" json:"equals,omitempty"`
	Edition   *StringValueNode `protobuf:"bytes,3,opt,name=edition,proto3" json:"edition,omitempty"`
	Semicolon *RuneNode        `protobuf:"bytes,4,opt,name=semicolon,proto3" json:"semicolon,omitempty"`
	// contains filtered or unexported fields
}

EditionNode represents an edition declaration, which if present must be the first non-comment content. Example:

edition = "2023";

Files may include either an edition node or a syntax node, but not both. If neither are present, the file is assumed to use proto2 syntax.

func (*EditionNode) Descriptor deprecated

func (*EditionNode) Descriptor() ([]byte, []int)

Deprecated: Use EditionNode.ProtoReflect.Descriptor instead.

func (*EditionNode) End

func (m *EditionNode) End() Token

func (*EditionNode) GetEdition

func (x *EditionNode) GetEdition() *StringValueNode

func (*EditionNode) GetEquals

func (x *EditionNode) GetEquals() *RuneNode

func (*EditionNode) GetKeyword

func (x *EditionNode) GetKeyword() *IdentNode

func (*EditionNode) GetSemicolon

func (x *EditionNode) GetSemicolon() *RuneNode

func (*EditionNode) ProtoMessage

func (*EditionNode) ProtoMessage()

func (*EditionNode) ProtoPath

func (*EditionNode) ProtoPath() editionNodePathBuilder

func (*EditionNode) ProtoReflect

func (x *EditionNode) ProtoReflect() protoreflect.Message

func (*EditionNode) Reset

func (x *EditionNode) Reset()

func (*EditionNode) Start

func (m *EditionNode) Start() Token

func (*EditionNode) String

func (x *EditionNode) String() string

type EmptyDeclNode

type EmptyDeclNode struct {
	Semicolon *RuneNode `protobuf:"bytes,1,opt,name=semicolon,proto3" json:"semicolon,omitempty"`
	// contains filtered or unexported fields
}

EmptyDeclNode represents an empty declaration in protobuf source. These amount to extra semicolons, with no actual content preceding the semicolon.

func NewEmptyDeclNode

func NewEmptyDeclNode(semicolon *RuneNode) *EmptyDeclNode

NewEmptyDeclNode creates a new *EmptyDeclNode. The one argument must be non-nil.

func (*EmptyDeclNode) AsExtendElement

func (n *EmptyDeclNode) AsExtendElement() *ExtendElement

func (*EmptyDeclNode) AsMessageElement

func (n *EmptyDeclNode) AsMessageElement() *MessageElement

func (*EmptyDeclNode) Descriptor deprecated

func (*EmptyDeclNode) Descriptor() ([]byte, []int)

Deprecated: Use EmptyDeclNode.ProtoReflect.Descriptor instead.

func (*EmptyDeclNode) End

func (e *EmptyDeclNode) End() Token

func (*EmptyDeclNode) GetSemicolon

func (x *EmptyDeclNode) GetSemicolon() *RuneNode

func (*EmptyDeclNode) ProtoMessage

func (*EmptyDeclNode) ProtoMessage()

func (*EmptyDeclNode) ProtoPath

func (*EmptyDeclNode) ProtoPath() emptyDeclNodePathBuilder

func (*EmptyDeclNode) ProtoReflect

func (x *EmptyDeclNode) ProtoReflect() protoreflect.Message

func (*EmptyDeclNode) Reset

func (x *EmptyDeclNode) Reset()

func (*EmptyDeclNode) Start

func (e *EmptyDeclNode) Start() Token

func (*EmptyDeclNode) String

func (x *EmptyDeclNode) String() string

type EnumElement

type EnumElement struct {

	// Types that are assignable to Val:
	//
	//	*EnumElement_Option
	//	*EnumElement_EnumValue
	//	*EnumElement_Reserved
	Val isEnumElement_Val `protobuf_oneof:"val"`
	// contains filtered or unexported fields
}

EnumElement is an interface implemented by all AST nodes that can appear in the body of an enum declaration.

func (*EnumElement) Descriptor deprecated

func (*EnumElement) Descriptor() ([]byte, []int)

Deprecated: Use EnumElement.ProtoReflect.Descriptor instead.

func (*EnumElement) End

func (n *EnumElement) End() Token

func (*EnumElement) GetEnumValue

func (x *EnumElement) GetEnumValue() *EnumValueNode

func (*EnumElement) GetOption

func (x *EnumElement) GetOption() *OptionNode

func (*EnumElement) GetReserved

func (x *EnumElement) GetReserved() *ReservedNode

func (*EnumElement) GetVal

func (m *EnumElement) GetVal() isEnumElement_Val

func (*EnumElement) ProtoMessage

func (*EnumElement) ProtoMessage()

func (*EnumElement) ProtoPath

func (*EnumElement) ProtoPath() enumElementPathBuilder

func (*EnumElement) ProtoReflect

func (x *EnumElement) ProtoReflect() protoreflect.Message

func (*EnumElement) Reset

func (x *EnumElement) Reset()

func (*EnumElement) Start

func (n *EnumElement) Start() Token

func (*EnumElement) String

func (x *EnumElement) String() string

func (*EnumElement) Unwrap

func (n *EnumElement) Unwrap() AnyEnumElement

type EnumElement_EnumValue

type EnumElement_EnumValue struct {
	EnumValue *EnumValueNode `protobuf:"bytes,2,opt,name=enumValue,proto3,oneof"`
}

type EnumElement_Option

type EnumElement_Option struct {
	Option *OptionNode `protobuf:"bytes,1,opt,name=option,proto3,oneof"`
}

type EnumElement_Reserved

type EnumElement_Reserved struct {
	Reserved *ReservedNode `protobuf:"bytes,3,opt,name=reserved,proto3,oneof"`
}

type EnumNode

type EnumNode struct {
	Keyword    *IdentNode     `protobuf:"bytes,1,opt,name=keyword,proto3" json:"keyword,omitempty"`
	Name       *IdentNode     `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	OpenBrace  *RuneNode      `protobuf:"bytes,3,opt,name=openBrace,proto3" json:"openBrace,omitempty"`
	Decls      []*EnumElement `protobuf:"bytes,4,rep,name=decls,proto3" json:"decls,omitempty"`
	CloseBrace *RuneNode      `protobuf:"bytes,5,opt,name=closeBrace,proto3" json:"closeBrace,omitempty"`
	Semicolon  *RuneNode      `protobuf:"bytes,6,opt,name=semicolon,proto3" json:"semicolon,omitempty"`
	// contains filtered or unexported fields
}

EnumNode represents an enum declaration. Example:

enum Foo { BAR = 0; BAZ = 1 }

func (*EnumNode) AsFileElement

func (n *EnumNode) AsFileElement() *FileElement

func (*EnumNode) AsMessageElement

func (n *EnumNode) AsMessageElement() *MessageElement

func (*EnumNode) Descriptor deprecated

func (*EnumNode) Descriptor() ([]byte, []int)

Deprecated: Use EnumNode.ProtoReflect.Descriptor instead.

func (*EnumNode) End

func (e *EnumNode) End() Token

func (*EnumNode) GetCloseBrace

func (x *EnumNode) GetCloseBrace() *RuneNode

func (*EnumNode) GetDecls

func (x *EnumNode) GetDecls() []*EnumElement

func (*EnumNode) GetElements

func (n *EnumNode) GetElements() []*EnumElement

func (*EnumNode) GetKeyword

func (x *EnumNode) GetKeyword() *IdentNode

func (*EnumNode) GetName

func (x *EnumNode) GetName() *IdentNode

func (*EnumNode) GetOpenBrace

func (x *EnumNode) GetOpenBrace() *RuneNode

func (*EnumNode) GetSemicolon

func (x *EnumNode) GetSemicolon() *RuneNode

func (*EnumNode) ProtoMessage

func (*EnumNode) ProtoMessage()

func (*EnumNode) ProtoPath

func (*EnumNode) ProtoPath() enumNodePathBuilder

func (*EnumNode) ProtoReflect

func (x *EnumNode) ProtoReflect() protoreflect.Message

func (*EnumNode) Reset

func (x *EnumNode) Reset()

func (*EnumNode) Start

func (e *EnumNode) Start() Token

func (*EnumNode) String

func (x *EnumNode) String() string

type EnumValueNode

type EnumValueNode struct {
	Name      *IdentNode          `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Equals    *RuneNode           `protobuf:"bytes,2,opt,name=equals,proto3" json:"equals,omitempty"`
	Number    *IntValueNode       `protobuf:"bytes,3,opt,name=number,proto3" json:"number,omitempty"`
	Options   *CompactOptionsNode `protobuf:"bytes,4,opt,name=options,proto3" json:"options,omitempty"`
	Semicolon *RuneNode           `protobuf:"bytes,5,opt,name=semicolon,proto3" json:"semicolon,omitempty"`
	// contains filtered or unexported fields
}

func (*EnumValueNode) AsEnumElement

func (n *EnumValueNode) AsEnumElement() *EnumElement

func (*EnumValueNode) Descriptor deprecated

func (*EnumValueNode) Descriptor() ([]byte, []int)

Deprecated: Use EnumValueNode.ProtoReflect.Descriptor instead.

func (*EnumValueNode) End

func (e *EnumValueNode) End() Token

func (*EnumValueNode) GetEquals

func (x *EnumValueNode) GetEquals() *RuneNode

func (*EnumValueNode) GetName

func (x *EnumValueNode) GetName() *IdentNode

func (*EnumValueNode) GetNumber

func (x *EnumValueNode) GetNumber() *IntValueNode

func (*EnumValueNode) GetOptions

func (x *EnumValueNode) GetOptions() *CompactOptionsNode

func (*EnumValueNode) GetSemicolon

func (x *EnumValueNode) GetSemicolon() *RuneNode

func (*EnumValueNode) ProtoMessage

func (*EnumValueNode) ProtoMessage()

func (*EnumValueNode) ProtoPath

func (*EnumValueNode) ProtoPath() enumValueNodePathBuilder

func (*EnumValueNode) ProtoReflect

func (x *EnumValueNode) ProtoReflect() protoreflect.Message

func (*EnumValueNode) Reset

func (x *EnumValueNode) Reset()

func (*EnumValueNode) Start

func (e *EnumValueNode) Start() Token

func (*EnumValueNode) String

func (x *EnumValueNode) String() string

type ErrorNode

type ErrorNode struct {
	Err *IdentNode `protobuf:"bytes,1,opt,name=err,proto3" json:"err,omitempty"`
	// contains filtered or unexported fields
}

func (*ErrorNode) AsFileElement

func (n *ErrorNode) AsFileElement() *FileElement

func (*ErrorNode) Descriptor deprecated

func (*ErrorNode) Descriptor() ([]byte, []int)

Deprecated: Use ErrorNode.ProtoReflect.Descriptor instead.

func (*ErrorNode) End

func (e *ErrorNode) End() Token

func (*ErrorNode) GetErr

func (x *ErrorNode) GetErr() *IdentNode

func (*ErrorNode) ProtoMessage

func (*ErrorNode) ProtoMessage()

func (*ErrorNode) ProtoPath

func (*ErrorNode) ProtoPath() errorNodePathBuilder

func (*ErrorNode) ProtoReflect

func (x *ErrorNode) ProtoReflect() protoreflect.Message

func (*ErrorNode) Reset

func (x *ErrorNode) Reset()

func (*ErrorNode) Start

func (e *ErrorNode) Start() Token

func (*ErrorNode) String

func (x *ErrorNode) String() string

type ExtendElement

type ExtendElement struct {

	// Types that are assignable to Val:
	//
	//	*ExtendElement_Field
	//	*ExtendElement_Group
	//	*ExtendElement_Empty
	Val isExtendElement_Val `protobuf_oneof:"val"`
	// contains filtered or unexported fields
}

ExtendElement is an interface implemented by all AST nodes that can appear in an extend body.

func (*ExtendElement) Descriptor deprecated

func (*ExtendElement) Descriptor() ([]byte, []int)

Deprecated: Use ExtendElement.ProtoReflect.Descriptor instead.

func (*ExtendElement) End

func (n *ExtendElement) End() Token

func (*ExtendElement) GetEmpty

func (x *ExtendElement) GetEmpty() *EmptyDeclNode

func (*ExtendElement) GetField

func (x *ExtendElement) GetField() *FieldNode

func (*ExtendElement) GetGroup

func (x *ExtendElement) GetGroup() *GroupNode

func (*ExtendElement) GetVal

func (m *ExtendElement) GetVal() isExtendElement_Val

func (*ExtendElement) ProtoMessage

func (*ExtendElement) ProtoMessage()

func (*ExtendElement) ProtoPath

func (*ExtendElement) ProtoPath() extendElementPathBuilder

func (*ExtendElement) ProtoReflect

func (x *ExtendElement) ProtoReflect() protoreflect.Message

func (*ExtendElement) Reset

func (x *ExtendElement) Reset()

func (*ExtendElement) Start

func (n *ExtendElement) Start() Token

func (*ExtendElement) String

func (x *ExtendElement) String() string

func (*ExtendElement) Unwrap

func (n *ExtendElement) Unwrap() AnyExtendElement

type ExtendElement_Empty

type ExtendElement_Empty struct {
	Empty *EmptyDeclNode `protobuf:"bytes,3,opt,name=empty,proto3,oneof"`
}

type ExtendElement_Field

type ExtendElement_Field struct {
	Field *FieldNode `protobuf:"bytes,1,opt,name=field,proto3,oneof"`
}

type ExtendElement_Group

type ExtendElement_Group struct {
	Group *GroupNode `protobuf:"bytes,2,opt,name=group,proto3,oneof"`
}

type ExtendNode

type ExtendNode struct {
	Keyword    *IdentNode       `protobuf:"bytes,1,opt,name=keyword,proto3" json:"keyword,omitempty"`
	Extendee   *IdentValueNode  `protobuf:"bytes,2,opt,name=extendee,proto3" json:"extendee,omitempty"`
	OpenBrace  *RuneNode        `protobuf:"bytes,3,opt,name=openBrace,proto3" json:"openBrace,omitempty"`
	Decls      []*ExtendElement `protobuf:"bytes,4,rep,name=decls,proto3" json:"decls,omitempty"`
	CloseBrace *RuneNode        `protobuf:"bytes,5,opt,name=closeBrace,proto3" json:"closeBrace,omitempty"`
	Semicolon  *RuneNode        `protobuf:"bytes,6,opt,name=semicolon,proto3" json:"semicolon,omitempty"`
	// contains filtered or unexported fields
}

ExtendNode represents a declaration of extension fields. Example:

extend google.protobuf.FieldOptions {
  bool redacted = 33333;
}

func (*ExtendNode) AsFileElement

func (n *ExtendNode) AsFileElement() *FileElement

func (*ExtendNode) AsMessageElement

func (n *ExtendNode) AsMessageElement() *MessageElement

func (*ExtendNode) Descriptor deprecated

func (*ExtendNode) Descriptor() ([]byte, []int)

Deprecated: Use ExtendNode.ProtoReflect.Descriptor instead.

func (*ExtendNode) End

func (e *ExtendNode) End() Token

func (*ExtendNode) GetCloseBrace

func (x *ExtendNode) GetCloseBrace() *RuneNode

func (*ExtendNode) GetDecls

func (x *ExtendNode) GetDecls() []*ExtendElement

func (*ExtendNode) GetElements

func (e *ExtendNode) GetElements() []*ExtendElement

func (*ExtendNode) GetExtendee

func (x *ExtendNode) GetExtendee() *IdentValueNode

func (*ExtendNode) GetKeyword

func (x *ExtendNode) GetKeyword() *IdentNode

func (*ExtendNode) GetOpenBrace

func (x *ExtendNode) GetOpenBrace() *RuneNode

func (*ExtendNode) GetSemicolon

func (x *ExtendNode) GetSemicolon() *RuneNode

func (*ExtendNode) IsIncomplete

func (e *ExtendNode) IsIncomplete() bool

func (*ExtendNode) ProtoMessage

func (*ExtendNode) ProtoMessage()

func (*ExtendNode) ProtoPath

func (*ExtendNode) ProtoPath() extendNodePathBuilder

func (*ExtendNode) ProtoReflect

func (x *ExtendNode) ProtoReflect() protoreflect.Message

func (*ExtendNode) Reset

func (x *ExtendNode) Reset()

func (*ExtendNode) Start

func (e *ExtendNode) Start() Token

func (*ExtendNode) String

func (x *ExtendNode) String() string

type ExtendedAttributes

type ExtendedAttributes struct {
	Pragmas map[string]string `` /* 134-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*ExtendedAttributes) Descriptor deprecated

func (*ExtendedAttributes) Descriptor() ([]byte, []int)

Deprecated: Use ExtendedAttributes.ProtoReflect.Descriptor instead.

func (*ExtendedAttributes) GetPragmas

func (x *ExtendedAttributes) GetPragmas() map[string]string

func (*ExtendedAttributes) ProtoMessage

func (*ExtendedAttributes) ProtoMessage()

func (*ExtendedAttributes) ProtoReflect

func (x *ExtendedAttributes) ProtoReflect() protoreflect.Message

func (*ExtendedAttributes) Reset

func (x *ExtendedAttributes) Reset()

func (*ExtendedAttributes) String

func (x *ExtendedAttributes) String() string

type ExtensionRangeNode

type ExtensionRangeNode struct {
	Keyword   *IdentNode          `protobuf:"bytes,1,opt,name=keyword,proto3" json:"keyword,omitempty"`
	Elements  []*RangeElement     `protobuf:"bytes,2,rep,name=elements,proto3" json:"elements,omitempty"`
	Options   *CompactOptionsNode `protobuf:"bytes,4,opt,name=options,proto3" json:"options,omitempty"`
	Semicolon *RuneNode           `protobuf:"bytes,5,opt,name=semicolon,proto3" json:"semicolon,omitempty"`
	// contains filtered or unexported fields
}

ExtensionRangeNode represents an extension range declaration in an extendable message. Example:

extensions 100 to max;

func (*ExtensionRangeNode) AsMessageElement

func (n *ExtensionRangeNode) AsMessageElement() *MessageElement

func (*ExtensionRangeNode) Descriptor deprecated

func (*ExtensionRangeNode) Descriptor() ([]byte, []int)

Deprecated: Use ExtensionRangeNode.ProtoReflect.Descriptor instead.

func (*ExtensionRangeNode) End

func (e *ExtensionRangeNode) End() Token

func (*ExtensionRangeNode) FilterCommas

func (r *ExtensionRangeNode) FilterCommas() []*RuneNode

func (*ExtensionRangeNode) FilterRanges

func (r *ExtensionRangeNode) FilterRanges() []*RangeNode

func (*ExtensionRangeNode) GetElements

func (x *ExtensionRangeNode) GetElements() []*RangeElement

func (*ExtensionRangeNode) GetKeyword

func (x *ExtensionRangeNode) GetKeyword() *IdentNode

func (*ExtensionRangeNode) GetOptions

func (x *ExtensionRangeNode) GetOptions() *CompactOptionsNode

func (*ExtensionRangeNode) GetSemicolon

func (x *ExtensionRangeNode) GetSemicolon() *RuneNode

func (*ExtensionRangeNode) ProtoMessage

func (*ExtensionRangeNode) ProtoMessage()

func (*ExtensionRangeNode) ProtoPath

func (*ExtensionRangeNode) ProtoPath() extensionRangeNodePathBuilder

func (*ExtensionRangeNode) ProtoReflect

func (x *ExtensionRangeNode) ProtoReflect() protoreflect.Message

func (*ExtensionRangeNode) Reset

func (x *ExtensionRangeNode) Reset()

func (*ExtensionRangeNode) Start

func (e *ExtensionRangeNode) Start() Token

func (*ExtensionRangeNode) String

func (x *ExtensionRangeNode) String() string

type FieldDeclNode

type FieldDeclNode struct {

	// Types that are assignable to Val:
	//
	//	*FieldDeclNode_Field
	//	*FieldDeclNode_MapField
	//	*FieldDeclNode_SyntheticMapField
	//	*FieldDeclNode_Group
	Val isFieldDeclNode_Val `protobuf_oneof:"val"`
	// contains filtered or unexported fields
}

FieldDeclNode is a node in the AST that defines a field. This includes normal message fields as well as extensions. There are multiple types of AST nodes that declare fields:

  • *FieldNode
  • *GroupNode
  • *MapFieldNode
  • *SyntheticMapField

func (*FieldDeclNode) Descriptor deprecated

func (*FieldDeclNode) Descriptor() ([]byte, []int)

Deprecated: Use FieldDeclNode.ProtoReflect.Descriptor instead.

func (*FieldDeclNode) End

func (f *FieldDeclNode) End() Token

func (*FieldDeclNode) GetField

func (x *FieldDeclNode) GetField() *FieldNode

func (*FieldDeclNode) GetFieldTypeNode

func (f *FieldDeclNode) GetFieldTypeNode() Node

func (*FieldDeclNode) GetGroup

func (x *FieldDeclNode) GetGroup() *GroupNode

func (*FieldDeclNode) GetLabel

func (f *FieldDeclNode) GetLabel() *IdentNode

func (*FieldDeclNode) GetMapField

func (x *FieldDeclNode) GetMapField() *MapFieldNode

func (*FieldDeclNode) GetName

func (f *FieldDeclNode) GetName() *IdentNode

func (*FieldDeclNode) GetOptions

func (f *FieldDeclNode) GetOptions() *CompactOptionsNode

func (*FieldDeclNode) GetSyntheticMapField

func (x *FieldDeclNode) GetSyntheticMapField() *SyntheticMapField

func (*FieldDeclNode) GetTag

func (f *FieldDeclNode) GetTag() *UintLiteralNode

func (*FieldDeclNode) GetVal

func (m *FieldDeclNode) GetVal() isFieldDeclNode_Val

func (*FieldDeclNode) ProtoMessage

func (*FieldDeclNode) ProtoMessage()

func (*FieldDeclNode) ProtoPath

func (*FieldDeclNode) ProtoPath() fieldDeclNodePathBuilder

func (*FieldDeclNode) ProtoReflect

func (x *FieldDeclNode) ProtoReflect() protoreflect.Message

func (*FieldDeclNode) Reset

func (x *FieldDeclNode) Reset()

func (*FieldDeclNode) Start

func (f *FieldDeclNode) Start() Token

func (*FieldDeclNode) String

func (x *FieldDeclNode) String() string

func (*FieldDeclNode) Unwrap

func (f *FieldDeclNode) Unwrap() AnyFieldDeclNode

type FieldDeclNode_Field

type FieldDeclNode_Field struct {
	Field *FieldNode `protobuf:"bytes,1,opt,name=field,proto3,oneof"`
}

type FieldDeclNode_Group

type FieldDeclNode_Group struct {
	Group *GroupNode `protobuf:"bytes,4,opt,name=group,proto3,oneof"`
}

type FieldDeclNode_MapField

type FieldDeclNode_MapField struct {
	MapField *MapFieldNode `protobuf:"bytes,2,opt,name=mapField,proto3,oneof"`
}

type FieldDeclNode_SyntheticMapField

type FieldDeclNode_SyntheticMapField struct {
	SyntheticMapField *SyntheticMapField `protobuf:"bytes,3,opt,name=syntheticMapField,proto3,oneof"`
}

type FieldNode

type FieldNode struct {
	Label     *IdentNode          `protobuf:"bytes,1,opt,name=label,proto3" json:"label,omitempty"`
	FieldType *IdentValueNode     `protobuf:"bytes,2,opt,name=fieldType,proto3" json:"fieldType,omitempty"`
	Name      *IdentNode          `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
	Equals    *RuneNode           `protobuf:"bytes,4,opt,name=equals,proto3" json:"equals,omitempty"`
	Tag       *UintLiteralNode    `protobuf:"bytes,5,opt,name=tag,proto3" json:"tag,omitempty"`
	Options   *CompactOptionsNode `protobuf:"bytes,6,opt,name=options,proto3" json:"options,omitempty"`
	Semicolon *RuneNode           `protobuf:"bytes,7,opt,name=semicolon,proto3" json:"semicolon,omitempty"`
	// contains filtered or unexported fields
}

FieldNode represents a normal field declaration (not groups or maps). It can represent extension fields as well as non-extension fields (both inside of messages and inside of one-ofs). Example:

optional string foo = 1;

func (*FieldNode) AsExtendElement

func (n *FieldNode) AsExtendElement() *ExtendElement

func (*FieldNode) AsFieldDeclNode

func (n *FieldNode) AsFieldDeclNode() *FieldDeclNode

func (*FieldNode) AsMessageElement

func (n *FieldNode) AsMessageElement() *MessageElement

func (*FieldNode) AsOneofElement

func (n *FieldNode) AsOneofElement() *OneofElement

func (*FieldNode) Descriptor deprecated

func (*FieldNode) Descriptor() ([]byte, []int)

Deprecated: Use FieldNode.ProtoReflect.Descriptor instead.

func (*FieldNode) End

func (n *FieldNode) End() Token

func (*FieldNode) GetEquals

func (x *FieldNode) GetEquals() *RuneNode

func (*FieldNode) GetFieldType

func (x *FieldNode) GetFieldType() *IdentValueNode

func (*FieldNode) GetFieldTypeNode

func (n *FieldNode) GetFieldTypeNode() Node

func (*FieldNode) GetLabel

func (x *FieldNode) GetLabel() *IdentNode

func (*FieldNode) GetName

func (x *FieldNode) GetName() *IdentNode

func (*FieldNode) GetOptions

func (x *FieldNode) GetOptions() *CompactOptionsNode

func (*FieldNode) GetSemicolon

func (x *FieldNode) GetSemicolon() *RuneNode

func (*FieldNode) GetTag

func (x *FieldNode) GetTag() *UintLiteralNode

func (*FieldNode) IsIncomplete

func (n *FieldNode) IsIncomplete() bool

func (*FieldNode) ProtoMessage

func (*FieldNode) ProtoMessage()

func (*FieldNode) ProtoPath

func (*FieldNode) ProtoPath() fieldNodePathBuilder

func (*FieldNode) ProtoReflect

func (x *FieldNode) ProtoReflect() protoreflect.Message

func (*FieldNode) Reset

func (x *FieldNode) Reset()

func (*FieldNode) Start

func (n *FieldNode) Start() Token

func (*FieldNode) String

func (x *FieldNode) String() string

type FieldReferenceNode

type FieldReferenceNode struct {
	Open      *RuneNode       `protobuf:"bytes,1,opt,name=open,proto3" json:"open,omitempty"`           // only present for extension names and "any" type references
	UrlPrefix *IdentValueNode `protobuf:"bytes,2,opt,name=urlPrefix,proto3" json:"urlPrefix,omitempty"` // only present for "any" type references
	Slash     *RuneNode       `protobuf:"bytes,3,opt,name=slash,proto3" json:"slash,omitempty"`         // only present for "any" type references
	Name      *IdentValueNode `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"`
	Comma     *RuneNode       `protobuf:"bytes,5,opt,name=comma,proto3" json:"comma,omitempty"`         // only present for extension names and "any" type references
	Close     *RuneNode       `protobuf:"bytes,6,opt,name=close,proto3" json:"close,omitempty"`         // only present for extension names and "any" type references
	Semicolon *RuneNode       `protobuf:"bytes,7,opt,name=semicolon,proto3" json:"semicolon,omitempty"` // only present for extension names and "any" type references
	// contains filtered or unexported fields
}

FieldReferenceNode is a reference to a field name. It can indicate a regular field (simple unqualified name), an extension field (possibly-qualified name that is enclosed either in brackets or parentheses), or an "any" type reference (a type URL in the form "server.host/fully.qualified.Name" that is enclosed in brackets).

Extension names are used in options to refer to custom options (which are actually extensions), in which case the name is enclosed in parentheses "(" and ")". They can also be used to refer to extension fields of options.

Extension names are also used in message literals to set extension fields, in which case the name is enclosed in square brackets "[" and "]".

"Any" type references can only be used in message literals, and are not allowed in option names. They are always enclosed in square brackets. An "any" type reference is distinguished from an extension name by the presence of a slash, which must be present in an "any" type reference and must be absent in an extension name.

Examples:

foobar
(foo.bar)
[foo.bar]
[type.googleapis.com/foo.bar]

func (*FieldReferenceNode) AsComplexIdentComponent

func (n *FieldReferenceNode) AsComplexIdentComponent() *ComplexIdentComponent

func (*FieldReferenceNode) Descriptor deprecated

func (*FieldReferenceNode) Descriptor() ([]byte, []int)

Deprecated: Use FieldReferenceNode.ProtoReflect.Descriptor instead.

func (*FieldReferenceNode) End

func (a *FieldReferenceNode) End() Token

func (*FieldReferenceNode) GetClose

func (x *FieldReferenceNode) GetClose() *RuneNode

func (*FieldReferenceNode) GetComma

func (x *FieldReferenceNode) GetComma() *RuneNode

func (*FieldReferenceNode) GetName

func (x *FieldReferenceNode) GetName() *IdentValueNode

func (*FieldReferenceNode) GetOpen

func (x *FieldReferenceNode) GetOpen() *RuneNode

func (*FieldReferenceNode) GetSemicolon

func (x *FieldReferenceNode) GetSemicolon() *RuneNode

func (*FieldReferenceNode) GetSlash

func (x *FieldReferenceNode) GetSlash() *RuneNode

func (*FieldReferenceNode) GetUrlPrefix

func (x *FieldReferenceNode) GetUrlPrefix() *IdentValueNode

func (*FieldReferenceNode) IsAnyTypeReference

func (a *FieldReferenceNode) IsAnyTypeReference() bool

IsAnyTypeReference reports if this is an Any type reference.

func (*FieldReferenceNode) IsExtension

func (a *FieldReferenceNode) IsExtension() bool

IsExtension reports if this is an extension name or not (e.g. enclosed in punctuation, such as parentheses or brackets).

func (*FieldReferenceNode) IsIncomplete

func (a *FieldReferenceNode) IsIncomplete() bool

func (*FieldReferenceNode) ProtoMessage

func (*FieldReferenceNode) ProtoMessage()

func (*FieldReferenceNode) ProtoPath

func (*FieldReferenceNode) ProtoPath() fieldReferenceNodePathBuilder

func (*FieldReferenceNode) ProtoReflect

func (x *FieldReferenceNode) ProtoReflect() protoreflect.Message

func (*FieldReferenceNode) Reset

func (x *FieldReferenceNode) Reset()

func (*FieldReferenceNode) Start

func (a *FieldReferenceNode) Start() Token

func (*FieldReferenceNode) String

func (x *FieldReferenceNode) String() string

func (*FieldReferenceNode) Value

func (a *FieldReferenceNode) Value() string

type FileElement

type FileElement struct {

	// Types that are assignable to Val:
	//
	//	*FileElement_Import
	//	*FileElement_Package
	//	*FileElement_Option
	//	*FileElement_Message
	//	*FileElement_Enum
	//	*FileElement_Extend
	//	*FileElement_Service
	//	*FileElement_Err
	Val isFileElement_Val `protobuf_oneof:"val"`
	// contains filtered or unexported fields
}

func (*FileElement) Descriptor deprecated

func (*FileElement) Descriptor() ([]byte, []int)

Deprecated: Use FileElement.ProtoReflect.Descriptor instead.

func (*FileElement) End

func (n *FileElement) End() Token

func (*FileElement) GetEnum

func (x *FileElement) GetEnum() *EnumNode

func (*FileElement) GetErr

func (x *FileElement) GetErr() *ErrorNode

func (*FileElement) GetExtend

func (x *FileElement) GetExtend() *ExtendNode

func (*FileElement) GetImport

func (x *FileElement) GetImport() *ImportNode

func (*FileElement) GetMessage

func (x *FileElement) GetMessage() *MessageNode

func (*FileElement) GetOption

func (x *FileElement) GetOption() *OptionNode

func (*FileElement) GetPackage

func (x *FileElement) GetPackage() *PackageNode

func (*FileElement) GetService

func (x *FileElement) GetService() *ServiceNode

func (*FileElement) GetVal

func (m *FileElement) GetVal() isFileElement_Val

func (*FileElement) ProtoMessage

func (*FileElement) ProtoMessage()

func (*FileElement) ProtoPath

func (*FileElement) ProtoPath() fileElementPathBuilder

func (*FileElement) ProtoReflect

func (x *FileElement) ProtoReflect() protoreflect.Message

func (*FileElement) Reset

func (x *FileElement) Reset()

func (*FileElement) Start

func (n *FileElement) Start() Token

func (*FileElement) String

func (x *FileElement) String() string

func (*FileElement) Unwrap

func (n *FileElement) Unwrap() Node

type FileElement_Enum

type FileElement_Enum struct {
	Enum *EnumNode `protobuf:"bytes,5,opt,name=enum,proto3,oneof"`
}

type FileElement_Err

type FileElement_Err struct {
	Err *ErrorNode `protobuf:"bytes,8,opt,name=err,proto3,oneof"`
}

type FileElement_Extend

type FileElement_Extend struct {
	Extend *ExtendNode `protobuf:"bytes,6,opt,name=extend,proto3,oneof"`
}

type FileElement_Import

type FileElement_Import struct {
	Import *ImportNode `protobuf:"bytes,1,opt,name=import,proto3,oneof"`
}

type FileElement_Message

type FileElement_Message struct {
	Message *MessageNode `protobuf:"bytes,4,opt,name=message,proto3,oneof"`
}

type FileElement_Option

type FileElement_Option struct {
	Option *OptionNode `protobuf:"bytes,3,opt,name=option,proto3,oneof"`
}

type FileElement_Package

type FileElement_Package struct {
	Package *PackageNode `protobuf:"bytes,2,opt,name=package,proto3,oneof"`
}

type FileElement_Service

type FileElement_Service struct {
	Service *ServiceNode `protobuf:"bytes,7,opt,name=service,proto3,oneof"`
}

type FileInfo

type FileInfo struct {

	// The name of the source file.
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// The raw contents of the source file.
	Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
	// The offsets for each line in the file. The value is the zero-based byte
	// offset for a given line. The line is given by its index. So the value at
	// index 0 is the offset for the first line (which is always zero). The
	// value at index 1 is the offset at which the second line begins. Etc.
	Lines []int32 `protobuf:"varint,3,rep,packed,name=lines,proto3" json:"lines,omitempty"`
	// The info for every comment in the file. This is empty if the file has no
	// comments. The first entry corresponds to the first comment in the file,
	// and so on.
	Comments []*FileInfo_CommentInfo `protobuf:"bytes,4,rep,name=comments,proto3" json:"comments,omitempty"`
	// The info for every lexed item in the file. The last item in the slice
	// corresponds to the EOF, so every file (even an empty one) should have at
	// least one entry. This includes all terminal symbols (tokens) in the AST
	// as well as all comments.
	ItemList []*FileInfo_ItemSpan `protobuf:"bytes,5,rep,name=itemList,proto3" json:"itemList,omitempty"`
	// Document version, if provided by the resolver. The value is not used for
	// any purpose other than to allow the caller to attach version information
	// to the file for use in external tooling.
	Version          int32                     `protobuf:"varint,6,opt,name=version,proto3" json:"version,omitempty"`
	PositionEncoding FileInfo_PositionEncoding `protobuf:"varint,7,opt,name=positionEncoding,proto3,enum=ast.FileInfo_PositionEncoding" json:"positionEncoding,omitempty"`
	// zero-length-token counts, used for validation.
	ZeroLengthTokenCount            int32 `protobuf:"varint,8,opt,name=zeroLengthTokenCount,proto3" json:"zeroLengthTokenCount,omitempty"`
	ZeroLengthTokenConsecutiveCount int32 `protobuf:"varint,9,opt,name=zeroLengthTokenConsecutiveCount,proto3" json:"zeroLengthTokenConsecutiveCount,omitempty"`
	// contains filtered or unexported fields
}

FileInfo contains information about the contents of a source file, including details about comments and items. A lexer accumulates these details as it scans the file contents. This allows efficient representation of things like source positions.

func NewFileInfo

func NewFileInfo(filename string, contents []byte, version int32) *FileInfo

NewFileInfo creates a new instance for the given file.

func (*FileInfo) AddComment

func (f *FileInfo) AddComment(comment, attributedTo Token)

AddComment adds info about a comment to this file. Comments must first be added as items via f.AddToken(). The given comment argument is the Token from that step. The given attributedTo argument indicates another token in the file with which the comment is associated. If comment's offset is before that of attributedTo, then this is a leading comment. Otherwise, it is a trailing comment.

func (*FileInfo) AddLine

func (f *FileInfo) AddLine(offset int)

AddLine adds the offset representing the beginning of the "next" line in the file. The first line always starts at offset 0, the second line starts at offset-of-newline-char+1.

func (*FileInfo) AddToken

func (f *FileInfo) AddToken(offset, length int) Token

AddToken adds info about a token at the given location to this file. It returns a value that allows access to all of the token's details.

func (*FileInfo) AddVirtualComment

func (f *FileInfo) AddVirtualComment(comment Token, attributedTo Token, virtualToken Token)

func (*FileInfo) DebugAnnotated

func (f *FileInfo) DebugAnnotated() string

func (*FileInfo) Descriptor deprecated

func (*FileInfo) Descriptor() ([]byte, []int)

Deprecated: Use FileInfo.ProtoReflect.Descriptor instead.

func (*FileInfo) GetComments

func (x *FileInfo) GetComments() []*FileInfo_CommentInfo

func (*FileInfo) GetData

func (x *FileInfo) GetData() []byte

func (*FileInfo) GetItem

func (f *FileInfo) GetItem(i Item) (Token, Comment)

GetItem returns the token or comment represented by the given item. Only one of the return values will be valid. If the item is a token then the returned comment will be a zero value and thus invalid (i.e. comment.IsValid() returns false). If the item is a comment then the returned token will be TokenError.

If the given i is out of range, this returns (TokenError, Comment{}). If the given i is not out of range but also from a different file than f, then the result is undefined.

func (*FileInfo) GetItemList

func (x *FileInfo) GetItemList() []*FileInfo_ItemSpan

func (*FileInfo) GetLines

func (x *FileInfo) GetLines() []int32

func (*FileInfo) GetName

func (x *FileInfo) GetName() string

func (*FileInfo) GetPositionEncoding

func (x *FileInfo) GetPositionEncoding() FileInfo_PositionEncoding

func (*FileInfo) GetVersion

func (x *FileInfo) GetVersion() int32

func (*FileInfo) GetZeroLengthTokenConsecutiveCount

func (x *FileInfo) GetZeroLengthTokenConsecutiveCount() int32

func (*FileInfo) GetZeroLengthTokenCount

func (x *FileInfo) GetZeroLengthTokenCount() int32

func (*FileInfo) ItemInfo

func (f *FileInfo) ItemInfo(i Item) ItemInfo

ItemInfo returns details from the original source for the given item.

If the given i is out of range, this returns nil. If the given i is not out of range but also from a different file than f, then the result is undefined.

func (*FileInfo) Items

func (f *FileInfo) Items() Sequence[Item]

func (*FileInfo) NodeInfo

func (f *FileInfo) NodeInfo(n Node) NodeInfo

NodeInfo returns details from the original source for the given AST node.

If the given n is out of range, this returns an invalid NodeInfo (i.e. nodeInfo.IsValid() returns false). If the given n is not out of range but also from a different file than f, then the result is undefined.

func (*FileInfo) ProtoMessage

func (*FileInfo) ProtoMessage()

func (*FileInfo) ProtoPath

func (*FileInfo) ProtoPath() fileInfoPathBuilder

func (*FileInfo) ProtoReflect

func (x *FileInfo) ProtoReflect() protoreflect.Message

func (*FileInfo) Reset

func (x *FileInfo) Reset()

func (*FileInfo) SourcePos

func (f *FileInfo) SourcePos(offset int) SourcePos

func (*FileInfo) String

func (x *FileInfo) String() string

func (*FileInfo) TokenAtOffset

func (f *FileInfo) TokenAtOffset(offset int) Token

func (*FileInfo) TokenInfo

func (f *FileInfo) TokenInfo(t Token) NodeInfo

TokenInfo returns details from the original source for the given token.

If the given t is out of range, this returns an invalid NodeInfo (i.e. nodeInfo.IsValid() returns false). If the given t is not out of range but also from a different file than f, then the result is undefined.

func (*FileInfo) Tokens

func (f *FileInfo) Tokens() Sequence[Token]

type FileInfoInterface

type FileInfoInterface interface {
	GetName() string
	GetVersion() int32
	SourcePos(int) SourcePos
	NodeInfo(Node) NodeInfo
	TokenInfo(Token) NodeInfo
	ItemInfo(Item) ItemInfo
	GetItem(Item) (Token, Comment)
}

type FileInfo_CommentInfo

type FileInfo_CommentInfo struct {

	// the index of the item, in the file's items slice, that represents this
	// comment
	Index int32 `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"`
	// the index of the token to which this comment is attributed.
	AttributedToIndex int32 `protobuf:"varint,2,opt,name=attributedToIndex,proto3" json:"attributedToIndex,omitempty"`
	// if > 0, the comment is attributed to the token in attributedToIndex for
	// display and interaction purposes, but only because the token it should be
	// attributed to is a virtual token - this has implications when formatting
	// extended syntax virtual tokens.
	VirtualIndex int32 `protobuf:"varint,3,opt,name=virtualIndex,proto3" json:"virtualIndex,omitempty"`
	// contains filtered or unexported fields
}

func (*FileInfo_CommentInfo) Descriptor deprecated

func (*FileInfo_CommentInfo) Descriptor() ([]byte, []int)

Deprecated: Use FileInfo_CommentInfo.ProtoReflect.Descriptor instead.

func (*FileInfo_CommentInfo) GetAttributedToIndex

func (x *FileInfo_CommentInfo) GetAttributedToIndex() int32

func (*FileInfo_CommentInfo) GetIndex

func (x *FileInfo_CommentInfo) GetIndex() int32

func (*FileInfo_CommentInfo) GetVirtualIndex

func (x *FileInfo_CommentInfo) GetVirtualIndex() int32

func (*FileInfo_CommentInfo) ProtoMessage

func (*FileInfo_CommentInfo) ProtoMessage()

func (*FileInfo_CommentInfo) ProtoReflect

func (x *FileInfo_CommentInfo) ProtoReflect() protoreflect.Message

func (*FileInfo_CommentInfo) Reset

func (x *FileInfo_CommentInfo) Reset()

func (*FileInfo_CommentInfo) String

func (x *FileInfo_CommentInfo) String() string

type FileInfo_ItemSpan

type FileInfo_ItemSpan struct {

	// the offset into the file of the first character of an item.
	Offset int32 `protobuf:"varint,1,opt,name=offset,proto3" json:"offset,omitempty"`
	// the length of the item
	Length int32 `protobuf:"varint,2,opt,name=length,proto3" json:"length,omitempty"`
	// contains filtered or unexported fields
}

func (*FileInfo_ItemSpan) Descriptor deprecated

func (*FileInfo_ItemSpan) Descriptor() ([]byte, []int)

Deprecated: Use FileInfo_ItemSpan.ProtoReflect.Descriptor instead.

func (*FileInfo_ItemSpan) GetLength

func (x *FileInfo_ItemSpan) GetLength() int32

func (*FileInfo_ItemSpan) GetOffset

func (x *FileInfo_ItemSpan) GetOffset() int32

func (*FileInfo_ItemSpan) ProtoMessage

func (*FileInfo_ItemSpan) ProtoMessage()

func (*FileInfo_ItemSpan) ProtoReflect

func (x *FileInfo_ItemSpan) ProtoReflect() protoreflect.Message

func (*FileInfo_ItemSpan) Reset

func (x *FileInfo_ItemSpan) Reset()

func (*FileInfo_ItemSpan) String

func (x *FileInfo_ItemSpan) String() string

type FileInfo_PositionEncoding

type FileInfo_PositionEncoding int32
const (
	FileInfo_PositionEncodingByteOffset       FileInfo_PositionEncoding = 0
	FileInfo_PositionEncodingProtocCompatible FileInfo_PositionEncoding = 1
)

func (FileInfo_PositionEncoding) Descriptor

func (FileInfo_PositionEncoding) Enum

func (FileInfo_PositionEncoding) EnumDescriptor deprecated

func (FileInfo_PositionEncoding) EnumDescriptor() ([]byte, []int)

Deprecated: Use FileInfo_PositionEncoding.Descriptor instead.

func (FileInfo_PositionEncoding) Number

func (FileInfo_PositionEncoding) String

func (x FileInfo_PositionEncoding) String() string

func (FileInfo_PositionEncoding) Type

type FileNode

type FileNode struct {

	// A map of implementation-specific key-value pairs parsed from comments on
	// the syntax or edition declaration. These work like the //go: comments in
	// Go source files.
	Syntax *SyntaxNode `protobuf:"bytes,1,opt,name=syntax" json:"syntax,omitempty"`
	// A file has either a Syntax or Edition node, never both.
	// If both are nil, neither declaration is present and the
	// file is assumed to use "proto2" syntax.
	Edition *EditionNode   `protobuf:"bytes,2,opt,name=edition" json:"edition,omitempty"`
	Decls   []*FileElement `protobuf:"bytes,3,rep,name=decls" json:"decls,omitempty"`
	// This synthetic node allows access to final comments and whitespace
	EOF *RuneNode `protobuf:"bytes,4,opt,name=EOF" json:"EOF,omitempty"`
	// contains filtered or unexported fields
}

FileNode is the root of the AST hierarchy. It represents an entire protobuf source file.

func NewEmptyFileNode

func NewEmptyFileNode(filename string, version int32) *FileNode

NewEmptyFileNode returns an empty AST for a file with the given name.

func NewFileNode

func NewFileNode(info *FileInfo, syntax *SyntaxNode, decls []*FileElement, eof Token) *FileNode

NewFileNode creates a new *FileNode. The syntax parameter is optional. If it is absent, it means the file had no syntax declaration.

This function panics if the concrete type of any element of decls is not from this package.

func NewFileNodeWithEdition

func NewFileNodeWithEdition(info *FileInfo, edition *EditionNode, decls []*FileElement, eof Token) *FileNode

NewFileNodeWithEdition creates a new *FileNode. The edition parameter is required. If a file has no edition declaration, use NewFileNode instead.

This function panics if the concrete type of any element of decls is not from this package.

func (*FileNode) DebugAnnotated

func (f *FileNode) DebugAnnotated() string

func (*FileNode) Descriptor deprecated

func (*FileNode) Descriptor() ([]byte, []int)

Deprecated: Use FileNode.ProtoReflect.Descriptor instead.

func (*FileNode) End

func (f *FileNode) End() Token

func (*FileNode) EndExclusive

func (f *FileNode) EndExclusive() Token

Returns the last non-EOF token, or TokenError if EOF is the only token.

func (*FileNode) GetDecls

func (x *FileNode) GetDecls() []*FileElement

func (*FileNode) GetEOF

func (x *FileNode) GetEOF() *RuneNode

func (*FileNode) GetEdition

func (x *FileNode) GetEdition() *EditionNode

func (*FileNode) GetItem

func (f *FileNode) GetItem(i Item) (Token, Comment)

func (*FileNode) GetSyntax

func (x *FileNode) GetSyntax() *SyntaxNode

func (*FileNode) ItemAtOffset

func (f *FileNode) ItemAtOffset(offset int) (Token, Comment)

ItemAtOffset returns the token or comment at the given offset. Only one of the return values will be valid. If the item is a token then the returned comment will be a zero value and thus invalid (i.e. comment.IsValid() returns false). If the item is a comment then the returned token will be TokenError.

func (*FileNode) ItemInfo

func (f *FileNode) ItemInfo(i Item) ItemInfo

func (*FileNode) Items

func (f *FileNode) Items() Sequence[Item]

func (*FileNode) Name

func (f *FileNode) Name() string

func (*FileNode) NodeInfo

func (f *FileNode) NodeInfo(n Node) NodeInfo

func (*FileNode) Pragma

func (f *FileNode) Pragma(key string) (string, bool)

func (*FileNode) ProtoMessage

func (*FileNode) ProtoMessage()

func (*FileNode) ProtoReflect

func (x *FileNode) ProtoReflect() protoreflect.Message

func (*FileNode) Reset

func (x *FileNode) Reset()

func (*FileNode) SourcePos

func (f *FileNode) SourcePos(offset int) SourcePos

func (*FileNode) Start

func (f *FileNode) Start() Token

func (*FileNode) String

func (x *FileNode) String() string

func (*FileNode) TokenAtOffset

func (f *FileNode) TokenAtOffset(offset int) Token

func (*FileNode) TokenInfo

func (f *FileNode) TokenInfo(t Token) NodeInfo

func (*FileNode) Tokens

func (f *FileNode) Tokens() Sequence[Token]

func (*FileNode) Version

func (f *FileNode) Version() int32

type FloatLiteralNode

type FloatLiteralNode struct {
	Token Token `protobuf:"varint,1,opt,name=token,proto3,enum=ast.Token" json:"token,omitempty"`
	// Val is the numeric value indicated by the literal
	Val float64 `protobuf:"fixed64,2,opt,name=val,proto3" json:"val,omitempty"`
	// Raw is the original string representation of the literal
	Raw string `protobuf:"bytes,3,opt,name=raw,proto3" json:"raw,omitempty"`
	// contains filtered or unexported fields
}

FloatLiteralNode represents a floating point numeric literal.

func (*FloatLiteralNode) AsFloat

func (n *FloatLiteralNode) AsFloat() float64

func (*FloatLiteralNode) AsFloatValueNode

func (n *FloatLiteralNode) AsFloatValueNode() *FloatValueNode

func (*FloatLiteralNode) AsValueNode

func (n *FloatLiteralNode) AsValueNode() *ValueNode

func (*FloatLiteralNode) Descriptor deprecated

func (*FloatLiteralNode) Descriptor() ([]byte, []int)

Deprecated: Use FloatLiteralNode.ProtoReflect.Descriptor instead.

func (*FloatLiteralNode) End

func (n *FloatLiteralNode) End() Token

func (*FloatLiteralNode) GetRaw

func (x *FloatLiteralNode) GetRaw() string

func (*FloatLiteralNode) GetToken

func (x *FloatLiteralNode) GetToken() Token

func (*FloatLiteralNode) GetVal

func (x *FloatLiteralNode) GetVal() float64

func (*FloatLiteralNode) ProtoMessage

func (*FloatLiteralNode) ProtoMessage()

func (*FloatLiteralNode) ProtoPath

func (*FloatLiteralNode) ProtoPath() floatLiteralNodePathBuilder

func (*FloatLiteralNode) ProtoReflect

func (x *FloatLiteralNode) ProtoReflect() protoreflect.Message

func (*FloatLiteralNode) Reset

func (x *FloatLiteralNode) Reset()

func (*FloatLiteralNode) Start

func (n *FloatLiteralNode) Start() Token

func (*FloatLiteralNode) String

func (x *FloatLiteralNode) String() string

func (*FloatLiteralNode) Value

func (n *FloatLiteralNode) Value() interface{}

type FloatValueNode

type FloatValueNode struct {

	// Types that are assignable to Val:
	//
	//	*FloatValueNode_FloatLiteral
	//	*FloatValueNode_SpecialFloatLiteral
	//	*FloatValueNode_UintLiteral
	Val isFloatValueNode_Val `protobuf_oneof:"val"`
	// contains filtered or unexported fields
}

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.

func (*FloatValueNode) AsFloat

func (n *FloatValueNode) AsFloat() float64

func (*FloatValueNode) Descriptor deprecated

func (*FloatValueNode) Descriptor() ([]byte, []int)

Deprecated: Use FloatValueNode.ProtoReflect.Descriptor instead.

func (*FloatValueNode) End

func (n *FloatValueNode) End() Token

func (*FloatValueNode) GetFloatLiteral

func (x *FloatValueNode) GetFloatLiteral() *FloatLiteralNode

func (*FloatValueNode) GetSpecialFloatLiteral

func (x *FloatValueNode) GetSpecialFloatLiteral() *SpecialFloatLiteralNode

func (*FloatValueNode) GetUintLiteral

func (x *FloatValueNode) GetUintLiteral() *UintLiteralNode

func (*FloatValueNode) GetVal

func (m *FloatValueNode) GetVal() isFloatValueNode_Val

func (*FloatValueNode) ProtoMessage

func (*FloatValueNode) ProtoMessage()

func (*FloatValueNode) ProtoPath

func (*FloatValueNode) ProtoPath() floatValueNodePathBuilder

func (*FloatValueNode) ProtoReflect

func (x *FloatValueNode) ProtoReflect() protoreflect.Message

func (*FloatValueNode) Reset

func (x *FloatValueNode) Reset()

func (*FloatValueNode) Start

func (n *FloatValueNode) Start() Token

func (*FloatValueNode) String

func (x *FloatValueNode) String() string

func (*FloatValueNode) Unwrap

func (n *FloatValueNode) Unwrap() AnyFloatValueNode

type FloatValueNode_FloatLiteral

type FloatValueNode_FloatLiteral struct {
	FloatLiteral *FloatLiteralNode `protobuf:"bytes,1,opt,name=floatLiteral,proto3,oneof"`
}

type FloatValueNode_SpecialFloatLiteral

type FloatValueNode_SpecialFloatLiteral struct {
	SpecialFloatLiteral *SpecialFloatLiteralNode `protobuf:"bytes,2,opt,name=specialFloatLiteral,proto3,oneof"`
}

type FloatValueNode_UintLiteral

type FloatValueNode_UintLiteral struct {
	UintLiteral *UintLiteralNode `protobuf:"bytes,3,opt,name=uintLiteral,proto3,oneof"`
}

type GroupNode

type GroupNode struct {
	Label      *IdentNode          `protobuf:"bytes,1,opt,name=label,proto3" json:"label,omitempty"`
	Keyword    *IdentNode          `protobuf:"bytes,2,opt,name=keyword,proto3" json:"keyword,omitempty"`
	Name       *IdentNode          `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
	Equals     *RuneNode           `protobuf:"bytes,4,opt,name=equals,proto3" json:"equals,omitempty"`
	Tag        *UintLiteralNode    `protobuf:"bytes,5,opt,name=tag,proto3" json:"tag,omitempty"`
	Options    *CompactOptionsNode `protobuf:"bytes,6,opt,name=options,proto3" json:"options,omitempty"`
	OpenBrace  *RuneNode           `protobuf:"bytes,7,opt,name=openBrace,proto3" json:"openBrace,omitempty"`
	Decls      []*MessageElement   `protobuf:"bytes,8,rep,name=decls,proto3" json:"decls,omitempty"`
	CloseBrace *RuneNode           `protobuf:"bytes,9,opt,name=closeBrace,proto3" json:"closeBrace,omitempty"`
	Semicolon  *RuneNode           `protobuf:"bytes,10,opt,name=semicolon,proto3" json:"semicolon,omitempty"`
	// contains filtered or unexported fields
}

GroupNode represents a group declaration, which doubles as a field and inline message declaration. It can represent extension fields as well as non-extension fields (both inside of messages and inside of one-ofs). Example:

optional group Key = 4 {
  optional uint64 id = 1;
  optional string name = 2;
}

func (*GroupNode) AsExtendElement

func (n *GroupNode) AsExtendElement() *ExtendElement

func (*GroupNode) AsFieldDeclNode

func (n *GroupNode) AsFieldDeclNode() *FieldDeclNode

func (*GroupNode) AsMessageDeclNode

func (n *GroupNode) AsMessageDeclNode() *MessageDeclNode

func (*GroupNode) AsMessageElement

func (n *GroupNode) AsMessageElement() *MessageElement

func (*GroupNode) AsOneofElement

func (n *GroupNode) AsOneofElement() *OneofElement

func (*GroupNode) Descriptor deprecated

func (*GroupNode) Descriptor() ([]byte, []int)

Deprecated: Use GroupNode.ProtoReflect.Descriptor instead.

func (*GroupNode) End

func (n *GroupNode) End() Token

func (*GroupNode) GetCloseBrace

func (x *GroupNode) GetCloseBrace() *RuneNode

func (*GroupNode) GetDecls

func (x *GroupNode) GetDecls() []*MessageElement

func (*GroupNode) GetEquals

func (x *GroupNode) GetEquals() *RuneNode

func (*GroupNode) GetFieldTypeNode

func (n *GroupNode) GetFieldTypeNode() Node

func (*GroupNode) GetKeyword

func (x *GroupNode) GetKeyword() *IdentNode

func (*GroupNode) GetLabel

func (x *GroupNode) GetLabel() *IdentNode

func (*GroupNode) GetName

func (x *GroupNode) GetName() *IdentNode

func (*GroupNode) GetOpenBrace

func (x *GroupNode) GetOpenBrace() *RuneNode

func (*GroupNode) GetOptions

func (x *GroupNode) GetOptions() *CompactOptionsNode

func (*GroupNode) GetSemicolon

func (x *GroupNode) GetSemicolon() *RuneNode

func (*GroupNode) GetTag

func (x *GroupNode) GetTag() *UintLiteralNode

func (*GroupNode) ProtoMessage

func (*GroupNode) ProtoMessage()

func (*GroupNode) ProtoPath

func (*GroupNode) ProtoPath() groupNodePathBuilder

func (*GroupNode) ProtoReflect

func (x *GroupNode) ProtoReflect() protoreflect.Message

func (*GroupNode) Reset

func (x *GroupNode) Reset()

func (*GroupNode) Start

func (n *GroupNode) Start() Token

func (*GroupNode) String

func (x *GroupNode) String() string

type IdentNode

type IdentNode struct {
	Token     Token  `protobuf:"varint,1,opt,name=token,proto3,enum=ast.Token" json:"token,omitempty"`
	Val       string `protobuf:"bytes,2,opt,name=val,proto3" json:"val,omitempty"`
	IsKeyword bool   `protobuf:"varint,3,opt,name=isKeyword,proto3" json:"isKeyword,omitempty"`
	// contains filtered or unexported fields
}

IdentNode represents a simple, unqualified identifier. These are used to name elements declared in a protobuf file or to refer to elements. Example:

foobar

func (*IdentNode) AsComplexIdentComponent

func (n *IdentNode) AsComplexIdentComponent() *ComplexIdentComponent

func (*IdentNode) AsIdentValueNode

func (n *IdentNode) AsIdentValueNode() *IdentValueNode

func (*IdentNode) AsIdentifier

func (n *IdentNode) AsIdentifier() Identifier

func (*IdentNode) AsReservedElement

func (n *IdentNode) AsReservedElement() *ReservedElement

func (*IdentNode) AsValueNode

func (n *IdentNode) AsValueNode() *ValueNode

func (*IdentNode) Descriptor deprecated

func (*IdentNode) Descriptor() ([]byte, []int)

Deprecated: Use IdentNode.ProtoReflect.Descriptor instead.

func (*IdentNode) End

func (n *IdentNode) End() Token

func (*IdentNode) GetIsKeyword

func (x *IdentNode) GetIsKeyword() bool

func (*IdentNode) GetToken

func (x *IdentNode) GetToken() Token

func (*IdentNode) GetVal

func (x *IdentNode) GetVal() string

func (*IdentNode) ProtoMessage

func (*IdentNode) ProtoMessage()

func (*IdentNode) ProtoPath

func (*IdentNode) ProtoPath() identNodePathBuilder

func (*IdentNode) ProtoReflect

func (x *IdentNode) ProtoReflect() protoreflect.Message

func (*IdentNode) Reset

func (x *IdentNode) Reset()

func (*IdentNode) Start

func (n *IdentNode) Start() Token

func (*IdentNode) String

func (x *IdentNode) String() string

func (*IdentNode) ToKeyword

func (n *IdentNode) ToKeyword() *IdentNode

func (*IdentNode) Value

func (n *IdentNode) Value() interface{}

type IdentValueNode

type IdentValueNode struct {

	// Types that are assignable to Val:
	//
	//	*IdentValueNode_Ident
	//	*IdentValueNode_CompoundIdent
	Val isIdentValueNode_Val `protobuf_oneof:"val"`
	// contains filtered or unexported fields
}

IdentValueNode is an AST node that represents an identifier.

func (*IdentValueNode) AsIdentifier

func (n *IdentValueNode) AsIdentifier() Identifier

func (*IdentValueNode) Descriptor deprecated

func (*IdentValueNode) Descriptor() ([]byte, []int)

Deprecated: Use IdentValueNode.ProtoReflect.Descriptor instead.

func (*IdentValueNode) End

func (n *IdentValueNode) End() Token

func (*IdentValueNode) GetCompoundIdent

func (x *IdentValueNode) GetCompoundIdent() *CompoundIdentNode

func (*IdentValueNode) GetIdent

func (x *IdentValueNode) GetIdent() *IdentNode

func (*IdentValueNode) GetVal

func (m *IdentValueNode) GetVal() isIdentValueNode_Val

func (*IdentValueNode) ProtoMessage

func (*IdentValueNode) ProtoMessage()

func (*IdentValueNode) ProtoPath

func (*IdentValueNode) ProtoPath() identValueNodePathBuilder

func (*IdentValueNode) ProtoReflect

func (x *IdentValueNode) ProtoReflect() protoreflect.Message

func (*IdentValueNode) Reset

func (x *IdentValueNode) Reset()

func (*IdentValueNode) Start

func (n *IdentValueNode) Start() Token

func (*IdentValueNode) String

func (x *IdentValueNode) String() string

func (*IdentValueNode) Unwrap

func (n *IdentValueNode) Unwrap() AnyIdentValueNode

type IdentValueNode_CompoundIdent

type IdentValueNode_CompoundIdent struct {
	CompoundIdent *CompoundIdentNode `protobuf:"bytes,2,opt,name=compoundIdent,proto3,oneof"`
}

type IdentValueNode_Ident

type IdentValueNode_Ident struct {
	Ident *IdentNode `protobuf:"bytes,1,opt,name=ident,proto3,oneof"`
}

type Identifier

type Identifier = protoreflect.Name

Identifier is a possibly-qualified name. This is used to distinguish ValueNode values that are references/identifiers vs. those that are string literals.

type ImportNode

type ImportNode struct {
	Keyword   *IdentNode       `protobuf:"bytes,1,opt,name=keyword,proto3" json:"keyword,omitempty"`
	Public    *IdentNode       `protobuf:"bytes,2,opt,name=public,proto3" json:"public,omitempty"`
	Weak      *IdentNode       `protobuf:"bytes,3,opt,name=weak,proto3" json:"weak,omitempty"`
	Name      *StringValueNode `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"`
	Semicolon *RuneNode        `protobuf:"bytes,5,opt,name=semicolon,proto3" json:"semicolon,omitempty"`
	// contains filtered or unexported fields
}

ImportNode represents an import statement. Example:

import "google/protobuf/empty.proto";

func (*ImportNode) AsFileElement

func (n *ImportNode) AsFileElement() *FileElement

func (*ImportNode) Descriptor deprecated

func (*ImportNode) Descriptor() ([]byte, []int)

Deprecated: Use ImportNode.ProtoReflect.Descriptor instead.

func (*ImportNode) End

func (m *ImportNode) End() Token

func (*ImportNode) GetKeyword

func (x *ImportNode) GetKeyword() *IdentNode

func (*ImportNode) GetName

func (x *ImportNode) GetName() *StringValueNode

func (*ImportNode) GetPublic

func (x *ImportNode) GetPublic() *IdentNode

func (*ImportNode) GetSemicolon

func (x *ImportNode) GetSemicolon() *RuneNode

func (*ImportNode) GetWeak

func (x *ImportNode) GetWeak() *IdentNode

func (*ImportNode) IsIncomplete

func (m *ImportNode) IsIncomplete() bool

func (*ImportNode) ProtoMessage

func (*ImportNode) ProtoMessage()

func (*ImportNode) ProtoPath

func (*ImportNode) ProtoPath() importNodePathBuilder

func (*ImportNode) ProtoReflect

func (x *ImportNode) ProtoReflect() protoreflect.Message

func (*ImportNode) Reset

func (x *ImportNode) Reset()

func (*ImportNode) Start

func (m *ImportNode) Start() Token

func (*ImportNode) String

func (x *ImportNode) String() string

type IntValueNode

type IntValueNode struct {

	// Types that are assignable to Val:
	//
	//	*IntValueNode_UintLiteral
	//	*IntValueNode_NegativeIntLiteral
	Val isIntValueNode_Val `protobuf_oneof:"val"`
	// contains filtered or unexported fields
}

IntValueNode is an AST node that represents an integer literal. If an integer literal is too large for an int64 (or uint64 for positive literals), it is represented instead by a FloatValueNode.

func (*IntValueNode) AsInt64

func (n *IntValueNode) AsInt64() (int64, bool)

func (*IntValueNode) AsUint64

func (n *IntValueNode) AsUint64() (uint64, bool)

func (*IntValueNode) Descriptor deprecated

func (*IntValueNode) Descriptor() ([]byte, []int)

Deprecated: Use IntValueNode.ProtoReflect.Descriptor instead.

func (*IntValueNode) End

func (n *IntValueNode) End() Token

func (*IntValueNode) GetNegativeIntLiteral

func (x *IntValueNode) GetNegativeIntLiteral() *NegativeIntLiteralNode

func (*IntValueNode) GetUintLiteral

func (x *IntValueNode) GetUintLiteral() *UintLiteralNode

func (*IntValueNode) GetVal

func (m *IntValueNode) GetVal() isIntValueNode_Val

func (*IntValueNode) ProtoMessage

func (*IntValueNode) ProtoMessage()

func (*IntValueNode) ProtoPath

func (*IntValueNode) ProtoPath() intValueNodePathBuilder

func (*IntValueNode) ProtoReflect

func (x *IntValueNode) ProtoReflect() protoreflect.Message

func (*IntValueNode) Reset

func (x *IntValueNode) Reset()

func (*IntValueNode) Start

func (n *IntValueNode) Start() Token

func (*IntValueNode) String

func (x *IntValueNode) String() string

func (*IntValueNode) Unwrap

func (n *IntValueNode) Unwrap() AnyIntValueNode

func (*IntValueNode) Value

func (n *IntValueNode) Value() any

type IntValueNode_NegativeIntLiteral

type IntValueNode_NegativeIntLiteral struct {
	NegativeIntLiteral *NegativeIntLiteralNode `protobuf:"bytes,2,opt,name=negativeIntLiteral,proto3,oneof"`
}

type IntValueNode_UintLiteral

type IntValueNode_UintLiteral struct {
	UintLiteral *UintLiteralNode `protobuf:"bytes,1,opt,name=uintLiteral,proto3,oneof"`
}

type Item

type Item int

Item represents an item lexed from source. It represents either a Token or a Comment.

func (Item) IsValid

func (i Item) IsValid() bool

type ItemInfo

type ItemInfo interface {
	SourceSpan
	LeadingWhitespace() string
	RawText() string
}

ItemInfo provides details about an item's location in the source file and its contents.

type MapFieldNode

type MapFieldNode struct {
	MapType   *MapTypeNode        `protobuf:"bytes,1,opt,name=mapType,proto3" json:"mapType,omitempty"`
	Name      *IdentNode          `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	Equals    *RuneNode           `protobuf:"bytes,3,opt,name=equals,proto3" json:"equals,omitempty"`
	Tag       *UintLiteralNode    `protobuf:"bytes,4,opt,name=tag,proto3" json:"tag,omitempty"`
	Options   *CompactOptionsNode `protobuf:"bytes,5,opt,name=options,proto3" json:"options,omitempty"`
	Semicolon *RuneNode           `protobuf:"bytes,6,opt,name=semicolon,proto3" json:"semicolon,omitempty"`
	// contains filtered or unexported fields
}

MapFieldNode represents a map field declaration. Example:

map<string,string> replacements = 3 [deprecated = true];

func (*MapFieldNode) AsFieldDeclNode

func (n *MapFieldNode) AsFieldDeclNode() *FieldDeclNode

func (*MapFieldNode) AsMessageDeclNode

func (n *MapFieldNode) AsMessageDeclNode() *MessageDeclNode

func (*MapFieldNode) AsMessageElement

func (n *MapFieldNode) AsMessageElement() *MessageElement

func (*MapFieldNode) Descriptor deprecated

func (*MapFieldNode) Descriptor() ([]byte, []int)

Deprecated: Use MapFieldNode.ProtoReflect.Descriptor instead.

func (*MapFieldNode) End

func (n *MapFieldNode) End() Token

func (*MapFieldNode) GetEquals

func (x *MapFieldNode) GetEquals() *RuneNode

func (*MapFieldNode) GetFieldTypeNode

func (n *MapFieldNode) GetFieldTypeNode() Node

func (*MapFieldNode) GetLabel

func (n *MapFieldNode) GetLabel() *IdentNode

func (*MapFieldNode) GetMapType

func (x *MapFieldNode) GetMapType() *MapTypeNode

func (*MapFieldNode) GetName

func (x *MapFieldNode) GetName() *IdentNode

func (*MapFieldNode) GetOptions

func (x *MapFieldNode) GetOptions() *CompactOptionsNode

func (*MapFieldNode) GetSemicolon

func (x *MapFieldNode) GetSemicolon() *RuneNode

func (*MapFieldNode) GetTag

func (x *MapFieldNode) GetTag() *UintLiteralNode

func (*MapFieldNode) KeyField

func (n *MapFieldNode) KeyField() *SyntheticMapField

func (*MapFieldNode) ProtoMessage

func (*MapFieldNode) ProtoMessage()

func (*MapFieldNode) ProtoPath

func (*MapFieldNode) ProtoPath() mapFieldNodePathBuilder

func (*MapFieldNode) ProtoReflect

func (x *MapFieldNode) ProtoReflect() protoreflect.Message

func (*MapFieldNode) Reset

func (x *MapFieldNode) Reset()

func (*MapFieldNode) Start

func (n *MapFieldNode) Start() Token

func (*MapFieldNode) String

func (x *MapFieldNode) String() string

func (*MapFieldNode) ValueField

func (n *MapFieldNode) ValueField() *SyntheticMapField

type MapTypeNode

type MapTypeNode struct {
	Keyword    *IdentNode      `protobuf:"bytes,1,opt,name=keyword,proto3" json:"keyword,omitempty"`
	OpenAngle  *RuneNode       `protobuf:"bytes,2,opt,name=openAngle,proto3" json:"openAngle,omitempty"`
	KeyType    *IdentNode      `protobuf:"bytes,3,opt,name=keyType,proto3" json:"keyType,omitempty"`
	Comma      *RuneNode       `protobuf:"bytes,4,opt,name=comma,proto3" json:"comma,omitempty"`
	ValueType  *IdentValueNode `protobuf:"bytes,5,opt,name=valueType,proto3" json:"valueType,omitempty"`
	CloseAngle *RuneNode       `protobuf:"bytes,6,opt,name=closeAngle,proto3" json:"closeAngle,omitempty"`
	Semicolon  *RuneNode       `protobuf:"bytes,7,opt,name=semicolon,proto3" json:"semicolon,omitempty"`
	// contains filtered or unexported fields
}

MapTypeNode represents the type declaration for a map field. It defines both the key and value types for the map. Example:

map<string, Values>

func (*MapTypeNode) Descriptor deprecated

func (*MapTypeNode) Descriptor() ([]byte, []int)

Deprecated: Use MapTypeNode.ProtoReflect.Descriptor instead.

func (*MapTypeNode) End

func (n *MapTypeNode) End() Token

func (*MapTypeNode) GetCloseAngle

func (x *MapTypeNode) GetCloseAngle() *RuneNode

func (*MapTypeNode) GetComma

func (x *MapTypeNode) GetComma() *RuneNode

func (*MapTypeNode) GetKeyType

func (x *MapTypeNode) GetKeyType() *IdentNode

func (*MapTypeNode) GetKeyword

func (x *MapTypeNode) GetKeyword() *IdentNode

func (*MapTypeNode) GetOpenAngle

func (x *MapTypeNode) GetOpenAngle() *RuneNode

func (*MapTypeNode) GetSemicolon

func (x *MapTypeNode) GetSemicolon() *RuneNode

func (*MapTypeNode) GetValueType

func (x *MapTypeNode) GetValueType() *IdentValueNode

func (*MapTypeNode) ProtoMessage

func (*MapTypeNode) ProtoMessage()

func (*MapTypeNode) ProtoPath

func (*MapTypeNode) ProtoPath() mapTypeNodePathBuilder

func (*MapTypeNode) ProtoReflect

func (x *MapTypeNode) ProtoReflect() protoreflect.Message

func (*MapTypeNode) Reset

func (x *MapTypeNode) Reset()

func (*MapTypeNode) Start

func (n *MapTypeNode) Start() Token

func (*MapTypeNode) String

func (x *MapTypeNode) String() string

type MessageDeclNode

type MessageDeclNode struct {

	// Types that are assignable to Val:
	//
	//	*MessageDeclNode_Message
	//	*MessageDeclNode_Group
	//	*MessageDeclNode_MapField
	Val isMessageDeclNode_Val `protobuf_oneof:"val"`
	// contains filtered or unexported fields
}

MessageDeclNode is a node in the AST that defines a message type. This includes normal message fields as well as implicit messages:

  • *MessageNode
  • *GroupNode (the group is a field and inline message type)
  • *MapFieldNode (map fields implicitly define a MapEntry message type)

func (*MessageDeclNode) Descriptor deprecated

func (*MessageDeclNode) Descriptor() ([]byte, []int)

Deprecated: Use MessageDeclNode.ProtoReflect.Descriptor instead.

func (*MessageDeclNode) End

func (n *MessageDeclNode) End() Token

func (*MessageDeclNode) GetGroup

func (x *MessageDeclNode) GetGroup() *GroupNode

func (*MessageDeclNode) GetMapField

func (x *MessageDeclNode) GetMapField() *MapFieldNode

func (*MessageDeclNode) GetMessage

func (x *MessageDeclNode) GetMessage() *MessageNode

func (*MessageDeclNode) GetName

func (n *MessageDeclNode) GetName() *IdentNode

func (*MessageDeclNode) GetVal

func (m *MessageDeclNode) GetVal() isMessageDeclNode_Val

func (*MessageDeclNode) ProtoMessage

func (*MessageDeclNode) ProtoMessage()

func (*MessageDeclNode) ProtoPath

func (*MessageDeclNode) ProtoPath() messageDeclNodePathBuilder

func (*MessageDeclNode) ProtoReflect

func (x *MessageDeclNode) ProtoReflect() protoreflect.Message

func (*MessageDeclNode) Reset

func (x *MessageDeclNode) Reset()

func (*MessageDeclNode) Start

func (n *MessageDeclNode) Start() Token

func (*MessageDeclNode) String

func (x *MessageDeclNode) String() string

func (*MessageDeclNode) Unwrap

func (n *MessageDeclNode) Unwrap() AnyMessageDeclNode

type MessageDeclNode_Group

type MessageDeclNode_Group struct {
	Group *GroupNode `protobuf:"bytes,2,opt,name=group,proto3,oneof"`
}

type MessageDeclNode_MapField

type MessageDeclNode_MapField struct {
	MapField *MapFieldNode `protobuf:"bytes,3,opt,name=mapField,proto3,oneof"`
}

type MessageDeclNode_Message

type MessageDeclNode_Message struct {
	Message *MessageNode `protobuf:"bytes,1,opt,name=message,proto3,oneof"`
}

type MessageElement

type MessageElement struct {

	// Types that are assignable to Val:
	//
	//	*MessageElement_Option
	//	*MessageElement_Field
	//	*MessageElement_MapField
	//	*MessageElement_Oneof
	//	*MessageElement_Group
	//	*MessageElement_Message
	//	*MessageElement_Enum
	//	*MessageElement_Extend
	//	*MessageElement_ExtensionRange
	//	*MessageElement_Reserved
	//	*MessageElement_Empty
	Val isMessageElement_Val `protobuf_oneof:"val"`
	// contains filtered or unexported fields
}

MessageElement is an interface implemented by all AST nodes that can appear in a message body.

func (*MessageElement) Descriptor deprecated

func (*MessageElement) Descriptor() ([]byte, []int)

Deprecated: Use MessageElement.ProtoReflect.Descriptor instead.

func (*MessageElement) End

func (n *MessageElement) End() Token

func (*MessageElement) GetEmpty

func (x *MessageElement) GetEmpty() *EmptyDeclNode

func (*MessageElement) GetEnum

func (x *MessageElement) GetEnum() *EnumNode

func (*MessageElement) GetExtend

func (x *MessageElement) GetExtend() *ExtendNode

func (*MessageElement) GetExtensionRange

func (x *MessageElement) GetExtensionRange() *ExtensionRangeNode

func (*MessageElement) GetField

func (x *MessageElement) GetField() *FieldNode

func (*MessageElement) GetGroup

func (x *MessageElement) GetGroup() *GroupNode

func (*MessageElement) GetMapField

func (x *MessageElement) GetMapField() *MapFieldNode

func (*MessageElement) GetMessage

func (x *MessageElement) GetMessage() *MessageNode

func (*MessageElement) GetOneof

func (x *MessageElement) GetOneof() *OneofNode

func (*MessageElement) GetOption

func (x *MessageElement) GetOption() *OptionNode

func (*MessageElement) GetReserved

func (x *MessageElement) GetReserved() *ReservedNode

func (*MessageElement) GetVal

func (m *MessageElement) GetVal() isMessageElement_Val

func (*MessageElement) ProtoMessage

func (*MessageElement) ProtoMessage()

func (*MessageElement) ProtoPath

func (*MessageElement) ProtoPath() messageElementPathBuilder

func (*MessageElement) ProtoReflect

func (x *MessageElement) ProtoReflect() protoreflect.Message

func (*MessageElement) Reset

func (x *MessageElement) Reset()

func (*MessageElement) Start

func (n *MessageElement) Start() Token

func (*MessageElement) String

func (x *MessageElement) String() string

func (*MessageElement) Unwrap

func (n *MessageElement) Unwrap() AnyMessageElement

type MessageElement_Empty

type MessageElement_Empty struct {
	Empty *EmptyDeclNode `protobuf:"bytes,11,opt,name=empty,proto3,oneof"`
}

type MessageElement_Enum

type MessageElement_Enum struct {
	Enum *EnumNode `protobuf:"bytes,7,opt,name=enum,proto3,oneof"`
}

type MessageElement_Extend

type MessageElement_Extend struct {
	Extend *ExtendNode `protobuf:"bytes,8,opt,name=extend,proto3,oneof"`
}

type MessageElement_ExtensionRange

type MessageElement_ExtensionRange struct {
	ExtensionRange *ExtensionRangeNode `protobuf:"bytes,9,opt,name=extensionRange,proto3,oneof"`
}

type MessageElement_Field

type MessageElement_Field struct {
	Field *FieldNode `protobuf:"bytes,2,opt,name=field,proto3,oneof"`
}

type MessageElement_Group

type MessageElement_Group struct {
	Group *GroupNode `protobuf:"bytes,5,opt,name=group,proto3,oneof"`
}

type MessageElement_MapField

type MessageElement_MapField struct {
	MapField *MapFieldNode `protobuf:"bytes,3,opt,name=mapField,proto3,oneof"`
}

type MessageElement_Message

type MessageElement_Message struct {
	Message *MessageNode `protobuf:"bytes,6,opt,name=message,proto3,oneof"`
}

type MessageElement_Oneof

type MessageElement_Oneof struct {
	Oneof *OneofNode `protobuf:"bytes,4,opt,name=oneof,proto3,oneof"`
}

type MessageElement_Option

type MessageElement_Option struct {
	Option *OptionNode `protobuf:"bytes,1,opt,name=option,proto3,oneof"`
}

type MessageElement_Reserved

type MessageElement_Reserved struct {
	Reserved *ReservedNode `protobuf:"bytes,10,opt,name=reserved,proto3,oneof"`
}

type MessageFieldNode

type MessageFieldNode struct {
	Name *FieldReferenceNode `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// Sep represents the ':' separator between the name and value. If
	// the value is a message or list literal (and thus starts with '<',
	// '{', or '['), then the separator may be omitted and this field may
	// be nil.
	Sep       *RuneNode  `protobuf:"bytes,2,opt,name=sep,proto3" json:"sep,omitempty"`
	Val       *ValueNode `protobuf:"bytes,3,opt,name=val,proto3" json:"val,omitempty"`
	Semicolon *RuneNode  `protobuf:"bytes,4,opt,name=semicolon,proto3" json:"semicolon,omitempty"`
	// contains filtered or unexported fields
}

MessageFieldNode represents a single field (name and value) inside of a message literal. Example:

foo:"bar"

func (*MessageFieldNode) Descriptor deprecated

func (*MessageFieldNode) Descriptor() ([]byte, []int)

Deprecated: Use MessageFieldNode.ProtoReflect.Descriptor instead.

func (*MessageFieldNode) End

func (n *MessageFieldNode) End() Token

func (*MessageFieldNode) GetName

func (x *MessageFieldNode) GetName() *FieldReferenceNode

func (*MessageFieldNode) GetSemicolon

func (x *MessageFieldNode) GetSemicolon() *RuneNode

func (*MessageFieldNode) GetSep

func (x *MessageFieldNode) GetSep() *RuneNode

func (*MessageFieldNode) GetVal

func (x *MessageFieldNode) GetVal() *ValueNode

func (*MessageFieldNode) IsIncomplete

func (n *MessageFieldNode) IsIncomplete() bool

func (*MessageFieldNode) ProtoMessage

func (*MessageFieldNode) ProtoMessage()

func (*MessageFieldNode) ProtoPath

func (*MessageFieldNode) ProtoPath() messageFieldNodePathBuilder

func (*MessageFieldNode) ProtoReflect

func (x *MessageFieldNode) ProtoReflect() protoreflect.Message

func (*MessageFieldNode) Reset

func (x *MessageFieldNode) Reset()

func (*MessageFieldNode) Start

func (n *MessageFieldNode) Start() Token

func (*MessageFieldNode) String

func (x *MessageFieldNode) String() string

type MessageLiteralNode

type MessageLiteralNode struct {
	Open      *RuneNode           `protobuf:"bytes,1,opt,name=open,proto3" json:"open,omitempty"` // should be '{' or '<'
	Elements  []*MessageFieldNode `protobuf:"bytes,2,rep,name=elements,proto3" json:"elements,omitempty"`
	Close     *RuneNode           `protobuf:"bytes,4,opt,name=close,proto3" json:"close,omitempty"` // should be '}' or '>', depending on Open
	Semicolon *RuneNode           `protobuf:"bytes,5,opt,name=semicolon,proto3" json:"semicolon,omitempty"`
	// contains filtered or unexported fields
}

MessageLiteralNode represents a message literal, which is compatible with the protobuf text format and can be used for custom options with message types. Example:

{ foo:1 foo:2 foo:3 bar:<name:"abc" id:123> }

func (*MessageLiteralNode) AsValueNode

func (n *MessageLiteralNode) AsValueNode() *ValueNode

func (*MessageLiteralNode) Descriptor deprecated

func (*MessageLiteralNode) Descriptor() ([]byte, []int)

Deprecated: Use MessageLiteralNode.ProtoReflect.Descriptor instead.

func (*MessageLiteralNode) End

func (n *MessageLiteralNode) End() Token

func (*MessageLiteralNode) GetClose

func (x *MessageLiteralNode) GetClose() *RuneNode

func (*MessageLiteralNode) GetElements

func (x *MessageLiteralNode) GetElements() []*MessageFieldNode

func (*MessageLiteralNode) GetOpen

func (x *MessageLiteralNode) GetOpen() *RuneNode

func (*MessageLiteralNode) GetSemicolon

func (x *MessageLiteralNode) GetSemicolon() *RuneNode

func (*MessageLiteralNode) ProtoMessage

func (*MessageLiteralNode) ProtoMessage()

func (*MessageLiteralNode) ProtoPath

func (*MessageLiteralNode) ProtoPath() messageLiteralNodePathBuilder

func (*MessageLiteralNode) ProtoReflect

func (x *MessageLiteralNode) ProtoReflect() protoreflect.Message

func (*MessageLiteralNode) Reset

func (x *MessageLiteralNode) Reset()

func (*MessageLiteralNode) Start

func (n *MessageLiteralNode) Start() Token

func (*MessageLiteralNode) String

func (x *MessageLiteralNode) String() string

func (*MessageLiteralNode) Value

func (n *MessageLiteralNode) Value() interface{}

type MessageNode

type MessageNode struct {
	Keyword    *IdentNode        `protobuf:"bytes,1,opt,name=keyword,proto3" json:"keyword,omitempty"`
	Name       *IdentNode        `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	OpenBrace  *RuneNode         `protobuf:"bytes,3,opt,name=openBrace,proto3" json:"openBrace,omitempty"`
	Decls      []*MessageElement `protobuf:"bytes,4,rep,name=decls,proto3" json:"decls,omitempty"`
	CloseBrace *RuneNode         `protobuf:"bytes,5,opt,name=closeBrace,proto3" json:"closeBrace,omitempty"`
	Semicolon  *RuneNode         `protobuf:"bytes,6,opt,name=semicolon,proto3" json:"semicolon,omitempty"`
	// contains filtered or unexported fields
}

MessageNode represents a message declaration. Example:

message Foo {
  string name = 1;
  repeated string labels = 2;
  bytes extra = 3;
}

func (*MessageNode) AsFileElement

func (n *MessageNode) AsFileElement() *FileElement

func (*MessageNode) AsMessageDeclNode

func (n *MessageNode) AsMessageDeclNode() *MessageDeclNode

func (*MessageNode) AsMessageElement

func (n *MessageNode) AsMessageElement() *MessageElement

func (*MessageNode) Descriptor deprecated

func (*MessageNode) Descriptor() ([]byte, []int)

Deprecated: Use MessageNode.ProtoReflect.Descriptor instead.

func (*MessageNode) End

func (m *MessageNode) End() Token

func (*MessageNode) GetCloseBrace

func (x *MessageNode) GetCloseBrace() *RuneNode

func (*MessageNode) GetDecls

func (x *MessageNode) GetDecls() []*MessageElement

func (*MessageNode) GetElements

func (e *MessageNode) GetElements() []*MessageElement

func (*MessageNode) GetKeyword

func (x *MessageNode) GetKeyword() *IdentNode

func (*MessageNode) GetName

func (x *MessageNode) GetName() *IdentNode

func (*MessageNode) GetOpenBrace

func (x *MessageNode) GetOpenBrace() *RuneNode

func (*MessageNode) GetSemicolon

func (x *MessageNode) GetSemicolon() *RuneNode

func (*MessageNode) MessageName

func (n *MessageNode) MessageName() Node

func (*MessageNode) ProtoMessage

func (*MessageNode) ProtoMessage()

func (*MessageNode) ProtoPath

func (*MessageNode) ProtoPath() messageNodePathBuilder

func (*MessageNode) ProtoReflect

func (x *MessageNode) ProtoReflect() protoreflect.Message

func (*MessageNode) Reset

func (x *MessageNode) Reset()

func (*MessageNode) Start

func (m *MessageNode) Start() Token

func (*MessageNode) String

func (x *MessageNode) String() string

type NamedNode

type NamedNode interface {
	Node
	GetName() *IdentNode
}

type NegativeIntLiteralNode

type NegativeIntLiteralNode struct {
	Minus *RuneNode        `protobuf:"bytes,1,opt,name=minus,proto3" json:"minus,omitempty"`
	Uint  *UintLiteralNode `protobuf:"bytes,2,opt,name=uint,proto3" json:"uint,omitempty"`
	// contains filtered or unexported fields
}

NegativeIntLiteralNode represents an integer literal with a negative (-) sign.

func (*NegativeIntLiteralNode) AsInt64

func (n *NegativeIntLiteralNode) AsInt64() (int64, bool)

func (*NegativeIntLiteralNode) AsIntValueNode

func (n *NegativeIntLiteralNode) AsIntValueNode() *IntValueNode

func (*NegativeIntLiteralNode) AsUint64

func (n *NegativeIntLiteralNode) AsUint64() (uint64, bool)

func (*NegativeIntLiteralNode) AsValueNode

func (n *NegativeIntLiteralNode) AsValueNode() *ValueNode

func (*NegativeIntLiteralNode) Descriptor deprecated

func (*NegativeIntLiteralNode) Descriptor() ([]byte, []int)

Deprecated: Use NegativeIntLiteralNode.ProtoReflect.Descriptor instead.

func (*NegativeIntLiteralNode) End

func (n *NegativeIntLiteralNode) End() Token

func (*NegativeIntLiteralNode) GetMinus

func (x *NegativeIntLiteralNode) GetMinus() *RuneNode

func (*NegativeIntLiteralNode) GetUint

func (*NegativeIntLiteralNode) ProtoMessage

func (*NegativeIntLiteralNode) ProtoMessage()

func (*NegativeIntLiteralNode) ProtoPath

func (*NegativeIntLiteralNode) ProtoPath() negativeIntLiteralNodePathBuilder

func (*NegativeIntLiteralNode) ProtoReflect

func (x *NegativeIntLiteralNode) ProtoReflect() protoreflect.Message

func (*NegativeIntLiteralNode) Reset

func (x *NegativeIntLiteralNode) Reset()

func (*NegativeIntLiteralNode) Start

func (n *NegativeIntLiteralNode) Start() Token

func (*NegativeIntLiteralNode) String

func (x *NegativeIntLiteralNode) String() string

func (*NegativeIntLiteralNode) Value

func (n *NegativeIntLiteralNode) Value() interface{}

type NoSourceNode

type NoSourceNode struct {
	Filename string `protobuf:"bytes,1,opt,name=filename,proto3" json:"filename,omitempty"`
	// contains filtered or unexported fields
}

NoSourceNode is a placeholder AST node that implements numerous interfaces in this package. It can be used to represent an AST element for a file whose source is not available.

func (*NoSourceNode) Descriptor deprecated

func (*NoSourceNode) Descriptor() ([]byte, []int)

Deprecated: Use NoSourceNode.ProtoReflect.Descriptor instead.

func (*NoSourceNode) End

func (n *NoSourceNode) End() Token

func (*NoSourceNode) GetFilename

func (x *NoSourceNode) GetFilename() string

func (*NoSourceNode) ProtoMessage

func (*NoSourceNode) ProtoMessage()

func (*NoSourceNode) ProtoPath

func (*NoSourceNode) ProtoPath() noSourceNodePathBuilder

func (*NoSourceNode) ProtoReflect

func (x *NoSourceNode) ProtoReflect() protoreflect.Message

func (*NoSourceNode) Reset

func (x *NoSourceNode) Reset()

func (*NoSourceNode) Start

func (n *NoSourceNode) Start() Token

func (*NoSourceNode) String

func (x *NoSourceNode) String() string

type Node

type Node interface {
	protoreflect.ProtoMessage

	Start() Token
	End() Token
}

Node is the interface implemented by all nodes in the AST. It provides information about the span of this AST node in terms of location in the source file. It also provides information about all prior comments (attached as leading comments) and optional subsequent comments (attached as trailing comments).

func TryUnwrap

func TryUnwrap(node Node) (Node, protoreflect.FieldDescriptor)

func Unwrap

func Unwrap(node Node) Node

type NodeInfo

type NodeInfo struct {
	// contains filtered or unexported fields
}

NodeInfo represents the details for a node or token in the source file's AST. It provides access to information about the node's location in the source file. It also provides access to the original text in the source file (with all the original formatting intact) and also provides access to surrounding comments.

func (NodeInfo) End

func (n NodeInfo) End() SourcePos

End returns the ending position of the element, exclusive. This is the location after the last character of the node or token. If n returns the same position for Start() and End(), the element in source had a length of zero (which should only happen for the special EOF token that designates the end of the file).

func (NodeInfo) Internal

func (n NodeInfo) Internal() nodeInfoInternal

Returns an interface that allows limited access to internal node information. This should only be used for optimization purposes in places where this info would otherwise still be obtainable, but with a performance cost. This should not be considered part of the public NodeInfo API.

func (NodeInfo) IsValid

func (n NodeInfo) IsValid() bool

IsValid returns true if this node info is valid. If n is a zero-value struct, it is not valid.

func (NodeInfo) LeadingComments

func (n NodeInfo) LeadingComments() Comments

LeadingComments returns all comments in the source that exist between the element and the previous element, except for any trailing comment on the previous element.

func (NodeInfo) LeadingWhitespace

func (n NodeInfo) LeadingWhitespace() string

LeadingWhitespace returns any whitespace prior to the element. If there were comments in between this element and the previous one, this will return the whitespace between the last such comment in the element. If there were no such comments, this returns the whitespace between the previous element and the current one.

func (NodeInfo) RawText

func (n NodeInfo) RawText() string

RawText returns the actual text in the source file that corresponds to the element. If the element is a node in the AST that encompasses multiple items (like an entire declaration), the full text of all items is returned including any interior whitespace and comments.

func (NodeInfo) Start

func (n NodeInfo) Start() SourcePos

Start returns the starting position of the element. This is the first character of the node or token.

func (NodeInfo) String

func (n NodeInfo) String() string

func (NodeInfo) TrailingComments

func (n NodeInfo) TrailingComments() Comments

TrailingComments returns the trailing comment for the element, if any. An element will have a trailing comment only if it is the last token on a line and is followed by a comment on the same line. Typically, the following comment is a line-style comment (starting with "//").

If the following comment is a block-style comment that spans multiple lines, and the next token is on the same line as the end of the comment, the comment is NOT considered a trailing comment.

Examples:

foo // this is a trailing comment for foo

bar /* this is a trailing comment for bar */

baz /* this is a trailing
       comment for baz */

fizz /* this is NOT a trailing
        comment for fizz because
        its on the same line as the
        following token buzz */       buzz

type NodeReference

type NodeReference struct {
	Node
	NodeInfo
}

func NewNodeReference

func NewNodeReference[F interface{ NodeInfo(Node) NodeInfo }](f F, node Node) NodeReference

type OneofElement

type OneofElement struct {

	// Types that are assignable to Val:
	//
	//	*OneofElement_Option
	//	*OneofElement_Field
	//	*OneofElement_Group
	Val isOneofElement_Val `protobuf_oneof:"val"`
	// contains filtered or unexported fields
}

func (*OneofElement) Descriptor deprecated

func (*OneofElement) Descriptor() ([]byte, []int)

Deprecated: Use OneofElement.ProtoReflect.Descriptor instead.

func (*OneofElement) End

func (n *OneofElement) End() Token

func (*OneofElement) GetField

func (x *OneofElement) GetField() *FieldNode

func (*OneofElement) GetGroup

func (x *OneofElement) GetGroup() *GroupNode

func (*OneofElement) GetOption

func (x *OneofElement) GetOption() *OptionNode

func (*OneofElement) GetVal

func (m *OneofElement) GetVal() isOneofElement_Val

func (*OneofElement) ProtoMessage

func (*OneofElement) ProtoMessage()

func (*OneofElement) ProtoPath

func (*OneofElement) ProtoPath() oneofElementPathBuilder

func (*OneofElement) ProtoReflect

func (x *OneofElement) ProtoReflect() protoreflect.Message

func (*OneofElement) Reset

func (x *OneofElement) Reset()

func (*OneofElement) Start

func (n *OneofElement) Start() Token

func (*OneofElement) String

func (x *OneofElement) String() string

func (*OneofElement) Unwrap

func (n *OneofElement) Unwrap() AnyOneofElement

type OneofElement_Field

type OneofElement_Field struct {
	Field *FieldNode `protobuf:"bytes,2,opt,name=field,proto3,oneof"`
}

type OneofElement_Group

type OneofElement_Group struct {
	Group *GroupNode `protobuf:"bytes,3,opt,name=group,proto3,oneof"`
}

type OneofElement_Option

type OneofElement_Option struct {
	Option *OptionNode `protobuf:"bytes,1,opt,name=option,proto3,oneof"`
}

type OneofNode

type OneofNode struct {
	Keyword    *IdentNode      `protobuf:"bytes,1,opt,name=keyword,proto3" json:"keyword,omitempty"`
	Name       *IdentNode      `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	OpenBrace  *RuneNode       `protobuf:"bytes,3,opt,name=openBrace,proto3" json:"openBrace,omitempty"`
	Decls      []*OneofElement `protobuf:"bytes,4,rep,name=decls,proto3" json:"decls,omitempty"`
	CloseBrace *RuneNode       `protobuf:"bytes,5,opt,name=closeBrace,proto3" json:"closeBrace,omitempty"`
	Semicolon  *RuneNode       `protobuf:"bytes,6,opt,name=semicolon,proto3" json:"semicolon,omitempty"`
	// contains filtered or unexported fields
}

OneofNode represents a one-of declaration. Example:

oneof query {
  string by_name = 2;
  Type by_type = 3;
  Address by_address = 4;
  Labels by_label = 5;
}

func (*OneofNode) AsMessageElement

func (n *OneofNode) AsMessageElement() *MessageElement

func (*OneofNode) Descriptor deprecated

func (*OneofNode) Descriptor() ([]byte, []int)

Deprecated: Use OneofNode.ProtoReflect.Descriptor instead.

func (*OneofNode) End

func (n *OneofNode) End() Token

func (*OneofNode) GetCloseBrace

func (x *OneofNode) GetCloseBrace() *RuneNode

func (*OneofNode) GetDecls

func (x *OneofNode) GetDecls() []*OneofElement

func (*OneofNode) GetElements

func (n *OneofNode) GetElements() []*OneofElement

func (*OneofNode) GetKeyword

func (x *OneofNode) GetKeyword() *IdentNode

func (*OneofNode) GetName

func (x *OneofNode) GetName() *IdentNode

func (*OneofNode) GetOpenBrace

func (x *OneofNode) GetOpenBrace() *RuneNode

func (*OneofNode) GetSemicolon

func (x *OneofNode) GetSemicolon() *RuneNode

func (*OneofNode) ProtoMessage

func (*OneofNode) ProtoMessage()

func (*OneofNode) ProtoPath

func (*OneofNode) ProtoPath() oneofNodePathBuilder

func (*OneofNode) ProtoReflect

func (x *OneofNode) ProtoReflect() protoreflect.Message

func (*OneofNode) Reset

func (x *OneofNode) Reset()

func (*OneofNode) Start

func (n *OneofNode) Start() Token

func (*OneofNode) String

func (x *OneofNode) String() string

type OptionNameNode

type OptionNameNode struct {

	// List of name parts in token order. Values in this list are either
	// field references or dots.
	Parts []*ComplexIdentComponent `protobuf:"bytes,1,rep,name=parts,proto3" json:"parts,omitempty"`
	// contains filtered or unexported fields
}

OptionNameNode represents an option name or even a traversal through message types to name a nested option field. Example:

(foo.bar).baz.(bob)

func OptionNameNodeFromIdentValue

func OptionNameNodeFromIdentValue(ident *IdentValueNode) *OptionNameNode

func (*OptionNameNode) Descriptor deprecated

func (*OptionNameNode) Descriptor() ([]byte, []int)

Deprecated: Use OptionNameNode.ProtoReflect.Descriptor instead.

func (*OptionNameNode) End

func (n *OptionNameNode) End() Token

func (*OptionNameNode) FilterFieldReferences

func (e *OptionNameNode) FilterFieldReferences() []*FieldReferenceNode

func (*OptionNameNode) GetParts

func (x *OptionNameNode) GetParts() []*ComplexIdentComponent

func (*OptionNameNode) IsIncomplete

func (n *OptionNameNode) IsIncomplete() bool

func (*OptionNameNode) ProtoMessage

func (*OptionNameNode) ProtoMessage()

func (*OptionNameNode) ProtoPath

func (*OptionNameNode) ProtoPath() optionNameNodePathBuilder

func (*OptionNameNode) ProtoReflect

func (x *OptionNameNode) ProtoReflect() protoreflect.Message

func (*OptionNameNode) Reset

func (x *OptionNameNode) Reset()

func (*OptionNameNode) Split

func (e *OptionNameNode) Split() ([]*FieldReferenceNode, []*RuneNode)

func (*OptionNameNode) Start

func (n *OptionNameNode) Start() Token

func (*OptionNameNode) String

func (x *OptionNameNode) String() string

type OptionNode

type OptionNode struct {
	Keyword   *IdentNode      `protobuf:"bytes,1,opt,name=keyword,proto3" json:"keyword,omitempty"` // absent for compact options
	Name      *OptionNameNode `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	Equals    *RuneNode       `protobuf:"bytes,3,opt,name=equals,proto3" json:"equals,omitempty"`
	Val       *ValueNode      `protobuf:"bytes,4,opt,name=val,proto3" json:"val,omitempty"`
	Semicolon *RuneNode       `protobuf:"bytes,5,opt,name=semicolon,proto3" json:"semicolon,omitempty"` // for compact options, this is actually a comma
	// contains filtered or unexported fields
}

OptionNode represents the declaration of a single option for an element. It is used both for normal option declarations (start with "option" keyword and end with semicolon) and for compact options found in fields, enum values, and extension ranges. Example:

option (custom.option) = "foo";

func (*OptionNode) AsEnumElement

func (n *OptionNode) AsEnumElement() *EnumElement

func (*OptionNode) AsFileElement

func (n *OptionNode) AsFileElement() *FileElement

func (*OptionNode) AsMessageElement

func (n *OptionNode) AsMessageElement() *MessageElement

func (*OptionNode) AsOneofElement

func (n *OptionNode) AsOneofElement() *OneofElement

func (*OptionNode) AsRPCElement

func (n *OptionNode) AsRPCElement() *RPCElement

func (*OptionNode) AsServiceElement

func (n *OptionNode) AsServiceElement() *ServiceElement

func (*OptionNode) Descriptor deprecated

func (*OptionNode) Descriptor() ([]byte, []int)

Deprecated: Use OptionNode.ProtoReflect.Descriptor instead.

func (*OptionNode) End

func (n *OptionNode) End() Token

func (*OptionNode) GetEquals

func (x *OptionNode) GetEquals() *RuneNode

func (*OptionNode) GetKeyword

func (x *OptionNode) GetKeyword() *IdentNode

func (*OptionNode) GetName

func (x *OptionNode) GetName() *OptionNameNode

func (*OptionNode) GetSemicolon

func (x *OptionNode) GetSemicolon() *RuneNode

func (*OptionNode) GetVal

func (x *OptionNode) GetVal() *ValueNode

func (*OptionNode) IsIncomplete

func (n *OptionNode) IsIncomplete() bool

func (*OptionNode) ProtoMessage

func (*OptionNode) ProtoMessage()

func (*OptionNode) ProtoPath

func (*OptionNode) ProtoPath() optionNodePathBuilder

func (*OptionNode) ProtoReflect

func (x *OptionNode) ProtoReflect() protoreflect.Message

func (*OptionNode) Reset

func (x *OptionNode) Reset()

func (*OptionNode) SourceInfoEnd

func (n *OptionNode) SourceInfoEnd() Token

func (*OptionNode) Start

func (n *OptionNode) Start() Token

func (*OptionNode) String

func (x *OptionNode) String() string

type PackageNode

type PackageNode struct {
	Keyword   *IdentNode      `protobuf:"bytes,1,opt,name=keyword,proto3" json:"keyword,omitempty"`
	Name      *IdentValueNode `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	Semicolon *RuneNode       `protobuf:"bytes,3,opt,name=semicolon,proto3" json:"semicolon,omitempty"`
	// contains filtered or unexported fields
}

PackageNode represents a package declaration. Example:

package foobar.com;

func (*PackageNode) AsFileElement

func (n *PackageNode) AsFileElement() *FileElement

func (*PackageNode) Descriptor deprecated

func (*PackageNode) Descriptor() ([]byte, []int)

Deprecated: Use PackageNode.ProtoReflect.Descriptor instead.

func (*PackageNode) End

func (m *PackageNode) End() Token

func (*PackageNode) GetKeyword

func (x *PackageNode) GetKeyword() *IdentNode

func (*PackageNode) GetName

func (x *PackageNode) GetName() *IdentValueNode

func (*PackageNode) GetSemicolon

func (x *PackageNode) GetSemicolon() *RuneNode

func (*PackageNode) IsIncomplete

func (p *PackageNode) IsIncomplete() bool

func (*PackageNode) ProtoMessage

func (*PackageNode) ProtoMessage()

func (*PackageNode) ProtoPath

func (*PackageNode) ProtoPath() packageNodePathBuilder

func (*PackageNode) ProtoReflect

func (x *PackageNode) ProtoReflect() protoreflect.Message

func (*PackageNode) Reset

func (x *PackageNode) Reset()

func (*PackageNode) Start

func (m *PackageNode) Start() Token

func (*PackageNode) String

func (x *PackageNode) String() string

type RPCElement

type RPCElement struct {

	// Types that are assignable to Val:
	//
	//	*RPCElement_Option
	Val isRPCElement_Val `protobuf_oneof:"val"`
	// contains filtered or unexported fields
}

RPCElement is an interface implemented by all AST nodes that can appear in the body of an rpc declaration (aka method).

func (*RPCElement) Descriptor deprecated

func (*RPCElement) Descriptor() ([]byte, []int)

Deprecated: Use RPCElement.ProtoReflect.Descriptor instead.

func (*RPCElement) End

func (n *RPCElement) End() Token

func (*RPCElement) GetOption

func (x *RPCElement) GetOption() *OptionNode

func (*RPCElement) GetVal

func (m *RPCElement) GetVal() isRPCElement_Val

func (*RPCElement) ProtoMessage

func (*RPCElement) ProtoMessage()

func (*RPCElement) ProtoPath

func (*RPCElement) ProtoPath() rPCElementPathBuilder

func (*RPCElement) ProtoReflect

func (x *RPCElement) ProtoReflect() protoreflect.Message

func (*RPCElement) Reset

func (x *RPCElement) Reset()

func (*RPCElement) Start

func (n *RPCElement) Start() Token

func (*RPCElement) String

func (x *RPCElement) String() string

func (*RPCElement) Unwrap

func (n *RPCElement) Unwrap() AnyRPCElement

type RPCElement_Option

type RPCElement_Option struct {
	Option *OptionNode `protobuf:"bytes,1,opt,name=option,proto3,oneof"`
}

type RPCNode

type RPCNode struct {
	Keyword    *IdentNode    `protobuf:"bytes,1,opt,name=keyword,proto3" json:"keyword,omitempty"`
	Name       *IdentNode    `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	Input      *RPCTypeNode  `protobuf:"bytes,3,opt,name=input,proto3" json:"input,omitempty"`
	Returns    *IdentNode    `protobuf:"bytes,4,opt,name=returns,proto3" json:"returns,omitempty"`
	Output     *RPCTypeNode  `protobuf:"bytes,5,opt,name=output,proto3" json:"output,omitempty"`
	OpenBrace  *RuneNode     `protobuf:"bytes,6,opt,name=openBrace,proto3" json:"openBrace,omitempty"`
	Decls      []*RPCElement `protobuf:"bytes,7,rep,name=decls,proto3" json:"decls,omitempty"`
	CloseBrace *RuneNode     `protobuf:"bytes,8,opt,name=closeBrace,proto3" json:"closeBrace,omitempty"`
	Semicolon  *RuneNode     `protobuf:"bytes,9,opt,name=semicolon,proto3" json:"semicolon,omitempty"`
	// contains filtered or unexported fields
}

RPCNode represents an RPC declaration. Example:

rpc Foo (Bar) returns (Baz);

func (*RPCNode) AsServiceElement

func (n *RPCNode) AsServiceElement() *ServiceElement

func (*RPCNode) Descriptor deprecated

func (*RPCNode) Descriptor() ([]byte, []int)

Deprecated: Use RPCNode.ProtoReflect.Descriptor instead.

func (*RPCNode) End

func (n *RPCNode) End() Token

func (*RPCNode) GetCloseBrace

func (x *RPCNode) GetCloseBrace() *RuneNode

func (*RPCNode) GetDecls

func (x *RPCNode) GetDecls() []*RPCElement

func (*RPCNode) GetInput

func (x *RPCNode) GetInput() *RPCTypeNode

func (*RPCNode) GetKeyword

func (x *RPCNode) GetKeyword() *IdentNode

func (*RPCNode) GetName

func (x *RPCNode) GetName() *IdentNode

func (*RPCNode) GetOpenBrace

func (x *RPCNode) GetOpenBrace() *RuneNode

func (*RPCNode) GetOutput

func (x *RPCNode) GetOutput() *RPCTypeNode

func (*RPCNode) GetReturns

func (x *RPCNode) GetReturns() *IdentNode

func (*RPCNode) GetSemicolon

func (x *RPCNode) GetSemicolon() *RuneNode

func (*RPCNode) IsIncomplete

func (n *RPCNode) IsIncomplete() bool

func (*RPCNode) ProtoMessage

func (*RPCNode) ProtoMessage()

func (*RPCNode) ProtoPath

func (*RPCNode) ProtoPath() rPCNodePathBuilder

func (*RPCNode) ProtoReflect

func (x *RPCNode) ProtoReflect() protoreflect.Message

func (*RPCNode) Reset

func (x *RPCNode) Reset()

func (*RPCNode) Start

func (n *RPCNode) Start() Token

func (*RPCNode) String

func (x *RPCNode) String() string

type RPCTypeNode

type RPCTypeNode struct {
	OpenParen   *RuneNode       `protobuf:"bytes,1,opt,name=openParen,proto3" json:"openParen,omitempty"`
	Stream      *IdentNode      `protobuf:"bytes,2,opt,name=stream,proto3" json:"stream,omitempty"`
	MessageType *IdentValueNode `protobuf:"bytes,3,opt,name=messageType,proto3" json:"messageType,omitempty"`
	CloseParen  *RuneNode       `protobuf:"bytes,4,opt,name=closeParen,proto3" json:"closeParen,omitempty"`
	Semicolon   *RuneNode       `protobuf:"bytes,5,opt,name=semicolon,proto3" json:"semicolon,omitempty"`
	// contains filtered or unexported fields
}

RPCTypeNode represents the declaration of a request or response type for an RPC. Example:

(stream foo.Bar)

func (*RPCTypeNode) Descriptor deprecated

func (*RPCTypeNode) Descriptor() ([]byte, []int)

Deprecated: Use RPCTypeNode.ProtoReflect.Descriptor instead.

func (*RPCTypeNode) End

func (n *RPCTypeNode) End() Token

func (*RPCTypeNode) GetCloseParen

func (x *RPCTypeNode) GetCloseParen() *RuneNode

func (*RPCTypeNode) GetMessageType

func (x *RPCTypeNode) GetMessageType() *IdentValueNode

func (*RPCTypeNode) GetOpenParen

func (x *RPCTypeNode) GetOpenParen() *RuneNode

func (*RPCTypeNode) GetSemicolon

func (x *RPCTypeNode) GetSemicolon() *RuneNode

func (*RPCTypeNode) GetStream

func (x *RPCTypeNode) GetStream() *IdentNode

func (*RPCTypeNode) IsIncomplete

func (n *RPCTypeNode) IsIncomplete() bool

func (*RPCTypeNode) ProtoMessage

func (*RPCTypeNode) ProtoMessage()

func (*RPCTypeNode) ProtoPath

func (*RPCTypeNode) ProtoPath() rPCTypeNodePathBuilder

func (*RPCTypeNode) ProtoReflect

func (x *RPCTypeNode) ProtoReflect() protoreflect.Message

func (*RPCTypeNode) Reset

func (x *RPCTypeNode) Reset()

func (*RPCTypeNode) Start

func (n *RPCTypeNode) Start() Token

func (*RPCTypeNode) String

func (x *RPCTypeNode) String() string

type RangeElement

type RangeElement struct {

	// Types that are assignable to Val:
	//
	//	*RangeElement_Range
	//	*RangeElement_Comma
	Val isRangeElement_Val `protobuf_oneof:"val"`
	// contains filtered or unexported fields
}

func (*RangeElement) Descriptor deprecated

func (*RangeElement) Descriptor() ([]byte, []int)

Deprecated: Use RangeElement.ProtoReflect.Descriptor instead.

func (*RangeElement) End

func (n *RangeElement) End() Token

func (*RangeElement) GetComma

func (x *RangeElement) GetComma() *RuneNode

func (*RangeElement) GetRange

func (x *RangeElement) GetRange() *RangeNode

func (*RangeElement) GetVal

func (m *RangeElement) GetVal() isRangeElement_Val

func (*RangeElement) ProtoMessage

func (*RangeElement) ProtoMessage()

func (*RangeElement) ProtoPath

func (*RangeElement) ProtoPath() rangeElementPathBuilder

func (*RangeElement) ProtoReflect

func (x *RangeElement) ProtoReflect() protoreflect.Message

func (*RangeElement) Reset

func (x *RangeElement) Reset()

func (*RangeElement) Start

func (n *RangeElement) Start() Token

func (*RangeElement) String

func (x *RangeElement) String() string

func (*RangeElement) ToReservedElement

func (n *RangeElement) ToReservedElement() *ReservedElement

func (*RangeElement) Unwrap

func (n *RangeElement) Unwrap() AnyRangeElement

type RangeElement_Comma

type RangeElement_Comma struct {
	Comma *RuneNode `protobuf:"bytes,2,opt,name=comma,proto3,oneof"`
}

type RangeElement_Range

type RangeElement_Range struct {
	Range *RangeNode `protobuf:"bytes,1,opt,name=range,proto3,oneof"`
}

type RangeNode

type RangeNode struct {
	StartVal *IntValueNode `protobuf:"bytes,1,opt,name=startVal,proto3" json:"startVal,omitempty"`
	// if To is non-nil, then exactly one of EndVal or Max must also be non-nil
	To *IdentNode `protobuf:"bytes,2,opt,name=to,proto3" json:"to,omitempty"`
	// EndVal and Max are mutually exclusive
	EndVal *IntValueNode `protobuf:"bytes,3,opt,name=endVal,proto3" json:"endVal,omitempty"`
	Max    *IdentNode    `protobuf:"bytes,4,opt,name=max,proto3" json:"max,omitempty"`
	// contains filtered or unexported fields
}

RangeNode represents a range expression, used in both extension ranges and reserved ranges. Example:

1000 to max

func (*RangeNode) AsRangeElement

func (n *RangeNode) AsRangeElement() *RangeElement

func (*RangeNode) AsReservedElement

func (n *RangeNode) AsReservedElement() *ReservedElement

func (*RangeNode) Descriptor deprecated

func (*RangeNode) Descriptor() ([]byte, []int)

Deprecated: Use RangeNode.ProtoReflect.Descriptor instead.

func (*RangeNode) End

func (n *RangeNode) End() Token

func (*RangeNode) EndValue

func (n *RangeNode) EndValue() any

func (*RangeNode) EndValueAsInt32

func (n *RangeNode) EndValueAsInt32(min, max int32) (int32, bool)

func (*RangeNode) GetEndVal

func (x *RangeNode) GetEndVal() *IntValueNode

func (*RangeNode) GetMax

func (x *RangeNode) GetMax() *IdentNode

func (*RangeNode) GetStartVal

func (x *RangeNode) GetStartVal() *IntValueNode

func (*RangeNode) GetTo

func (x *RangeNode) GetTo() *IdentNode

func (*RangeNode) ProtoMessage

func (*RangeNode) ProtoMessage()

func (*RangeNode) ProtoPath

func (*RangeNode) ProtoPath() rangeNodePathBuilder

func (*RangeNode) ProtoReflect

func (x *RangeNode) ProtoReflect() protoreflect.Message

func (*RangeNode) RangeEnd

func (n *RangeNode) RangeEnd() Node

func (*RangeNode) RangeStart

func (n *RangeNode) RangeStart() Node

func (*RangeNode) Reset

func (x *RangeNode) Reset()

func (*RangeNode) Start

func (n *RangeNode) Start() Token

func (*RangeNode) StartValue

func (n *RangeNode) StartValue() any

func (*RangeNode) StartValueAsInt32

func (n *RangeNode) StartValueAsInt32(min, max int32) (int32, bool)

func (*RangeNode) String

func (x *RangeNode) String() string

type ReservedElement

type ReservedElement struct {

	// Types that are assignable to Val:
	//
	//	*ReservedElement_Range
	//	*ReservedElement_Name
	//	*ReservedElement_Identifier
	//	*ReservedElement_Comma
	Val isReservedElement_Val `protobuf_oneof:"val"`
	// contains filtered or unexported fields
}

func RangeElementsToReservedElements

func RangeElementsToReservedElements(n []*RangeElement) []*ReservedElement

func (*ReservedElement) Descriptor deprecated

func (*ReservedElement) Descriptor() ([]byte, []int)

Deprecated: Use ReservedElement.ProtoReflect.Descriptor instead.

func (*ReservedElement) End

func (n *ReservedElement) End() Token

func (*ReservedElement) GetComma

func (x *ReservedElement) GetComma() *RuneNode

func (*ReservedElement) GetIdentifier

func (x *ReservedElement) GetIdentifier() *IdentNode

func (*ReservedElement) GetName

func (x *ReservedElement) GetName() *StringValueNode

func (*ReservedElement) GetRange

func (x *ReservedElement) GetRange() *RangeNode

func (*ReservedElement) GetVal

func (m *ReservedElement) GetVal() isReservedElement_Val

func (*ReservedElement) ProtoMessage

func (*ReservedElement) ProtoMessage()

func (*ReservedElement) ProtoPath

func (*ReservedElement) ProtoPath() reservedElementPathBuilder

func (*ReservedElement) ProtoReflect

func (x *ReservedElement) ProtoReflect() protoreflect.Message

func (*ReservedElement) Reset

func (x *ReservedElement) Reset()

func (*ReservedElement) Start

func (n *ReservedElement) Start() Token

func (*ReservedElement) String

func (x *ReservedElement) String() string

func (*ReservedElement) Unwrap

func (n *ReservedElement) Unwrap() AnyReservedElement

type ReservedElement_Comma

type ReservedElement_Comma struct {
	Comma *RuneNode `protobuf:"bytes,4,opt,name=comma,proto3,oneof"`
}

type ReservedElement_Identifier

type ReservedElement_Identifier struct {
	// A reserved name (used in editions)
	Identifier *IdentNode `protobuf:"bytes,3,opt,name=identifier,proto3,oneof"`
}

type ReservedElement_Name

type ReservedElement_Name struct {
	// A reserved name (used in in proto2 and proto3 syntax)
	Name *StringValueNode `protobuf:"bytes,2,opt,name=name,proto3,oneof"`
}

type ReservedElement_Range

type ReservedElement_Range struct {
	// A numeric range of reserved numbers.
	Range *RangeNode `protobuf:"bytes,1,opt,name=range,proto3,oneof"`
}

type ReservedNode

type ReservedNode struct {
	Keyword *IdentNode `protobuf:"bytes,1,opt,name=keyword,proto3" json:"keyword,omitempty"`
	// A list of all elements in token order. Values in this list contain either
	// ranges, string literals, or identifiers, interspersed with commas. A
	// valid reserved node must only contain a single kind of element (not
	// including commas).
	Elements  []*ReservedElement `protobuf:"bytes,2,rep,name=elements,proto3" json:"elements,omitempty"`
	Semicolon *RuneNode          `protobuf:"bytes,6,opt,name=semicolon,proto3" json:"semicolon,omitempty"`
	// contains filtered or unexported fields
}

ReservedNode represents reserved declaration, which can be used to reserve either names or numbers. Examples:

reserved 1, 10-12, 15;
reserved "foo", "bar", "baz";
reserved foo, bar, baz;

func (*ReservedNode) AsEnumElement

func (n *ReservedNode) AsEnumElement() *EnumElement

func (*ReservedNode) AsMessageElement

func (n *ReservedNode) AsMessageElement() *MessageElement

func (*ReservedNode) Descriptor deprecated

func (*ReservedNode) Descriptor() ([]byte, []int)

Deprecated: Use ReservedNode.ProtoReflect.Descriptor instead.

func (*ReservedNode) End

func (n *ReservedNode) End() Token

func (*ReservedNode) FilterCommas

func (r *ReservedNode) FilterCommas() []*RuneNode

func (*ReservedNode) FilterIdentifiers

func (r *ReservedNode) FilterIdentifiers() []*IdentNode

func (*ReservedNode) FilterNames

func (r *ReservedNode) FilterNames() []*StringValueNode

func (*ReservedNode) FilterRanges

func (r *ReservedNode) FilterRanges() []*RangeNode

func (*ReservedNode) GetElements

func (x *ReservedNode) GetElements() []*ReservedElement

func (*ReservedNode) GetKeyword

func (x *ReservedNode) GetKeyword() *IdentNode

func (*ReservedNode) GetSemicolon

func (x *ReservedNode) GetSemicolon() *RuneNode

func (*ReservedNode) ProtoMessage

func (*ReservedNode) ProtoMessage()

func (*ReservedNode) ProtoPath

func (*ReservedNode) ProtoPath() reservedNodePathBuilder

func (*ReservedNode) ProtoReflect

func (x *ReservedNode) ProtoReflect() protoreflect.Message

func (*ReservedNode) Reset

func (x *ReservedNode) Reset()

func (*ReservedNode) Start

func (n *ReservedNode) Start() Token

func (*ReservedNode) String

func (x *ReservedNode) String() string

type RuneNode

type RuneNode struct {
	Token Token `protobuf:"varint,1,opt,name=token,proto3,enum=ast.Token" json:"token,omitempty"`
	Rune  int32 `protobuf:"varint,2,opt,name=rune,proto3" json:"rune,omitempty"`
	// Virtual is true if this rune is not actually present in the source file,
	// but is instead injected by the lexer to satisfy certain grammar rules.
	Virtual bool `protobuf:"varint,3,opt,name=virtual,proto3" json:"virtual,omitempty"`
	// contains filtered or unexported fields
}

RuneNode represents a single rune in protobuf source. Runes are typically collected into items, but some runes stand on their own, such as punctuation/symbols like commas, semicolons, equals signs, open and close symbols (braces, brackets, angles, and parentheses), and periods/dots. TODO: make this more compact; if runes don't have attributed comments then we don't need a Token to represent them and only need an offset into the file's contents.

func (*RuneNode) AsArrayLiteralElement

func (n *RuneNode) AsArrayLiteralElement() *ArrayLiteralElement

func (*RuneNode) AsComplexIdentComponent

func (n *RuneNode) AsComplexIdentComponent() *ComplexIdentComponent

func (*RuneNode) AsRangeElement

func (n *RuneNode) AsRangeElement() *RangeElement

func (*RuneNode) AsReservedElement

func (n *RuneNode) AsReservedElement() *ReservedElement

func (*RuneNode) Descriptor deprecated

func (*RuneNode) Descriptor() ([]byte, []int)

Deprecated: Use RuneNode.ProtoReflect.Descriptor instead.

func (*RuneNode) End

func (n *RuneNode) End() Token

func (*RuneNode) GetRune

func (x *RuneNode) GetRune() int32

func (*RuneNode) GetToken

func (x *RuneNode) GetToken() Token

func (*RuneNode) GetVirtual

func (x *RuneNode) GetVirtual() bool

func (*RuneNode) ProtoMessage

func (*RuneNode) ProtoMessage()

func (*RuneNode) ProtoPath

func (*RuneNode) ProtoPath() runeNodePathBuilder

func (*RuneNode) ProtoReflect

func (x *RuneNode) ProtoReflect() protoreflect.Message

func (*RuneNode) Reset

func (x *RuneNode) Reset()

func (*RuneNode) Start

func (n *RuneNode) Start() Token

func (*RuneNode) String

func (x *RuneNode) String() string

type Sequence

type Sequence[T any] interface {
	// First returns the first element in the sequence. The bool return
	// is false if this sequence contains no elements. For example, an
	// empty file has no items or tokens.
	First() (T, bool)
	// Next returns the next element in the sequence that comes after
	// the given element. The bool returns is false if there is no next
	// item (i.e. the given element is the last one). It also returns
	// false if the given element is invalid.
	Next(T) (T, bool)
	// Last returns the last element in the sequence. The bool return
	// is false if this sequence contains no elements. For example, an
	// empty file has no items or tokens.
	Last() (T, bool)
	// Previous returns the previous element in the sequence that comes
	// before the given element. The bool returns is false if there is no
	// previous item (i.e. the given element is the first one). It also
	// returns false if the given element is invalid.
	Previous(T) (T, bool)
}

Sequence represents a navigable sequence of elements.

type ServiceElement

type ServiceElement struct {

	// Types that are assignable to Val:
	//
	//	*ServiceElement_Option
	//	*ServiceElement_Rpc
	Val isServiceElement_Val `protobuf_oneof:"val"`
	// contains filtered or unexported fields
}

func (*ServiceElement) Descriptor deprecated

func (*ServiceElement) Descriptor() ([]byte, []int)

Deprecated: Use ServiceElement.ProtoReflect.Descriptor instead.

func (*ServiceElement) End

func (n *ServiceElement) End() Token

func (*ServiceElement) GetOption

func (x *ServiceElement) GetOption() *OptionNode

func (*ServiceElement) GetRpc

func (x *ServiceElement) GetRpc() *RPCNode

func (*ServiceElement) GetVal

func (m *ServiceElement) GetVal() isServiceElement_Val

func (*ServiceElement) ProtoMessage

func (*ServiceElement) ProtoMessage()

func (*ServiceElement) ProtoPath

func (*ServiceElement) ProtoPath() serviceElementPathBuilder

func (*ServiceElement) ProtoReflect

func (x *ServiceElement) ProtoReflect() protoreflect.Message

func (*ServiceElement) Reset

func (x *ServiceElement) Reset()

func (*ServiceElement) Start

func (n *ServiceElement) Start() Token

func (*ServiceElement) String

func (x *ServiceElement) String() string

func (*ServiceElement) Unwrap

func (n *ServiceElement) Unwrap() AnyServiceElement

type ServiceElement_Option

type ServiceElement_Option struct {
	Option *OptionNode `protobuf:"bytes,1,opt,name=option,proto3,oneof"`
}

type ServiceElement_Rpc

type ServiceElement_Rpc struct {
	Rpc *RPCNode `protobuf:"bytes,2,opt,name=rpc,proto3,oneof"`
}

type ServiceNode

type ServiceNode struct {
	Keyword    *IdentNode        `protobuf:"bytes,1,opt,name=keyword,proto3" json:"keyword,omitempty"`
	Name       *IdentNode        `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	OpenBrace  *RuneNode         `protobuf:"bytes,3,opt,name=openBrace,proto3" json:"openBrace,omitempty"`
	Decls      []*ServiceElement `protobuf:"bytes,4,rep,name=decls,proto3" json:"decls,omitempty"`
	CloseBrace *RuneNode         `protobuf:"bytes,5,opt,name=closeBrace,proto3" json:"closeBrace,omitempty"`
	Semicolon  *RuneNode         `protobuf:"bytes,6,opt,name=semicolon,proto3" json:"semicolon,omitempty"`
	// contains filtered or unexported fields
}

ServiceNode represents a service declaration. Example:

service Foo {
  rpc Bar (Baz) returns (Bob);
  rpc Frobnitz (stream Parts) returns (Gyzmeaux);
}

func (*ServiceNode) AsFileElement

func (n *ServiceNode) AsFileElement() *FileElement

func (*ServiceNode) Descriptor deprecated

func (*ServiceNode) Descriptor() ([]byte, []int)

Deprecated: Use ServiceNode.ProtoReflect.Descriptor instead.

func (*ServiceNode) End

func (s *ServiceNode) End() Token

func (*ServiceNode) GetCloseBrace

func (x *ServiceNode) GetCloseBrace() *RuneNode

func (*ServiceNode) GetDecls

func (x *ServiceNode) GetDecls() []*ServiceElement

func (*ServiceNode) GetKeyword

func (x *ServiceNode) GetKeyword() *IdentNode

func (*ServiceNode) GetName

func (x *ServiceNode) GetName() *IdentNode

func (*ServiceNode) GetOpenBrace

func (x *ServiceNode) GetOpenBrace() *RuneNode

func (*ServiceNode) GetSemicolon

func (x *ServiceNode) GetSemicolon() *RuneNode

func (*ServiceNode) ProtoMessage

func (*ServiceNode) ProtoMessage()

func (*ServiceNode) ProtoPath

func (*ServiceNode) ProtoPath() serviceNodePathBuilder

func (*ServiceNode) ProtoReflect

func (x *ServiceNode) ProtoReflect() protoreflect.Message

func (*ServiceNode) Reset

func (x *ServiceNode) Reset()

func (*ServiceNode) Start

func (s *ServiceNode) Start() Token

func (*ServiceNode) String

func (x *ServiceNode) String() string

type SignedFloatLiteralNode

type SignedFloatLiteralNode struct {
	Sign  *RuneNode       `protobuf:"bytes,1,opt,name=sign,proto3" json:"sign,omitempty"`
	Float *FloatValueNode `protobuf:"bytes,2,opt,name=float,proto3" json:"float,omitempty"`
	// contains filtered or unexported fields
}

SignedFloatLiteralNode represents a signed floating point number.

func (*SignedFloatLiteralNode) AsFloat

func (n *SignedFloatLiteralNode) AsFloat() float64

func (*SignedFloatLiteralNode) AsValueNode

func (n *SignedFloatLiteralNode) AsValueNode() *ValueNode

func (*SignedFloatLiteralNode) Descriptor deprecated

func (*SignedFloatLiteralNode) Descriptor() ([]byte, []int)

Deprecated: Use SignedFloatLiteralNode.ProtoReflect.Descriptor instead.

func (*SignedFloatLiteralNode) End

func (n *SignedFloatLiteralNode) End() Token

func (*SignedFloatLiteralNode) GetFloat

func (x *SignedFloatLiteralNode) GetFloat() *FloatValueNode

func (*SignedFloatLiteralNode) GetSign

func (x *SignedFloatLiteralNode) GetSign() *RuneNode

func (*SignedFloatLiteralNode) ProtoMessage

func (*SignedFloatLiteralNode) ProtoMessage()

func (*SignedFloatLiteralNode) ProtoPath

func (*SignedFloatLiteralNode) ProtoPath() signedFloatLiteralNodePathBuilder

func (*SignedFloatLiteralNode) ProtoReflect

func (x *SignedFloatLiteralNode) ProtoReflect() protoreflect.Message

func (*SignedFloatLiteralNode) Reset

func (x *SignedFloatLiteralNode) Reset()

func (*SignedFloatLiteralNode) Start

func (n *SignedFloatLiteralNode) Start() Token

func (*SignedFloatLiteralNode) String

func (x *SignedFloatLiteralNode) String() string

func (*SignedFloatLiteralNode) Value

func (n *SignedFloatLiteralNode) Value() interface{}

type SourcePos

type SourcePos struct {
	Filename string
	// The line and column numbers for this position. These are
	// one-based, so the first line and column is 1 (not zero). If
	// either is zero, then the line and column are unknown and
	// only the file name is known.
	Line, Col int
	// The offset, in bytes, from the beginning of the file. This
	// is zero-based: the first character in the file is offset zero.
	Offset int
}

SourcePos identifies a location in a proto source file.

func UnknownPos

func UnknownPos(filename string) SourcePos

UnknownPos is a placeholder position when only the source file name is known.

func (SourcePos) String

func (pos SourcePos) String() string

type SourceSpan

type SourceSpan interface {
	fmt.Stringer
	Start() SourcePos
	End() SourcePos
}

func NewSourceSpan

func NewSourceSpan(start SourcePos, end SourcePos) SourceSpan

func UnknownSpan

func UnknownSpan(filename string) SourceSpan

unknownSpan is a placeholder span when only the source file name is known.

type SpecialFloatLiteralNode

type SpecialFloatLiteralNode struct {
	Keyword *IdentNode `protobuf:"bytes,1,opt,name=keyword,proto3" json:"keyword,omitempty"`
	Val     float64    `protobuf:"fixed64,2,opt,name=val,proto3" json:"val,omitempty"`
	// contains filtered or unexported fields
}

SpecialFloatLiteralNode represents a special floating point numeric literal for "inf" and "nan" values.

func NewSpecialFloatLiteralNode

func NewSpecialFloatLiteralNode(name *IdentNode) *SpecialFloatLiteralNode

NewSpecialFloatLiteralNode returns a new *SpecialFloatLiteralNode for the given keyword. The given keyword should be "inf", "infinity", or "nan" in any case.

func (*SpecialFloatLiteralNode) AsFloat

func (n *SpecialFloatLiteralNode) AsFloat() float64

func (*SpecialFloatLiteralNode) AsFloatValueNode

func (n *SpecialFloatLiteralNode) AsFloatValueNode() *FloatValueNode

func (*SpecialFloatLiteralNode) AsValueNode

func (n *SpecialFloatLiteralNode) AsValueNode() *ValueNode

func (*SpecialFloatLiteralNode) Descriptor deprecated

func (*SpecialFloatLiteralNode) Descriptor() ([]byte, []int)

Deprecated: Use SpecialFloatLiteralNode.ProtoReflect.Descriptor instead.

func (*SpecialFloatLiteralNode) End

func (n *SpecialFloatLiteralNode) End() Token

func (*SpecialFloatLiteralNode) GetKeyword

func (x *SpecialFloatLiteralNode) GetKeyword() *IdentNode

func (*SpecialFloatLiteralNode) GetVal

func (x *SpecialFloatLiteralNode) GetVal() float64

func (*SpecialFloatLiteralNode) ProtoMessage

func (*SpecialFloatLiteralNode) ProtoMessage()

func (*SpecialFloatLiteralNode) ProtoPath

func (*SpecialFloatLiteralNode) ProtoPath() specialFloatLiteralNodePathBuilder

func (*SpecialFloatLiteralNode) ProtoReflect

func (x *SpecialFloatLiteralNode) ProtoReflect() protoreflect.Message

func (*SpecialFloatLiteralNode) Reset

func (x *SpecialFloatLiteralNode) Reset()

func (*SpecialFloatLiteralNode) Start

func (n *SpecialFloatLiteralNode) Start() Token

func (*SpecialFloatLiteralNode) String

func (x *SpecialFloatLiteralNode) String() string

func (*SpecialFloatLiteralNode) Value

func (n *SpecialFloatLiteralNode) Value() interface{}

type StringLiteralNode

type StringLiteralNode struct {
	Token Token `protobuf:"varint,1,opt,name=token,proto3,enum=ast.Token" json:"token,omitempty"`
	// Val is the actual string value that the literal indicates.
	Val string `protobuf:"bytes,2,opt,name=val,proto3" json:"val,omitempty"`
	// Raw is the original string representation of the literal as it appeared
	// in the source file.
	Raw []byte `protobuf:"bytes,3,opt,name=raw,proto3" json:"raw,omitempty"`
	// contains filtered or unexported fields
}

StringLiteralNode represents a simple string literal. Example:

"proto2"

func (*StringLiteralNode) AsString

func (n *StringLiteralNode) AsString() string

func (*StringLiteralNode) AsStringValueNode

func (n *StringLiteralNode) AsStringValueNode() *StringValueNode

func (*StringLiteralNode) AsValueNode

func (n *StringLiteralNode) AsValueNode() *ValueNode

func (*StringLiteralNode) Descriptor deprecated

func (*StringLiteralNode) Descriptor() ([]byte, []int)

Deprecated: Use StringLiteralNode.ProtoReflect.Descriptor instead.

func (*StringLiteralNode) End

func (n *StringLiteralNode) End() Token

func (*StringLiteralNode) GetRaw

func (x *StringLiteralNode) GetRaw() []byte

func (*StringLiteralNode) GetToken

func (x *StringLiteralNode) GetToken() Token

func (*StringLiteralNode) GetVal

func (x *StringLiteralNode) GetVal() string

func (*StringLiteralNode) ProtoMessage

func (*StringLiteralNode) ProtoMessage()

func (*StringLiteralNode) ProtoPath

func (*StringLiteralNode) ProtoPath() stringLiteralNodePathBuilder

func (*StringLiteralNode) ProtoReflect

func (x *StringLiteralNode) ProtoReflect() protoreflect.Message

func (*StringLiteralNode) Reset

func (x *StringLiteralNode) Reset()

func (*StringLiteralNode) Start

func (n *StringLiteralNode) Start() Token

func (*StringLiteralNode) String

func (x *StringLiteralNode) String() string

func (*StringLiteralNode) Value

func (n *StringLiteralNode) Value() interface{}

type StringValueNode

type StringValueNode struct {

	// Types that are assignable to Val:
	//
	//	*StringValueNode_StringLiteral
	//	*StringValueNode_CompoundStringLiteral
	Val isStringValueNode_Val `protobuf_oneof:"val"`
	// contains filtered or unexported fields
}

StringValueNode is an AST node that represents a string literal. Such a node can be a single literal (*StringLiteralNode) or a concatenation of multiple literals (*CompoundStringLiteralNode).

func (*StringValueNode) AsReservedElement

func (n *StringValueNode) AsReservedElement() *ReservedElement

func (*StringValueNode) AsString

func (s *StringValueNode) AsString() string

func (*StringValueNode) AsValueNode

func (s *StringValueNode) AsValueNode() *ValueNode

func (*StringValueNode) Descriptor deprecated

func (*StringValueNode) Descriptor() ([]byte, []int)

Deprecated: Use StringValueNode.ProtoReflect.Descriptor instead.

func (*StringValueNode) End

func (s *StringValueNode) End() Token

func (*StringValueNode) GetCompoundStringLiteral

func (x *StringValueNode) GetCompoundStringLiteral() *CompoundStringLiteralNode

func (*StringValueNode) GetStringLiteral

func (x *StringValueNode) GetStringLiteral() *StringLiteralNode

func (*StringValueNode) GetVal

func (m *StringValueNode) GetVal() isStringValueNode_Val

func (*StringValueNode) ProtoMessage

func (*StringValueNode) ProtoMessage()

func (*StringValueNode) ProtoPath

func (*StringValueNode) ProtoPath() stringValueNodePathBuilder

func (*StringValueNode) ProtoReflect

func (x *StringValueNode) ProtoReflect() protoreflect.Message

func (*StringValueNode) Reset

func (x *StringValueNode) Reset()

func (*StringValueNode) Start

func (s *StringValueNode) Start() Token

func (*StringValueNode) String

func (x *StringValueNode) String() string

func (*StringValueNode) Unwrap

func (n *StringValueNode) Unwrap() AnyStringValueNode

type StringValueNode_CompoundStringLiteral

type StringValueNode_CompoundStringLiteral struct {
	CompoundStringLiteral *CompoundStringLiteralNode `protobuf:"bytes,2,opt,name=compoundStringLiteral,proto3,oneof"`
}

type StringValueNode_StringLiteral

type StringValueNode_StringLiteral struct {
	StringLiteral *StringLiteralNode `protobuf:"bytes,1,opt,name=stringLiteral,proto3,oneof"`
}

type SyntaxNode

type SyntaxNode struct {
	Keyword   *IdentNode       `protobuf:"bytes,1,opt,name=keyword,proto3" json:"keyword,omitempty"`
	Equals    *RuneNode        `protobuf:"bytes,2,opt,name=equals,proto3" json:"equals,omitempty"`
	Syntax    *StringValueNode `protobuf:"bytes,3,opt,name=syntax,proto3" json:"syntax,omitempty"`
	Semicolon *RuneNode        `protobuf:"bytes,4,opt,name=semicolon,proto3" json:"semicolon,omitempty"`
	// contains filtered or unexported fields
}

SyntaxNode represents a syntax declaration, which if present must be the first non-comment content. Example:

syntax = "proto2";

Files that don't have a syntax node are assumed to use proto2 syntax.

func (*SyntaxNode) Descriptor deprecated

func (*SyntaxNode) Descriptor() ([]byte, []int)

Deprecated: Use SyntaxNode.ProtoReflect.Descriptor instead.

func (*SyntaxNode) End

func (m *SyntaxNode) End() Token

func (*SyntaxNode) GetEquals

func (x *SyntaxNode) GetEquals() *RuneNode

func (*SyntaxNode) GetKeyword

func (x *SyntaxNode) GetKeyword() *IdentNode

func (*SyntaxNode) GetSemicolon

func (x *SyntaxNode) GetSemicolon() *RuneNode

func (*SyntaxNode) GetSyntax

func (x *SyntaxNode) GetSyntax() *StringValueNode

func (*SyntaxNode) ProtoMessage

func (*SyntaxNode) ProtoMessage()

func (*SyntaxNode) ProtoPath

func (*SyntaxNode) ProtoPath() syntaxNodePathBuilder

func (*SyntaxNode) ProtoReflect

func (x *SyntaxNode) ProtoReflect() protoreflect.Message

func (*SyntaxNode) Reset

func (x *SyntaxNode) Reset()

func (*SyntaxNode) Start

func (m *SyntaxNode) Start() Token

func (*SyntaxNode) String

func (x *SyntaxNode) String() string

type SyntheticMapField

type SyntheticMapField struct {
	Name      *IdentNode       `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	FieldType *IdentValueNode  `protobuf:"bytes,2,opt,name=fieldType,proto3" json:"fieldType,omitempty"`
	Tag       *UintLiteralNode `protobuf:"bytes,3,opt,name=tag,proto3" json:"tag,omitempty"`
	// contains filtered or unexported fields
}

SyntheticMapField is not an actual node in the AST but a synthetic node that implements FieldDeclNode. These are used to represent the implicit field declarations of the "key" and "value" fields in a map entry.

func (*SyntheticMapField) AsFieldDeclNode

func (n *SyntheticMapField) AsFieldDeclNode() *FieldDeclNode

func (*SyntheticMapField) Descriptor deprecated

func (*SyntheticMapField) Descriptor() ([]byte, []int)

Deprecated: Use SyntheticMapField.ProtoReflect.Descriptor instead.

func (*SyntheticMapField) End

func (n *SyntheticMapField) End() Token

func (*SyntheticMapField) GetFieldType

func (x *SyntheticMapField) GetFieldType() *IdentValueNode

func (*SyntheticMapField) GetFieldTypeNode

func (n *SyntheticMapField) GetFieldTypeNode() Node

func (*SyntheticMapField) GetLabel

func (n *SyntheticMapField) GetLabel() *IdentNode

func (*SyntheticMapField) GetName

func (x *SyntheticMapField) GetName() *IdentNode

func (*SyntheticMapField) GetOptions

func (n *SyntheticMapField) GetOptions() *CompactOptionsNode

func (*SyntheticMapField) GetTag

func (x *SyntheticMapField) GetTag() *UintLiteralNode

func (*SyntheticMapField) ProtoMessage

func (*SyntheticMapField) ProtoMessage()

func (*SyntheticMapField) ProtoPath

func (*SyntheticMapField) ProtoPath() syntheticMapFieldPathBuilder

func (*SyntheticMapField) ProtoReflect

func (x *SyntheticMapField) ProtoReflect() protoreflect.Message

func (*SyntheticMapField) Reset

func (x *SyntheticMapField) Reset()

func (*SyntheticMapField) Start

func (n *SyntheticMapField) Start() Token

func (*SyntheticMapField) String

func (x *SyntheticMapField) String() string

type TerminalNode

type TerminalNode interface {
	Node
	GetToken() Token
}

TerminalNode represents a leaf in the AST. These represent the items/lexemes in the protobuf language. Comments and whitespace are accumulated by the lexer and associated with the following lexed token.

type Token

type Token int32

Token represents a single lexed token.

const (
	Token_Unknown Token = 0
	// TokenError indicates an invalid token. It is returned from query
	// functions when no valid token satisfies the request.
	Token_Error Token = -1
)

func (Token) AsItem

func (t Token) AsItem() Item

AsItem returns the Item that corresponds to t.

func (Token) Descriptor

func (Token) Descriptor() protoreflect.EnumDescriptor

func (Token) Enum

func (x Token) Enum() *Token

func (Token) EnumDescriptor deprecated

func (Token) EnumDescriptor() ([]byte, []int)

Deprecated: Use Token.Descriptor instead.

func (Token) Number

func (x Token) Number() protoreflect.EnumNumber

func (Token) String

func (x Token) String() string

func (Token) Type

func (Token) Type() protoreflect.EnumType

type UintLiteralNode

type UintLiteralNode struct {
	Token Token `protobuf:"varint,1,opt,name=token,proto3,enum=ast.Token" json:"token,omitempty"`
	// Val is the numeric value indicated by the literal
	Val uint64 `protobuf:"varint,2,opt,name=val,proto3" json:"val,omitempty"`
	// Raw is the original string representation of the literal
	Raw string `protobuf:"bytes,3,opt,name=raw,proto3" json:"raw,omitempty"`
	// contains filtered or unexported fields
}

UintLiteralNode represents a simple integer literal with no sign character.

func (*UintLiteralNode) AsFloat

func (n *UintLiteralNode) AsFloat() float64

func (*UintLiteralNode) AsFloatValueNode

func (n *UintLiteralNode) AsFloatValueNode() *FloatValueNode

func (*UintLiteralNode) AsInt64

func (n *UintLiteralNode) AsInt64() (int64, bool)

func (*UintLiteralNode) AsIntValueNode

func (n *UintLiteralNode) AsIntValueNode() *IntValueNode

func (*UintLiteralNode) AsUint64

func (n *UintLiteralNode) AsUint64() (uint64, bool)

func (*UintLiteralNode) AsValueNode

func (n *UintLiteralNode) AsValueNode() *ValueNode

func (*UintLiteralNode) Descriptor deprecated

func (*UintLiteralNode) Descriptor() ([]byte, []int)

Deprecated: Use UintLiteralNode.ProtoReflect.Descriptor instead.

func (*UintLiteralNode) End

func (n *UintLiteralNode) End() Token

func (*UintLiteralNode) GetRaw

func (x *UintLiteralNode) GetRaw() string

func (*UintLiteralNode) GetToken

func (x *UintLiteralNode) GetToken() Token

func (*UintLiteralNode) GetVal

func (x *UintLiteralNode) GetVal() uint64

func (*UintLiteralNode) ProtoMessage

func (*UintLiteralNode) ProtoMessage()

func (*UintLiteralNode) ProtoPath

func (*UintLiteralNode) ProtoPath() uintLiteralNodePathBuilder

func (*UintLiteralNode) ProtoReflect

func (x *UintLiteralNode) ProtoReflect() protoreflect.Message

func (*UintLiteralNode) Reset

func (x *UintLiteralNode) Reset()

func (*UintLiteralNode) Start

func (n *UintLiteralNode) Start() Token

func (*UintLiteralNode) String

func (x *UintLiteralNode) String() string

func (*UintLiteralNode) Value

func (n *UintLiteralNode) Value() interface{}

type ValueNode

type ValueNode struct {

	// Types that are assignable to Val:
	//
	//	*ValueNode_Ident
	//	*ValueNode_CompoundIdent
	//	*ValueNode_StringLiteral
	//	*ValueNode_CompoundStringLiteral
	//	*ValueNode_UintLiteral
	//	*ValueNode_NegativeIntLiteral
	//	*ValueNode_FloatLiteral
	//	*ValueNode_SpecialFloatLiteral
	//	*ValueNode_SignedFloatLiteral
	//	*ValueNode_ArrayLiteral
	//	*ValueNode_MessageLiteral
	Val isValueNode_Val `protobuf_oneof:"val"`
	// contains filtered or unexported fields
}

ValueNode is an AST node that represents a literal value.

It also includes references (e.g. IdentifierValueNode), which can be used as values in some contexts, such as describing the default value for a field, which can refer to an enum value.

This also allows NoSourceNode to be used in place of a real value node for some usages.

func (*ValueNode) AsArrayLiteralElement

func (n *ValueNode) AsArrayLiteralElement() *ArrayLiteralElement

func (*ValueNode) Descriptor deprecated

func (*ValueNode) Descriptor() ([]byte, []int)

Deprecated: Use ValueNode.ProtoReflect.Descriptor instead.

func (*ValueNode) End

func (v *ValueNode) End() Token

func (*ValueNode) GetArrayLiteral

func (x *ValueNode) GetArrayLiteral() *ArrayLiteralNode

func (*ValueNode) GetCompoundIdent

func (x *ValueNode) GetCompoundIdent() *CompoundIdentNode

func (*ValueNode) GetCompoundStringLiteral

func (x *ValueNode) GetCompoundStringLiteral() *CompoundStringLiteralNode

func (*ValueNode) GetFloatLiteral

func (x *ValueNode) GetFloatLiteral() *FloatLiteralNode

func (*ValueNode) GetIdent

func (x *ValueNode) GetIdent() *IdentNode

func (*ValueNode) GetMessageLiteral

func (x *ValueNode) GetMessageLiteral() *MessageLiteralNode

func (*ValueNode) GetNegativeIntLiteral

func (x *ValueNode) GetNegativeIntLiteral() *NegativeIntLiteralNode

func (*ValueNode) GetSignedFloatLiteral

func (x *ValueNode) GetSignedFloatLiteral() *SignedFloatLiteralNode

func (*ValueNode) GetSpecialFloatLiteral

func (x *ValueNode) GetSpecialFloatLiteral() *SpecialFloatLiteralNode

func (*ValueNode) GetStringLiteral

func (x *ValueNode) GetStringLiteral() *StringLiteralNode

func (*ValueNode) GetUintLiteral

func (x *ValueNode) GetUintLiteral() *UintLiteralNode

func (*ValueNode) GetVal

func (m *ValueNode) GetVal() isValueNode_Val

func (*ValueNode) HasValue

func (n *ValueNode) HasValue() bool

func (*ValueNode) ProtoMessage

func (*ValueNode) ProtoMessage()

func (*ValueNode) ProtoPath

func (*ValueNode) ProtoPath() valueNodePathBuilder

func (*ValueNode) ProtoReflect

func (x *ValueNode) ProtoReflect() protoreflect.Message

func (*ValueNode) Reset

func (x *ValueNode) Reset()

func (*ValueNode) Start

func (v *ValueNode) Start() Token

func (*ValueNode) String

func (x *ValueNode) String() string

func (*ValueNode) Unwrap

func (n *ValueNode) Unwrap() AnyValueNode

func (*ValueNode) Value

func (v *ValueNode) Value() any

Value returns a Go representation of the value. For scalars, this will be a string, int64, uint64, float64, or bool. This could also be an Identifier (e.g. IdentValueNodes). It can also be a composite literal:

  • For array literals, the type returned will be []ValueNode
  • For message literals, the type returned will be []*MessageFieldNode

If the ValueNode is a NoSourceNode, indicating that there is no actual source code (and thus not AST information), then this method always returns nil.

type ValueNode_ArrayLiteral

type ValueNode_ArrayLiteral struct {
	ArrayLiteral *ArrayLiteralNode `protobuf:"bytes,10,opt,name=arrayLiteral,proto3,oneof"`
}

type ValueNode_CompoundIdent

type ValueNode_CompoundIdent struct {
	CompoundIdent *CompoundIdentNode `protobuf:"bytes,2,opt,name=compoundIdent,proto3,oneof"`
}

type ValueNode_CompoundStringLiteral

type ValueNode_CompoundStringLiteral struct {
	CompoundStringLiteral *CompoundStringLiteralNode `protobuf:"bytes,4,opt,name=compoundStringLiteral,proto3,oneof"`
}

type ValueNode_FloatLiteral

type ValueNode_FloatLiteral struct {
	FloatLiteral *FloatLiteralNode `protobuf:"bytes,7,opt,name=floatLiteral,proto3,oneof"`
}

type ValueNode_Ident

type ValueNode_Ident struct {
	Ident *IdentNode `protobuf:"bytes,1,opt,name=ident,proto3,oneof"`
}

type ValueNode_MessageLiteral

type ValueNode_MessageLiteral struct {
	MessageLiteral *MessageLiteralNode `protobuf:"bytes,11,opt,name=messageLiteral,proto3,oneof"`
}

type ValueNode_NegativeIntLiteral

type ValueNode_NegativeIntLiteral struct {
	NegativeIntLiteral *NegativeIntLiteralNode `protobuf:"bytes,6,opt,name=negativeIntLiteral,proto3,oneof"`
}

type ValueNode_SignedFloatLiteral

type ValueNode_SignedFloatLiteral struct {
	SignedFloatLiteral *SignedFloatLiteralNode `protobuf:"bytes,9,opt,name=signedFloatLiteral,proto3,oneof"`
}

type ValueNode_SpecialFloatLiteral

type ValueNode_SpecialFloatLiteral struct {
	SpecialFloatLiteral *SpecialFloatLiteralNode `protobuf:"bytes,8,opt,name=specialFloatLiteral,proto3,oneof"`
}

type ValueNode_StringLiteral

type ValueNode_StringLiteral struct {
	StringLiteral *StringLiteralNode `protobuf:"bytes,3,opt,name=stringLiteral,proto3,oneof"`
}

type ValueNode_UintLiteral

type ValueNode_UintLiteral struct {
	UintLiteral *UintLiteralNode `protobuf:"bytes,5,opt,name=uintLiteral,proto3,oneof"`
}

type WalkOption

type WalkOption func(*walkOptions)

WalkOption represents an option used with the Walk function. These allow optional before and after hooks to be invoked as each node in the tree is visited.

func WithAfter

func WithAfter(fn func(protopath.Values) error) WalkOption

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. If this hook returns an error, the node is not visited and the walk operation is aborted.

If the walk is aborted due to some other visitor or before hook returning an error, the after hook is still called for all nodes that have been visited. However, the walk operation fails with the first error it encountered, so any error returned from an after hook is effectively ignored.

func WithBefore

func WithBefore(fn func(protopath.Values) error) WalkOption

WithBefore returns a WalkOption that will cause the given function to be invoked before a node is visited during a walk operation. If this hook returns an error, the node is not visited and the walk operation is aborted.

func WithDepthLimit

func WithDepthLimit(limit int) WalkOption

func WithIntersection

func WithIntersection(intersects Token) WalkOption

func WithRange

func WithRange(start, end Token) WalkOption

type WrapperNode

type WrapperNode interface {
	Node
	// contains filtered or unexported methods
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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