collector

package
v0.0.0-...-f61b284 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2024 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SymbolTypeMap = map[string]SymbolType{}

Functions

func SymbolName

func SymbolName(symType SymbolType) string

Types

type ASTGetter

type ASTGetter interface {
	AST() *ast.File
}

type ArrayType

type ArrayType struct {
	Length *int
	Values Expr
}

func (ArrayType) String

func (at ArrayType) String() (s string)

type BasicLit

type BasicLit struct {
	Value Expr
}

func (BasicLit) String

func (e BasicLit) String() string

type BinaryExpr

type BinaryExpr struct {
	LeftExpr  Expr
	Operator  Operator
	RightExpr Expr
}

func (BinaryExpr) String

func (e BinaryExpr) String() string

type CallExpr

type CallExpr struct {
	Call Expr
	Args Expr
}

func (CallExpr) String

func (ce CallExpr) String() string

type ChanType

type ChanType struct {
	Direction Direction
	Type      Expr
}

func (ChanType) String

func (e ChanType) String() (s string)

type CodeFacet

type CodeFacet interface {
	CodeFacet()
	fmt.Stringer
}

type Collector

type Collector struct {
	File      File
	FacetChan chan CodeFacet // replace FuncDecl with the actual type you intend to use
}

func New

func New(file File, facetChan chan CodeFacet) *Collector

func (*Collector) CollectArrayType

func (c *Collector) CollectArrayType(ctx context.Context, aat *ast.ArrayType) (at ArrayType, err error)

func (*Collector) CollectBasicLit

func (c *Collector) CollectBasicLit(ctx context.Context, e *ast.BasicLit) (BasicLit, error)

func (*Collector) CollectBinaryExpr

func (c *Collector) CollectBinaryExpr(ctx context.Context, abe *ast.BinaryExpr) (be BinaryExpr, err error)

func (*Collector) CollectCallExpr

func (c *Collector) CollectCallExpr(ctx context.Context, call *ast.CallExpr) (ce CallExpr, err error)

func (*Collector) CollectChanType

func (c *Collector) CollectChanType(ctx context.Context, act *ast.ChanType) (ct ChanType, err error)

func (*Collector) CollectCompositeLit

func (c *Collector) CollectCompositeLit(ctx context.Context, acl *ast.CompositeLit) (cl CompositeLit, err error)

func (*Collector) CollectConst

func (c *Collector) CollectConst(ctx context.Context, d *ast.GenDecl) (err error)

func (*Collector) CollectEllipsis

func (c *Collector) CollectEllipsis(ctx context.Context, ae *ast.Ellipsis) (e Ellipsis, err error)

func (*Collector) CollectExpr

func (c *Collector) CollectExpr(ctx context.Context, expr ast.Expr) (e Expr, err error)

func (*Collector) CollectExprSlice

func (c *Collector) CollectExprSlice(ctx context.Context, astExprs []ast.Expr) (el ExprList, err error)

func (*Collector) CollectExprString

func (c *Collector) CollectExprString(ctx context.Context, ae ast.Expr) (s string, err error)

func (*Collector) CollectFacets

func (c *Collector) CollectFacets(ctx context.Context) (err error)

func (*Collector) CollectField

func (c *Collector) CollectField(ctx context.Context, aFld *ast.Field) (list FieldList, err error)

func (*Collector) CollectFieldList

func (c *Collector) CollectFieldList(ctx context.Context, list *ast.FieldList) (FieldList, error)

func (*Collector) CollectFieldSlice

func (c *Collector) CollectFieldSlice(ctx context.Context, list []*ast.Field) (fl FieldList, err error)

func (*Collector) CollectFuncDecl

func (c *Collector) CollectFuncDecl(ctx context.Context, fd *ast.FuncDecl) (err error)

func (*Collector) CollectFuncLit

func (c *Collector) CollectFuncLit(ctx context.Context, fl *ast.FuncLit) (_ FuncLit, err error)

func (*Collector) CollectFuncType

func (c *Collector) CollectFuncType(ctx context.Context, aft *ast.FuncType) (ft FuncType, err error)

func (*Collector) CollectGenDecl

func (c *Collector) CollectGenDecl(ctx context.Context, d *ast.GenDecl) (err error)

func (*Collector) CollectIdent

func (c *Collector) CollectIdent(ctx context.Context, e *ast.Ident) (Ident, error)

