Documentation ¶
Index ¶
- func BytesToString(b []byte) string
- func IsExport(name string) bool
- func ParseDir(path string, filter func(fs.FileInfo) bool, mode parser.Mode) (pkgs map[string]*Package, e error)
- func StringToBytes(s string) []byte
- type Alias
- type ArrayType
- type BinaryExpr
- type CallExpr
- type ChanType
- type Const
- type Field
- type File
- type Func
- type FuncType
- type Ident
- type Import
- type Interface
- type MapType
- type Package
- type SelectorExpr
- type StarExpr
- type Struct
- type TypeExpr
- type ValueExpr
- type ValueSpec
- type Var
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BytesToString ¶
Convert byte slice to string
It doesn't reallocate memory so it's faster than standard conversion
func StringToBytes ¶
Convert string to readonly byte slice
It doesn't reallocate memory so it's faster than standard conversion. But be aware that slices are read-only if written behavior will be unknown.
Types ¶
type BinaryExpr ¶
type BinaryExpr struct {
Expr *ast.BinaryExpr
}
表示一個值
func NewBinaryExpr ¶
func NewBinaryExpr(expr *ast.BinaryExpr) *BinaryExpr
func (*BinaryExpr) String ¶
func (b *BinaryExpr) String() string
type File ¶
type File struct { AST *ast.File // 檔案名稱 Name string // 導入包 Imports []*Import // 定義的 struct Structs []*Struct // 定義的 interface Interfaces []*Interface // 定義的別名 type xxx xxx Alias []*Alias // 定義的常量 Consts []*Const // 定義的變量 Vars []*Var // 定義的函數 Funcs []*Func }
包中的檔案信息
type Import ¶
type Import struct {
AST *ast.ImportSpec
}
func NewImport ¶
func NewImport(imt *ast.ImportSpec) *Import
type Interface ¶
type Interface struct { AST *ast.InterfaceType Name string }
func NewInterface ¶
func NewInterface(name string, it *ast.InterfaceType) *Interface
func (*Interface) IsTemplate ¶
type SelectorExpr ¶
type SelectorExpr struct {
Expr *ast.SelectorExpr
}
表示一個選擇表達式
func NewSelectorExpr ¶
func NewSelectorExpr(expr *ast.SelectorExpr) *SelectorExpr
type Struct ¶
type Struct struct { AST *ast.StructType Name string Fields []*Field }
type ValueSpec ¶
func NewValueSpec ¶
Source Files ¶
- bytes.go
- export.go
- expr_of_binary.go
- expr_of_call.go
- expr_of_chan.go
- expr_of_selector.go
- expr_of_star.go
- expr_of_type.go
- expr_of_value.go
- field.go
- file.go
- ident.go
- package.go
- parse_dir.go
- parse_file.go
- pkg_of_alias.go
- pkg_of_const.go
- pkg_of_func.go
- pkg_of_import.go
- pkg_of_interface.go
- pkg_of_struct.go
- pkg_of_var.go
- spec_of_value.go
- type_of_array.go
- type_of_func.go
- type_of_map.go
Click to show internal directories.
Click to hide internal directories.