Documentation ¶
Index ¶
- func DirIsExist(f string) bool
- func GenImportAlias(path, packageName string, m map[string]string) map[string]string
- func GetArrWord(l []*word) [][]*word
- func GetBrackets(l []*word, start, end string) (int, int)
- func GetBracketsAtString(l []*word, start, end string) (int, int)
- func GetBracketsOrLn(l []*word, start, end string) (int, int, bool)
- func GetFistStr(l []*word) (string, int)
- func GetFistWord(l []*word) (string, int)
- func GetFistWordBehindStr(l []*word, behind string) (string, int)
- func GetImportStrForMap(m map[string]string) string
- func GetLastIsIdentifier(l []*word, start string) (bool, int)
- func GetStrAtEnd(l []*word) (string, int)
- func GetWord(l []*word, n int) (string, int)
- func GetWords(source string) []*word
- func HasPrefix(s, prefix string) bool
- func HasSuffix(s, suffix string) bool
- func InArrString(str string, arr []string) bool
- func IsIdentifier(r int32) bool
- func IsSpaceAndEspecially(r rune) bool
- func NewAst(path string, skips ...map[string]bool) map[string][]GoFileParser
- func NewGoParserForDir(path string) map[string][]GoFileParser
- func NewProtocParserForDir(path string) map[string][]ProtocFileParser
- func NextLine(l []*word) int
- func SortMap(m map[string]string) []string
- func StringToHump(s string) string
- func StringToSnake(s string) string
- type Attr
- type DirInfo
- type Enum
- type FileInfo
- type GoDoc
- type GoFileParser
- type GoFunc
- type GoType
- type GoTypeAttr
- type GoWords
- type Message
- type Option
- type ProtocFileParser
- type Service
- type ServiceRpc
- type TagDoc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DirIsExist ¶
func GenImportAlias ¶
GenImportAlias 生成 import => alias
func GetBrackets ¶
括号引用起来的块, 词性必须是分隔符 返回是开始偏移和结束偏移
func GetBracketsAtString ¶ added in v0.2.5
括号引用起来的块, 不限制分隔符
func GetBracketsOrLn ¶
括号引用起来的块, 或者第一行没有块就换行
func GetFistWordBehindStr ¶
获取某字符串后第一个单词
func GetImportStrForMap ¶
GetImportStrForMap 生成import
func GetLastIsIdentifier ¶
最后一个有意义的符号是否是start(后面跟踪回车、空格、注释不影响, 前面也不能有start)
func InArrString ¶
func IsSpaceAndEspecially ¶ added in v0.0.6
func NewAst ¶ added in v0.4.7
func NewAst(path string, skips ...map[string]bool) map[string][]GoFileParser
func NewGoParserForDir ¶
func NewGoParserForDir(path string) map[string][]GoFileParser
func NewProtocParserForDir ¶
func NewProtocParserForDir(path string) map[string][]ProtocFileParser
Types ¶
type DirInfo ¶
func GetChildrenDir ¶
GetChildrenDir 获取目录和所有子目录
type FileInfo ¶
func GetDirFiles ¶
GetDirFiles 读取目录中的所有文件包括子目录的文件
type GoFileParser ¶
type GoFileParser struct { PackageName string PackageDoc string Imports map[string]string Types map[string]GoType Funds map[string]GoFunc }
GoFileParser 非完整token实现
func GetFileParser ¶
func GetFileParser(path string) (GoFileParser, error)
type GoType ¶
type GoType struct { Doc GoDoc Name string Attrs map[string]GoTypeAttr AttrsSort []string GoFileParser *GoFileParser }
type GoTypeAttr ¶
type GoTypeAttr struct { Name string TypeName string TypeAlias string TypeImport string InPackage bool // 是否本包的引用 Tag map[string]TagDoc GoFileParser *GoFileParser }
func (GoTypeAttr) HasTag ¶
func (receiver GoTypeAttr) HasTag(name string) bool
type ProtocFileParser ¶
type ProtocFileParser struct { Doc string Syntax string PackageName string Imports []string Option map[string]Option Services map[string]Service Messages map[string]Message Enums map[string]Enum }
ProtocFileParser 解释proto文件结构
func GetProtoFileParser ¶
func GetProtoFileParser(path string) (ProtocFileParser, error)
type Service ¶
type Service struct { Protoc *ProtocFileParser Doc string Name string Opt map[string]Option Rpc map[string]ServiceRpc }
type ServiceRpc ¶
Click to show internal directories.
Click to hide internal directories.