func (*Collector) CollectIdentSlice

func (c *Collector) CollectIdentSlice(ctx context.Context, astExprs []ast.Expr) (is Idents, err error)

func (*Collector) CollectImportSpec

func (c *Collector) CollectImportSpec(ctx context.Context, ais *ast.ImportSpec) (is ImportSpec)

func (*Collector) CollectIndexExpr

func (c *Collector) CollectIndexExpr(ctx context.Context, aie *ast.IndexExpr) (ie IndexExpr, err error)

func (*Collector) CollectIndexListExpr

func (c *Collector) CollectIndexListExpr(ctx context.Context, aile *ast.IndexListExpr) (ile IndexListExpr, err error)

func (*Collector) CollectInterfaceType

func (c *Collector) CollectInterfaceType(ctx context.Context, iface *ast.InterfaceType) (it InterfaceType, err error)

func (*Collector) CollectKeyValueExpr

func (c *Collector) CollectKeyValueExpr(ctx context.Context, e *ast.KeyValueExpr) (kve KeyValueExpr, err error)

func (*Collector) CollectMapType

func (c *Collector) CollectMapType(ctx context.Context, amt *ast.MapType) (mt MapType, err error)

func (*Collector) CollectParenExpr

func (c *Collector) CollectParenExpr(ctx context.Context, ape *ast.ParenExpr) (pe ParenExpr, err error)

func (*Collector) CollectReceiver

func (c *Collector) CollectReceiver(ctx context.Context, list *ast.FieldList) (fld *Field, cnt int, err error)

func (*Collector) CollectSelectorExpr

func (c *Collector) CollectSelectorExpr(ctx context.Context, e *ast.SelectorExpr) (se SelectorExpr, err error)

func (*Collector) CollectSliceExpr

func (c *Collector) CollectSliceExpr(ctx context.Context, ase *ast.SliceExpr) (se SliceExpr, err error)

func (*Collector) CollectSpec

func (c *Collector) CollectSpec(ctx context.Context, spec ast.Spec, typ *Expr) (err error)

func (*Collector) CollectStarExpr

func (c *Collector) CollectStarExpr(ctx context.Context, ase *ast.StarExpr) (se StarExpr, err error)

func (*Collector) CollectStructType

func (c *Collector) CollectStructType(ctx context.Context, t *ast.StructType) (st StructType, err error)

func (*Collector) CollectTypeAssertExpr

func (c *Collector) CollectTypeAssertExpr(ctx context.Context, atae *ast.TypeAssertExpr) (tae TypeAssertExpr, err error)

func (*Collector) CollectTypeSpec

func (c *Collector) CollectTypeSpec(ctx context.Context, ats *ast.TypeSpec) (ts *TypeSpec, err error)

func (*Collector) CollectUnaryExpr

func (c *Collector) CollectUnaryExpr(ctx context.Context, aue *ast.UnaryExpr) (ue UnaryExpr, err error)

func (*Collector) CollectValueSpec

func (c *Collector) CollectValueSpec(ctx context.Context, avs *ast.ValueSpec, typ *Expr) (vs ValueSpecs, err error)

func (*Collector) CollectVar

func (c *Collector) CollectVar(ctx context.Context, d *ast.GenDecl) (err error)

type CompositeLit

type CompositeLit struct {
	Name       Expr
	Properties ExprList
}

func (CompositeLit) String

func (e CompositeLit) String() (s string)

type Direction

type Direction ast.ChanDir

func (Direction) String

func (cd Direction) String() (s string)

type Ellipsis

type Ellipsis struct {
	Type Expr
}

func (Ellipsis) String

func (e Ellipsis) String() string

type Expr

type Expr interface {
	fmt.Stringer
}

type ExprList

type ExprList []Expr

func (ExprList) String

func (el ExprList) String() (s string)

type Field

type Field struct {
	Name string
	Type Expr
}

func (Field) String

func (f Field) String() (s string)

type FieldList

type FieldList []Field

func (FieldList) String

func (fl FieldList) String() (s string)

type File

type File interface {
	ASTGetter
	RelPath() string
	Fullpath() string
}

type FuncDecl

type FuncDecl struct {
	File     File
	Name     string
	Receiver *Field
	FuncType
}

func (FuncDecl) CodeFacet

func (fd FuncDecl) CodeFacet()

