Documentation ¶
Index ¶
- Constants
- func Extract(targetFile string, config *ExtractConfig) ([]*extractor.FileResult, error)
- func ExtractClazz(targetFile string, config *ExtractConfig) ([]*extractor.ClazzFileResult, error)
- func ExtractFromBytes(content []byte, config *ExtractConfig) (*extractor.FileResult, error)
- func ExtractFromString(content string, config *ExtractConfig) (*extractor.FileResult, error)
- func ExtractFunction(targetFile string, config *ExtractConfig) ([]*extractor.FunctionFileResult, error)
- func ExtractSymbol(targetFile string, config *ExtractConfig) ([]*extractor.SymbolFileResult, error)
- func QueryUnitsByIndexNames[T extractor.DataType](result *extractor.BaseFileResult[T], indexNames ...string) []T
- func QueryUnitsByIndexNamesInFiles[T extractor.DataType](result []*extractor.BaseFileResult[T], indexNames ...string) []T
- func QueryUnitsByLines[T extractor.DataType](result *extractor.BaseFileResult[T], lines ...int) []T
- type AdjacencyMapType
- type ClazzWithPath
- type ExtractConfig
- type FuncGraph
- func (fg *FuncGraph) FindCalls(f *extractor.Function) []*FunctionWithPath
- func (fg *FuncGraph) FindRelated(f *extractor.Function) *FunctionContext
- func (fg *FuncGraph) FindReverseCalls(f *extractor.Function) []*FunctionWithPath
- func (fg *FuncGraph) WrapFuncWithPath(f *extractor.Function) (*FunctionWithPath, error)
- type FuncGraphType
- type FunctionContext
- type FunctionContextSlim
- type FunctionWithPath
- type SymbolWithPath
Constants ¶
const HomePage = "https://github.com/opensibyl/sibyl2"
const Version = "v0.12.0"
Version strictly sync with tag
Variables ¶
This section is empty.
Functions ¶
func Extract ¶
func Extract(targetFile string, config *ExtractConfig) ([]*extractor.FileResult, error)
func ExtractClazz ¶ added in v0.10.0
func ExtractClazz(targetFile string, config *ExtractConfig) ([]*extractor.ClazzFileResult, error)
func ExtractFromBytes ¶
func ExtractFromBytes(content []byte, config *ExtractConfig) (*extractor.FileResult, error)
func ExtractFromString ¶
func ExtractFromString(content string, config *ExtractConfig) (*extractor.FileResult, error)
func ExtractFunction ¶
func ExtractFunction(targetFile string, config *ExtractConfig) ([]*extractor.FunctionFileResult, error)
func ExtractSymbol ¶
func ExtractSymbol(targetFile string, config *ExtractConfig) ([]*extractor.SymbolFileResult, error)
func QueryUnitsByIndexNames ¶
func QueryUnitsByIndexNames[T extractor.DataType](result *extractor.BaseFileResult[T], indexNames ...string) []T
func QueryUnitsByIndexNamesInFiles ¶
func QueryUnitsByIndexNamesInFiles[T extractor.DataType](result []*extractor.BaseFileResult[T], indexNames ...string) []T
func QueryUnitsByLines ¶
func QueryUnitsByLines[T extractor.DataType](result *extractor.BaseFileResult[T], lines ...int) []T
Types ¶
type ClazzWithPath ¶ added in v0.10.0
type ExtractConfig ¶
type ExtractConfig struct { LangType core.LangType ExtractType extractor.ExtractType FileFilter func(path string) bool }
ExtractConfig todo: should not use config ptr for parallel running
func DefaultConfig ¶
func DefaultConfig() *ExtractConfig
type FuncGraph ¶
type FuncGraph struct { ReverseCallGraph *FuncGraphType CallGraph *FuncGraphType }
FuncGraph
It is not a serious `call` graph. It based on references not real calls.
Why we used it: - We can still use something like `method_invocation` - But we mainly use it to evaluate the influence of a method - In many languages, scope of `invocation` is too small - For example, use `function` as a parameter.
func AnalyzeFuncGraph ¶
func AnalyzeFuncGraph(funcFiles []*extractor.FunctionFileResult, symbolFiles []*extractor.SymbolFileResult) (*FuncGraph, error)
func (*FuncGraph) FindCalls ¶
func (fg *FuncGraph) FindCalls(f *extractor.Function) []*FunctionWithPath
func (*FuncGraph) FindRelated ¶
func (fg *FuncGraph) FindRelated(f *extractor.Function) *FunctionContext
func (*FuncGraph) FindReverseCalls ¶
func (fg *FuncGraph) FindReverseCalls(f *extractor.Function) []*FunctionWithPath
func (*FuncGraph) WrapFuncWithPath ¶
func (fg *FuncGraph) WrapFuncWithPath(f *extractor.Function) (*FunctionWithPath, error)
type FuncGraphType ¶
type FuncGraphType struct { graph.Graph[string, *FunctionWithPath] // contains filtered or unexported fields }
func WrapFuncGraph ¶
func WrapFuncGraph(g graph.Graph[string, *FunctionWithPath]) *FuncGraphType
func (*FuncGraphType) GetAdjacencyMap ¶
func (fgt *FuncGraphType) GetAdjacencyMap() (*AdjacencyMapType, error)
type FunctionContext ¶
type FunctionContext struct { *FunctionWithPath Calls []*FunctionWithPath `json:"calls"` ReverseCalls []*FunctionWithPath `json:"reverseCalls"` }
func Json2FuncCtx ¶ added in v0.8.0
func Json2FuncCtx(exported []byte) (*FunctionContext, error)
func (*FunctionContext) ToGraph ¶
func (f *FunctionContext) ToGraph() *FuncGraphType
func (*FunctionContext) ToJson ¶ added in v0.8.0
func (f *FunctionContext) ToJson() ([]byte, error)
func (*FunctionContext) ToMap ¶ added in v0.8.0
func (f *FunctionContext) ToMap() (map[string]any, error)
ToMap export a very simple map without any custom structs. It will lose ptr to origin unit.
func (*FunctionContext) ToSlim ¶ added in v0.12.0
func (f *FunctionContext) ToSlim() *FunctionContextSlim
type FunctionContextSlim ¶ added in v0.12.0
type FunctionContextSlim struct { *FunctionWithPath Calls []string `json:"calls"` ReverseCalls []string `json:"reverseCalls"` }
FunctionContextSlim instead of whole object, slim will only keep the signature
type FunctionWithPath ¶
FunctionWithPath original symbol and function do not have a path because they maybe not come from a real file