sourceWalker

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	GetGoEnv = gltsgsge.GetGoEnv
)
View Source
var KeyWordsList = []string{
	"break",
	"default",
	"func",
	"select",
	"case",
	"defer",
	"go",
	"struct",
	"else",
	"goto",
	"package",
	"switch",
	"const",
	"fallthrough",
	"if",
	"range",
	"type",
	"continue",
	"for",
	"import",
	"return",
	"var",
	"append",
	"cap",
	"close",
	"copy",
	"delete",
	"imag",
	"len",
	"make",
	"new",
	"panic",
	"recover",
}
View Source
var TypesList = []string{
	"chan",
	"map",
	"interface",
	"uint",
	"int",
	"uintptr",
	"uint8",
	"uint16",
	"uint32",
	"uint64",
	"int8",
	"int16",
	"int32",
	"int64",
	"float32",
	"float64",
	"complex64",
	"complex128",
	"byte",
	"rune",
	"true",
	"false",
	"bool",
	"error",
	"string",
	"iota",
	"nil",
	"real",
	"complex",
}

Functions

This section is empty.

Types

type CommentStruct

type CommentStruct struct {
	// Raw, direct from source.
	Text string
	// stored in separated lines
	Lines []string
	// Generally the comment is contained between '/ *' and '* /'
	IsMultiLines bool
}

type Function

type Function struct {
	Ident   identObj
	Content content
	File,
	Name,
	Recv,
	RecvFromSrc,
	Body string

	Exported   bool
	ParamReslt paramReslt
}

type GoSourceFileStruct

type GoSourceFileStruct struct {
	Filename,
	Eol,
	Package,
	GoSourcePath string

	PackageLineIdx int

	Imports []imported
	Func    []Function
	Struct  []Structure
	Var     []Variable
	// contains filtered or unexported fields
}

GoSourceFileStruct: contain AST file information

func GoSourceFileStructNew

func GoSourceFileStructNew() (gsfs *GoSourceFileStruct, err error)

func GoSourcePkgStructSetup

func GoSourcePkgStructSetup(path string) (*GoSourceFileStruct, error)

GoSourcePkgStructSetup: Recover all data from package files.

func (*GoSourceFileStruct) AppendFile

func (gsfs *GoSourceFileStruct) AppendFile(filename string) (err error)

AppendFile:

func (*GoSourceFileStruct) AstToFileAndBBuff

func (gsfs *GoSourceFileStruct) AstToFileAndBBuff(saveToFilename ...string) (bytesBuf *bytes.Buffer, err error)

AstToFileAndByteBuf: to simply display ast content for an overview of declarations. DEBUG purpose ...

func (*GoSourceFileStruct) GetBuildConstraints

func (gsfs *GoSourceFileStruct) GetBuildConstraints() (bDir []string)

func (*GoSourceFileStruct) GetFuncByName

func (gsfs *GoSourceFileStruct) GetFuncByName(fName string, unExported ...bool) (funct *Function)

GetFuncByName: Optional "unExported": empty = both.

func (*GoSourceFileStruct) GetGlobalComments

func (gsfs *GoSourceFileStruct) GetGlobalComments() (cs []CommentStruct)

func (*GoSourceFileStruct) GetImportsOnly

func (gsfs *GoSourceFileStruct) GetImportsOnly(filename string) (err error)

GetImportsOnly: translation to the internal function, designed fo kick use.

func (*GoSourceFileStruct) GetStructByName

func (gsfs *GoSourceFileStruct) GetStructByName(sName string) (stru *Structure)

GetStructByName:

func (*GoSourceFileStruct) GetVarByName

func (gsfs *GoSourceFileStruct) GetVarByName(vName string) (vari *Variable)

GetVarByName: "Position" contain the position in "list" and "values" fields.

func (*GoSourceFileStruct) GoSourceFileStructureSetup

func (gsfs *GoSourceFileStruct) GoSourceFileStructureSetup(filename string, zero ...bool) (err error)

GoSourceFileStructureSetup: setup and retieve information for designed file. Notice: the lines numbers and offsets start at 0. Set "zero" at false to start at 1.

type Structure

type Structure struct {
	Ident   identObj
	Content content
	Fields  []field
	Methods []Function

	File,
	Name string

	Exported bool
}

type Variable

type Variable struct {
	Objects  field
	Content  content
	File     string
	Found    identObj
	Exported bool
}

Jump to

Keyboard shortcuts

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