gosrc

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2022 License: Unlicense Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnalyzedFile

type AnalyzedFile struct {
	FileName  string
	FilePath  string
	Functions []Function
}

func (AnalyzedFile) Directory

func (file AnalyzedFile) Directory() string

type ExpressionType

type ExpressionType string
const (
	ExprTypeBlock       ExpressionType = "BlockStmt"
	ExprTypeIf          ExpressionType = "IfStmt"
	ExprTypeSwitch      ExpressionType = "SwitchStmt"
	ExprTypeTypeSwitch  ExpressionType = "TypeSwitchStmt"
	ExprTypeCaseClause  ExpressionType = "CaseClause"
	ExprTypeRange       ExpressionType = "RangeStmt"
	ExprTypeFor         ExpressionType = "ForStmt"
	ExprTypeAssign      ExpressionType = "AssignStmt"
	ExprTypeDeclaration ExpressionType = "DeclStmt"
	ExprTypeDefer       ExpressionType = "DeferStmt"
	ExprTypeExpr        ExpressionType = "ExprStmt"

	ExprTypeGenDecl ExpressionType = "GenDecl"
)

func ExprTypeFromStmt

func ExprTypeFromStmt(stmt ast.Stmt) ExpressionType

type Function

type Function struct {
	Name       string
	Position   Position
	Statements []Statement
}

func NewFunction

func NewFunction(funcDecl ast.FuncDecl, fs *token.FileSet) Function

func (Function) GetName

func (f Function) GetName() string

func (Function) GetStatements

func (f Function) GetStatements() []Statement

type Position

type Position struct {
	LineFrom   int
	LineTo     int
	ColumnFrom int
	ColumnTo   int
}

func NewPosition

func NewPosition(from token.Position, to token.Position) Position

func (Position) Clone

func (pos Position) Clone() Position

type Statement

type Statement struct {
	Type             ExpressionType
	Position         Position
	ParentStatement  *Statement
	NestedStatements Statements
}

func NewStatement

func NewStatement(stmt ast.Stmt, parent *Statement, fs *token.FileSet) Statement

func (Statement) IsBranchStmt

func (stmt Statement) IsBranchStmt() bool

type Statements

type Statements []Statement

func (*Statements) Pop

func (stmts *Statements) Pop() (Statement, error)

func (*Statements) Push

func (stmts *Statements) Push(newStmts Statements)

Jump to

Keyboard shortcuts

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