scan

package
v0.0.0-...-236707a Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockType

type BlockType uint
const (
	TypeUndefined BlockType = iota
	TypeFunction
	TypeMethod
	TypeStruct
	TypeInterface
	TypeFuncParam
	TypeFuncReturn
	TypeDeferFunc
	TypeGoFunc
	TypeVariableDecl
	TypeConstantDecl
	TypeGenericParam
)

func (BlockType) String

func (b BlockType) String() string

type ElementsExtractor

type ElementsExtractor struct {
	// contains filtered or unexported fields
}

func (*ElementsExtractor) Do

func (e *ElementsExtractor) Do(pos token.Pos, tok token.Token, lit string) Extractor

func (*ElementsExtractor) Done

func (e *ElementsExtractor) Done() bool

type Extractor

type Extractor interface {
	Do(pos token.Pos, tok token.Token, lit string) Extractor
	Done() bool
}

type Filter

type Filter struct {
	// contains filtered or unexported fields
}

func NewFilter

func NewFilter(key string, idx int) Filter

type GenericsExtractor

type GenericsExtractor struct {
	// contains filtered or unexported fields
}

func (*GenericsExtractor) Do

func (e *GenericsExtractor) Do(pos token.Pos, tok token.Token, lit string) Extractor

TODO: needs to be redone with the new design

func (*GenericsExtractor) Done

func (e *GenericsExtractor) Done() bool

type GoFile

type GoFile struct {
	IsMain      bool          `json:"isMain,omitempty"`
	PackageName string        `json:"package,omitempty"`
	Imports     []*Import     `json:"imports,omitempty"`
	LogicBlocks []*LogicBlock `json:"logicBlocks,omitempty"`
	Path        string        `json:"path,omitempty"`
	// contains filtered or unexported fields
}

func New

func New(path string) (*GoFile, error)

func (*GoFile) AddImport

func (f *GoFile) AddImport(i *Import)

func (*GoFile) AddLogicBlock

func (f *GoFile) AddLogicBlock(lb *LogicBlock)

func (*GoFile) Element

func (f *GoFile) Element(idx, depth int) *ElementsExtractor

func (*GoFile) Generics

func (f *GoFile) Generics(idx int) *GenericsExtractor

func (*GoFile) GetLogicBlock

func (f *GoFile) GetLogicBlock(idx int) *LogicBlock

func (*GoFile) Import

func (f *GoFile) Import() *ImportExtractor

func (*GoFile) Interface

func (f *GoFile) Interface(idx, depth int) *InterfaceExtractor

func (*GoFile) LBlock

func (f *GoFile) LBlock(e Extractor, filters ...Filter) *LogicBlockExtractor

func (*GoFile) Package

func (f *GoFile) Package() *PackageExtractor

func (*GoFile) Parse

func (f *GoFile) Parse(fns ...ParseFunc) error

func (*GoFile) SetITFName

func (f *GoFile) SetITFName(idx, iidx int, s string)

func (*GoFile) SetITFType

func (f *GoFile) SetITFType(idx, iidx int)

func (*GoFile) SetLBKind

func (f *GoFile) SetLBKind(idx int, t BlockType)

func (*GoFile) SetLBName

func (f *GoFile) SetLBName(idx int, s string)

func (*GoFile) SetMain

func (f *GoFile) SetMain(b bool)

func (*GoFile) SetPath

func (f *GoFile) SetPath(s string)

func (*GoFile) SetPkgName

func (f *GoFile) SetPkgName(s string)

func (*GoFile) Skip

func (f *GoFile) Skip() *SkipExtractor

func (*GoFile) String

func (f *GoFile) String() string

func (*GoFile) Struct

func (f *GoFile) Struct(idx, depth int) *StructExtractor

func (*GoFile) Type

func (f *GoFile) Type(idx int) *TypeExtractor

type GoFileScanner

type GoFileScanner interface {
	Skip() *SkipExtractor
	Package() *PackageExtractor
	Import() *ImportExtractor
	Type() *TypeExtractor
	Element() *ElementsExtractor
	Generics() *GenericsExtractor
}

type Import

type Import struct {
	Package string `json:"package,omitempty"`
	URI     string `json:"uri,omitempty"`
}

func NewImport

func NewImport(pkg, uri string) *Import

type ImportExtractor

type ImportExtractor struct {
	// contains filtered or unexported fields
}

func (*ImportExtractor) Do

func (e *ImportExtractor) Do(pos token.Pos, tok token.Token, lit string) Extractor

func (*ImportExtractor) Done

func (e *ImportExtractor) Done() bool

type InterfaceExtractor

type InterfaceExtractor struct {
	// contains filtered or unexported fields
}

func (*InterfaceExtractor) Do

func (e *InterfaceExtractor) Do(pos token.Pos, tok token.Token, lit string) Extractor

