utils

package
v0.0.0-...-7188a0b Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const Version string = "0.2.2"

Version ejja's current version

Variables

This section is empty.

Functions

func FindFunctions

func FindFunctions(project string, functions []string, verbose bool) []*ast.FuncDecl

FindFunctions returns a list of *ast.FuncDecl matching given functions in a given folder path use verbose flag for printing found functions files.

func FormatNode

func FormatNode(node ast.Node) string

FormatNode returs the node as a string

func GetNodeType

func GetNodeType(node ast.Node) string

GetNodeType returns the given node's type

func GetTabs

func GetTabs(index int) string

GetTabs returns a string composing of wanted tabs

func LoadDirs

func LoadDirs(dirs ...string) (*aster.Program, error)

LoadDirs parses the source code of Go files under the directories and loads a new program.

func ReturnAssignments

func ReturnAssignments(collection StatementCollection) string

ReturnAssignments returns the assignment statements as a string

func UniqueID

func UniqueID() string

UniqueID generates a unique identifier

func Validate

func Validate(functions []string) []string

Validate given functions removes empty functions if found exits when no function given returns the clean list of functions TODO check for errornous lists

Types

type StatementCollection

type StatementCollection struct {
	FunctionSig     string
	Listing         []ast.Stmt
	FuncStack       []ast.FuncDecl
	AssignDeclStack []ast.Stmt
	AssignStack     []ast.Stmt
	ExprStack       []ast.Stmt
	IfStack         []ast.Stmt
	BadStack        []ast.Stmt
	DeclStack       []ast.Stmt
	EmptyStack      []ast.Stmt
	LabeledStack    []ast.Stmt
	SendStack       []ast.Stmt
	IncDecStack     []ast.Stmt
	GoStack         []ast.Stmt
	DeferStack      []ast.Stmt
	ReturnStack     []ast.Stmt
	BranchStack     []ast.Stmt
	BlockStack      []ast.Stmt
	SwitchStack     []ast.Stmt
	TypeSwitchStack []ast.Stmt
	CommStack       []ast.Stmt
	SelectStack     []ast.Stmt
	ForStack        []ast.Stmt
	RangeStack      []ast.Stmt
}

StatementCollection is a collection of all statements in target function as stacks

func ParseFunctions

func ParseFunctions(project string, functions []string, verbose bool) []StatementCollection

ParseFunctions returns a list of collections of statments of the given functions if found. verbose prints found file names TODO: error handling

Jump to

Keyboard shortcuts

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