meta

package
v0.0.0-...-29ffec6 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2017 License: MIT, MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CommentToken_EOF = iota
	CommentToken_LeftBrace
	CommentToken_RightBrace
	CommentToken_WhiteSpace
	CommentToken_LineEnd
	CommentToken_UnixStyleComment
	CommentToken_Identifier
	CommentToken_Unknown
)

自定义的token id

View Source
const (
	Token_EOF = iota
	Token_Unknown
	Token_LineEnd
	Token_Numeral
	Token_String
	Token_WhiteSpace
	Token_Identifier
	Token_UnixComment
	Token_CStyleComment
	Token_Colon       // :
	Token_ParenL      // (
	Token_ParenR      // )
	Token_CurlyBraceL // {
	Token_CurlyBraceR // }
	Token_BracketL    // [
	Token_BracketR    // ]
	Token_Star        // *
	Token_Dot         // .
	Token_Enum        // Enum
	Token_Message     // Message
	Token_FileTag     // fileTag
	Token_Assign      // =
)

自定义的token id

Variables

This section is empty.

Functions

func ParseFileList

func ParseFileList(fileset *FileDescriptorSet, filelist []string) (string, error)

Types

type CommentGroup

type CommentGroup struct {
	Pos golexer.TokenPos

	Leading  string
	Trailing string
	// contains filtered or unexported fields
}

func (*CommentGroup) MatchTag

func (self *CommentGroup) MatchTag(tag string) (string, bool)

func (*CommentGroup) String

func (self *CommentGroup) String() string

type CommentParser

type CommentParser struct {
	*golexer.Parser
}

func NewCommentParser

func NewCommentParser(src string) *CommentParser

type Descriptor

type Descriptor struct {
	*CommentGroup
	Name    string
	SrcName string
	Type    DescriptorType

	Fields      []*FieldDescriptor
	FieldByName map[string]*FieldDescriptor
	FieldByTag  map[int]*FieldDescriptor

	File *FileDescriptor

	TagBase int

	EnumValueIgnoreType bool
}

func (*Descriptor) MaxFieldCount

func (self *Descriptor) MaxFieldCount() int

c# 要使用的fieldcount

func (*Descriptor) MaxTag

func (self *Descriptor) MaxTag() (ret int)

func (*Descriptor) String

func (self *Descriptor) String() string

func (*Descriptor) TypeName

func (self *Descriptor) TypeName() string

type DescriptorType

type DescriptorType int
const (
	DescriptorType_None DescriptorType = iota
	DescriptorType_Enum
	DescriptorType_Struct
)

type FieldDescriptor

type FieldDescriptor struct {
	*CommentGroup
	Name      string
	Type      FieldType
	Tag       int
	AutoTag   int
	Repeatd   bool
	MainIndex *FieldDescriptor
	Complex   *Descriptor

	Struct *Descriptor
}

func (*FieldDescriptor) CompatibleTypeName

func (self *FieldDescriptor) CompatibleTypeName() string

func (*FieldDescriptor) CompatibleTypeString

func (self *FieldDescriptor) CompatibleTypeString() string

func (*FieldDescriptor) ExtendTypePrecision

func (self *FieldDescriptor) ExtendTypePrecision() int

func (*FieldDescriptor) IsExtendType

func (self *FieldDescriptor) IsExtendType() bool

func (*FieldDescriptor) Kind

func (self *FieldDescriptor) Kind() string

func (*FieldDescriptor) String

func (self *FieldDescriptor) String() string

func (*FieldDescriptor) TagNumber

func (self *FieldDescriptor) TagNumber() int

func (*FieldDescriptor) TypeName

func (self *FieldDescriptor) TypeName() string

func (*FieldDescriptor) TypeString

func (self *FieldDescriptor) TypeString() string

type FieldType

type FieldType int
const (
	FieldType_None FieldType = iota
	FieldType_Integer
	FieldType_Int32
	FieldType_Int64
	FieldType_UInt32
	FieldType_UInt64
	FieldType_Bool
	FieldType_String
	FieldType_Struct
	FieldType_Enum
	FieldType_Float32
	FieldType_Float64
	FieldType_Bytes
)

func ParseFieldType

func ParseFieldType(str string) FieldType

func (FieldType) String

func (self FieldType) String() string

type FileDescriptor

type FileDescriptor struct {
	FileName string

	Structs []*Descriptor

	StructByName map[string]*Descriptor

	Enums []*Descriptor

	EnumByName map[string]*Descriptor

	ObjectsBySrcName map[string]*Descriptor
	Objects          []*Descriptor

	FileSet *FileDescriptorSet
	// contains filtered or unexported fields
}

func NewFileDescriptor

func NewFileDescriptor() *FileDescriptor

func (*FileDescriptor) MatchTag

func (self *FileDescriptor) MatchTag(tag string) bool

func (*FileDescriptor) NameExists

func (self *FileDescriptor) NameExists(name string) bool

func (*FileDescriptor) String

func (self *FileDescriptor) String() string

type FileDescriptorSet

type FileDescriptorSet struct {
	Files []*FileDescriptor
	// contains filtered or unexported fields
}

func NewFileDescriptorSet

func NewFileDescriptorSet() *FileDescriptorSet

func ParseFile

func ParseFile(fileName string) (*FileDescriptorSet, error)

type TaggedComment

type TaggedComment struct {
	Name  string
	Value string
}

Jump to

Keyboard shortcuts

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