func (*InterfaceExtractor) Done

func (e *InterfaceExtractor) Done() bool

type LogicBlock

type LogicBlock struct {
	Name         string        `json:"name,omitempty"`
	Type         string        `json:"type,omitempty"`
	Kind         BlockType     `json:"kind,omitempty"`
	Generics     []*LogicBlock `json:"typeConstraints,omitempty"`
	InputParams  []*LogicBlock `json:"inputs,omitempty"`
	ReturnParams []*LogicBlock `json:"returns,omitempty"`
	BlockParams  []*LogicBlock `json:"elements,omitempty"`
	Receivers    *LogicBlock   `json:"receiver,omitempty"`
	Calls        []string      `json:"calls,omitempty"`
	Package      string        `json:"pacakage,omitempty"`
	// contains filtered or unexported fields
}

func (*LogicBlock) AddCall

func (l *LogicBlock) AddCall(s string)

func (*LogicBlock) BlockLen

func (l *LogicBlock) BlockLen() int

func (*LogicBlock) BlockParam

func (l *LogicBlock) BlockParam(idx int) *LogicBlock

func (*LogicBlock) GenericLen

func (l *LogicBlock) GenericLen() int

func (*LogicBlock) GenericParam

func (l *LogicBlock) GenericParam(idx int) *LogicBlock

func (*LogicBlock) InputLen

func (l *LogicBlock) InputLen() int

func (*LogicBlock) InputParam

func (l *LogicBlock) InputParam(idx int) *LogicBlock

func (*LogicBlock) IsFunc

func (l *LogicBlock) IsFunc()

func (*LogicBlock) Receiver

func (l *LogicBlock) Receiver() *LogicBlock

func (*LogicBlock) ReturnLen

func (l *LogicBlock) ReturnLen() int

func (*LogicBlock) ReturnParam

func (l *LogicBlock) ReturnParam(idx int) *LogicBlock

func (*LogicBlock) SetKind

func (l *LogicBlock) SetKind(k BlockType)

func (*LogicBlock) SetName

func (l *LogicBlock) SetName(s string)

func (*LogicBlock) SetPackage

func (l *LogicBlock) SetPackage(s string)

func (*LogicBlock) SetType

func (l *LogicBlock) SetType(s string)

type LogicBlockBuilder

type LogicBlockBuilder interface {
	SetName(string)
	SetType(string)
	SetKind(BlockType)
	GenericParam(idx int) *LogicBlock
	InputParam(idx int) *LogicBlock
	ReturnParam(idx int) *LogicBlock
	BlockParam(idx int) *LogicBlock
	GenericLen() int
	InputLen() int
	ReturnLen() int
	BlockLen() int
	Receiver() *LogicBlock
	AddCall(string)
	SetPackage(string)
	IsFunc()
}

TODO: builder pattern for LogicBlock? because of input / return elements, and so on

type LogicBlockExtractor

type LogicBlockExtractor struct {
	// contains filtered or unexported fields
}

func (*LogicBlockExtractor) Do

func (l *LogicBlockExtractor) Do(pos token.Pos, tok token.Token, lit string) Extractor

func (*LogicBlockExtractor) Done

func (l *LogicBlockExtractor) Done() bool

type Package

type Package struct {
	Name  string   `json:"name,omitempty"`
	Files []GoFile `json:"goFiles,omitempty"`
}

type PackageExtractor

type PackageExtractor struct {
	// contains filtered or unexported fields
}

func (*PackageExtractor) Do

func (e *PackageExtractor) Do(pos token.Pos, tok token.Token, lit string) Extractor

func (*PackageExtractor) Done

func (e *PackageExtractor) Done() bool

type ParseFunc

type ParseFunc func(pos token.Pos, tok token.Token, lit string)

type Project

type Project struct {
	Imports  []string  `json:"imports,omitempty"`
	Packages []Package `json:"packages,omitempty"`
}

type SkipExtractor

type SkipExtractor struct{}

func (*SkipExtractor) Do

func (e *SkipExtractor) Do(pos token.Pos, tok token.Token, lit string) Extractor

func (*SkipExtractor) Done

func (e *SkipExtractor) Done() bool

type StructExtractor

type StructExtractor struct {
	// contains filtered or unexported fields
}

func (*StructExtractor) Do

func (e *StructExtractor) Do(pos token.Pos, tok token.Token, lit string) Extractor

func (*StructExtractor) Done

func (e *StructExtractor) Done() bool

type TypeExtractor

type TypeExtractor struct {
	// contains filtered or unexported fields
}

func (*TypeExtractor) Do

func (e *TypeExtractor) Do(pos token.Pos, tok token.Token, lit string) Extractor

func (*TypeExtractor) Done

func (e *TypeExtractor) Done() bool

Jump to

Keyboard shortcuts

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