github.com/GeniusesGroup/libgo@v0.0.0-20220929090155-5ff932cb408e/go/parser/parse.go (about) 1 /* For license and copyright information please see the LEGAL file in the code repository */ 2 3 package parser 4 5 import ( 6 "go/ast" 7 ) 8 9 // https://github.com/golang/mock/blob/main/mockgen/parse.go 10 // https://github.com/go-gad/sal/blob/master/looker/looker.go 11 12 // File : 13 type File struct { 14 Name string 15 Data []byte 16 Parsed *ast.File 17 } 18 19 // Import : 20 type Import struct { 21 UsageName string 22 PackageName string 23 DependencyID [16]byte // 24 FSPath string // Folder location in FileSystems 25 File *File 26 ImportSpec *ast.ImportSpec 27 } 28 29 // Function store parsed data about logic Function! 30 type Function struct { 31 Name string 32 Comment string 33 Parameter *Type // ChaparKhane just support one variable in Function input! 34 Result *Type // ChaparKhane just support one variable in Function output! 35 Err *Type // ChaparKhane just support one error in Function output! 36 File *File 37 Decl *ast.FuncDecl 38 } 39 40 // Type : 41 type Type struct { 42 Name string 43 ID int 44 Package *Import // If nil means local package not imported! 45 Type string // struct: embedded struct in this struct. 46 Len uint64 // Use in Array, Slice, Map, ... 47 Exported bool 48 Pointer bool 49 InnerType []*Type 50 Tags map[string]string 51 Comment string 52 File *File 53 }