Documentation
¶
Overview ¶
Package ast defines the AST data structures used by gotoc.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var FieldTypeMap = map[FieldType]string{ Double: "double", Float: "float", Int64: "int64", Uint64: "uint64", Int32: "int32", Fixed64: "fixed64", Fixed32: "fixed32", Bool: "bool", String: "string", Bytes: "bytes", Uint32: "uint32", Sfixed32: "sfixed32", Sfixed64: "sfixed64", Sint32: "sint32", Sint64: "sint64", }
Functions ¶
This section is empty.
Types ¶
type Comment ¶
Comment represents a comment.
func InlineComment ¶
InlineComment returns the comment on the same line as a node, or nil if there's no inline comment. The returned comment is guaranteed to be a single line.
func LeadingComment ¶
LeadingComment returns the comment that immediately precedes a node, or nil if there's no such comment.
type Enum ¶
type Extension ¶
type Extension struct {
Position Position // position of the "extend" token
Extendee string // the thing being extended
ExtendeeType *Message // set during resolution
Fields []*Field
Up interface{} // either *File or *Message or ...
}
Extension represents an extension definition.
type Field ¶
type Field struct {
Position Position // position of "required"/"optional"/"repeated"/type
// TypeName is the raw name parsed from the input.
// Type is set during resolution; it will be a FieldType, *Message or *Enum.
TypeName string
Type interface{}
// For a map field, the TypeName/Type fields are the value type,
// and KeyTypeName/KeyType will be set.
KeyTypeName string
KeyType FieldType
// At most one of {required,repeated} is set.
Required bool
Repeated bool
Name string
Tag int
HasDefault bool
Default string // e.g. "foo", 7, true
HasPacked bool
Packed bool
Oneof *Oneof
Up Node // either *Message or *Extension
}
Field represents a field in a message.
type FieldType ¶
type FieldType int8
const ( Double FieldType Float Int64 Uint64 Int32 Fixed64 Fixed32 Bool String Bytes Uint32 Sfixed32 Sfixed64 Sint32 Sint64 )
type File ¶
type File struct {
Name string // filename
Syntax string // "proto2" or "proto3"
Package []string
Options [][2]string // slice of key/value pairs
Imports []string
PublicImports []int // list of indexes in the Imports slice
Messages []*Message // top-level messages
Enums []*Enum // top-level enums
Services []*Service // services
Extensions []*Extension // top-level extensions
Comments []*Comment // all the comments for this file, sorted by position
}
File represents a single proto file.
type FileSet ¶
type FileSet struct {
// Files is sorted in topological order, bottom up.
// That means that a file X will only import a file Y
// if Y occurs in this slice before X.
Files []*File
}
FileSet describes a set of proto files.
type Message ¶
type Message struct {
Position Position // position of the "message" token
Name string
Group bool
Fields []*Field
Extensions []*Extension
Oneofs []*Oneof
Messages []*Message // includes groups
Enums []*Enum
ExtensionRanges [][2]int // extension ranges (inclusive at both ends)
Up interface{} // either *File or *Message
}
Message represents a proto message.
type Method ¶
type Method struct {
Position Position // position of the "rpc" token
Name string
// InTypeName/OutTypeName are the raw names parsed from the input.
// InType/OutType is set during resolution; it will be a *Message.
InTypeName, OutTypeName string
InType, OutType interface{}
// ClientStreaming and ServerStreaming indicate whether the argument and
// return value to the rpc are streams.
ClientStreaming, ServerStreaming bool
Up *Service
}
Method represents an RPC method.
Click to show internal directories.
Click to hide internal directories.