func (FuncDecl) String

func (fd FuncDecl) String() (s string)

type FuncLit

type FuncLit struct {
	FuncType Expr
}

func (FuncLit) String

func (e FuncLit) String() string

type FuncType

type FuncType struct {
	Parameters FieldList
	Results    FieldList
}

func (FuncType) String

func (ft FuncType) String() (s string)

type Ident

type Ident struct {
	Name Expr
}

func (Ident) String

func (e Ident) String() string

type Idents

type Idents []Ident

type ImportSpec

type ImportSpec struct {
	File    File
	Package string
	Alias   string
}

func (ImportSpec) CodeFacet

func (is ImportSpec) CodeFacet()

func (ImportSpec) Name

func (is ImportSpec) Name() string

func (ImportSpec) String

func (is ImportSpec) String() (s string)

type IndexExpr

type IndexExpr struct {
	Expr  Expr
	Index Expr
}

func (IndexExpr) String

func (e IndexExpr) String() (s string)

type IndexListExpr

type IndexListExpr struct {
	Expr    Expr
	Indices Expr
}

func (IndexListExpr) String

func (e IndexListExpr) String() (s string)

type InterfaceType

type InterfaceType struct {
	Methods FieldList
}

func (InterfaceType) String

func (e InterfaceType) String() (s string)

type KeyValueExpr

type KeyValueExpr struct {
	Key   Expr
	Value Expr
}

func (KeyValueExpr) String

func (e KeyValueExpr) String() string

type MapType

type MapType struct {
	KeyType   Expr
	ValueType Expr
}

func (MapType) String

func (e MapType) String() string

type Operator

type Operator token.Token

func (Operator) String

func (op Operator) String() (s string)

type ParenExpr

type ParenExpr struct {
	Expr Expr
}

func (ParenExpr) String

func (e ParenExpr) String() string

type SelectorExpr

type SelectorExpr struct {
	Package Expr
	Name    string
}

func (SelectorExpr) String

func (se SelectorExpr) String() string

type SliceExpr

type SliceExpr struct {
	Expr Expr
	Low  Expr
	High Expr
}

func (SliceExpr) String

func (se SliceExpr) String() (s string)

type StarExpr

type StarExpr struct {
	Expr Expr
}

func (StarExpr) String

func (e StarExpr) String() string

type String

type String string

func (String) String

func (s String) String() string

type StructType

type StructType struct {
	Fields FieldList
}

func (StructType) String

func (e StructType) String() (s string)

type SymbolType

type SymbolType int
const (
	UnclassifiedSymbol SymbolType = 0
	StructSymbol       SymbolType = 1
	InterfaceSymbol    SymbolType = 2
	IdentifierSymbol   SymbolType = 3
	FuncSymbol         SymbolType = 4
	ExprSymbol         SymbolType = 5
	LiteralSymbol      SymbolType = 6
)

func SymbolTypeFromExpr

func SymbolTypeFromExpr(expr Expr) (st SymbolType)

func (SymbolType) ID

func (st SymbolType) ID() int

func (SymbolType) Name

func (st SymbolType) Name() string

type TypeAssertExpr

type TypeAssertExpr struct {
	Expr Expr
	Type Expr
}

func (TypeAssertExpr) String

func (e TypeAssertExpr) String() (s string)

type TypeSpec

type TypeSpec struct {
	File       File
	Name       string
	Definition Expr
	SymbolType SymbolType
}

func (TypeSpec) CodeFacet

func (spec TypeSpec) CodeFacet()

func (TypeSpec) String

func (spec TypeSpec) String() (s string)

type UnaryExpr

type UnaryExpr struct {
	Operator Operator
	Expr     Expr
}

func (UnaryExpr) String

func (e UnaryExpr) String() string

type ValueSpec

type ValueSpec struct {
	File      File
	Name      string
	Type      Expr
	ValueType ValueType
}

func (ValueSpec) CodeFacet

func (spec ValueSpec) CodeFacet()

func (ValueSpec) String

func (spec ValueSpec) String() (s string)

type ValueSpecs

type ValueSpecs []ValueSpec

type ValueType

type ValueType int
const (
	UnsetValue ValueType = 0
	VarValue   ValueType = 1
	ConstValue ValueType = 2
)

func (ValueType) String

func (vt ValueType) String() (s string)

Jump to

Keyboard shortcuts

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