visitor

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2023 License: MIT Imports: 26 Imported by: 0

Documentation

Overview

Package visitor contains walker.visitor implementations

Package visitor contains walker.visitor implementations

Package visitor contains walker.visitor implementations

Package visitor contains walker.visitor implementations

Package visitor contains walker.visitor implementations

Package visitor contains walker.visitor implementations

Package visitor contains walker.visitor implementations

Index

Constants

View Source
const Alpha = "abcdefghijklmnopqrstuvwxyz"

Variables

View Source
var Actions = make(map[string]map[string]bool)

///// hashmap for WP

View Source
var ArgsType = make(map[string]string)
View Source
var Assigns map[string]st
View Source
var CG = make(map[string]string)
View Source
var CName string = "" // hold the name of class
View Source
var CallGCString = 0

var_functionality

View Source
var Children = make(map[string]map[string]bool) // hold a reverse mapping between sub-class and parent class
View Source
var ClassDefinitions map[string]bool
View Source
var ClassInstances map[string]bool
View Source
var Classes = make(map[string][]string)
View Source
var Constants *map[string]st
View Source
var Curcls = -1
View Source
var Currentcls = -1
View Source
var Dyn_func_call = 0
View Source
var Dyn_inc = 0
View Source
var Dyn_ins = 0
View Source
var DynamicIncludes map[string]bool
View Source
var Exists = struct{}{}
View Source
var Extends = make(map[string]string) // hold a mapping between parent class and sub-class

/ handle inheritance in method/function invokes

View Source
var File string
View Source
var Funcfilemap = make(map[string]string)
View Source
var FunctionCalls map[string]bool
View Source
var Functions = make(map[string][]int)
View Source
var Globalvars = make(map[string]bool)
View Source
var ImplementedIntface map[string][]string
View Source
var Improved_vartrack = false
View Source
var Includes map[string][]string
View Source
var IntExtends = make(map[string]map[string]bool) // hold a mapping between parent interface and sub-interfaces
View Source
var LocalWaitingQueue = make(map[string][]Lvd)
View Source
var Methfilemap = make(map[string]string)
View Source
var MethodCalls map[string]bool
View Source
var MethodSummary map[string]string
View Source
var Methods = make(map[string][]int)
View Source
var NamespaceSummary map[string]string
View Source
var No_more_var = false
View Source
var NsEnable = true
View Source
var NumIncludes int = 0
View Source
var Numcalls = 0
View Source
var Regexignore = "{}[]<>#$%@!~=+? :&;,'"
View Source
var RelativePath string
View Source
var Scopes []node.Node
View Source
var ScriptDep map[string][]string
View Source
var SemiDynamicIncludes map[string]bool
View Source
var StaticIncludes map[string]bool
View Source
var Static_func_call = 0
View Source
var Static_inc = 0
View Source
var Static_ins = 0
View Source
var Total_func_call = 0

stat variables function call

View Source
var Total_inc = 0

includes

View Source
var Total_ins = 0

object init -> autoload

View Source
var Tracked_variables []string
View Source
var UnresCalls = make(map[string]string)
View Source
var UsedNamespaceSummary map[string][]string
View Source
var VarAssigns map[string]string // mapping between rhs and lhs in assignment statements
View Source
var VarForest = make(map[string]VariableTree)
View Source
var VarTrack = make(map[string]map[string]string)
View Source
var Variable_dependency map[string][]string
View Source
var WaitingQueue = make(map[string][]Vardep)

Functions

func ClearArgsType

func ClearArgsType()

func ClearAssigns

func ClearAssigns()

func ClearGlobalArgs

func ClearGlobalArgs()

func ClearScopes

func ClearScopes()

func ClearUsedTraits

func ClearUsedTraits()

func Contains

func Contains(s []string, str string) bool

func ExistWaitQueue

func ExistWaitQueue(holdon Vd, file string) bool

func GetHashStmts

func GetHashStmts(nodes []node.Node) [16]byte

func LocalProcessStringExpr

func LocalProcessStringExpr(file string, n node.Node, pat int, curcls int) string

func NodeSource

func NodeSource(n *node.Node) string

func ProcessStringExpr

func ProcessStringExpr(n node.Node, pat int) string

func Set_local_var_assign

func Set_local_var_assign(file string, var_name string, value string)

Types

type ConstWalker

type ConstWalker struct {
	Writer    io.Writer
	Indent    string
	Comments  parser.Comments
	Positions parser.Positions
}

func (ConstWalker) EnterNode

func (d ConstWalker) EnterNode(w walker.Walkable) bool

func (ConstWalker) GetChildrenVisitor

func (d ConstWalker) GetChildrenVisitor(key string) walker.Visitor

GetChildrenVisitor is invoked at every node parameter that contains children nodes

func (ConstWalker) LeaveNode

func (d ConstWalker) LeaveNode(w walker.Walkable)

LeaveNode is invoked after node process

type CsaDumper

type CsaDumper struct {
	Writer     io.Writer
	Indent     string
	Comments   parser.Comments
	Positions  parser.Positions
	NsResolver *NamespaceResolver
}

type DefWalker

type DefWalker struct {
	Writer     io.Writer
	Indent     string
	Comments   parser.Comments
	Positions  parser.Positions
	NsResolver *NamespaceResolver
}

func (DefWalker) EnterNode

func (d DefWalker) EnterNode(w walker.Walkable) bool

func (DefWalker) GetChildrenVisitor

func (d DefWalker) GetChildrenVisitor(key string) walker.Visitor

GetChildrenVisitor is invoked at every node parameter that contains children nodes

func (DefWalker) LeaveNode

func (d DefWalker) LeaveNode(w walker.Walkable)

LeaveNode is invoked after node process

type Dumper

type Dumper struct {
	Writer     io.Writer
	Indent     string
	Comments   parser.Comments
	Positions  parser.Positions
	NsResolver *NamespaceResolver
}

func (Dumper) EnterNode

func (d Dumper) EnterNode(w walker.Walkable) bool

EnterNode is invoked at every node in hierarchy

func (Dumper) GCProcessStringExpr

func (d Dumper) GCProcessStringExpr(file string, n node.Node, currentcls int) string

func (Dumper) GetChildrenVisitor

func (d Dumper) GetChildrenVisitor(key string) walker.Visitor

GetChildrenVisitor is invoked at every node parameter that contains children nodes

func (Dumper) LeaveNode

func (d Dumper) LeaveNode(w walker.Walkable)

LeaveNode is invoked after node process

type IncludeWalker

type IncludeWalker struct {
	Writer     io.Writer
	Indent     string
	Comments   parser.Comments
	Positions  parser.Positions
	NsResolver *NamespaceResolver
}

func (IncludeWalker) EnterNode

func (d IncludeWalker) EnterNode(w walker.Walkable) bool

EnterNode is invoked at every node in hierarchy

func (IncludeWalker) GetChildrenVisitor

func (d IncludeWalker) GetChildrenVisitor(key string) walker.Visitor

GetChildrenVisitor is invoked at every node parameter that contains children nodes

func (IncludeWalker) LeaveNode

func (d IncludeWalker) LeaveNode(w walker.Walkable)

LeaveNode is invoked after node process

type Localvardep

type Localvardep struct {
	Src_var string
	Dst_var string
}

this one is responsible for local dependency of variables

type Lvd

type Lvd = Localvardep

type Namespace

type Namespace struct {
	Namespace string
	Aliases   map[string]map[string]string
}

Namespace context

func NewNamespace

func NewNamespace(NSName string) *Namespace

NewNamespace constructor

func (*Namespace) AddAlias

func (ns *Namespace) AddAlias(aliasType string, aliasName string, alias string)

AddAlias adds a new alias

func (*Namespace) ResolveAlias

func (ns *Namespace) ResolveAlias(nameNode node.Node, aliasType string) (string, error)

ResolveAlias returns alias or error if not found

func (*Namespace) ResolveName

func (ns *Namespace) ResolveName(nameNode node.Node, aliasType string) (string, error)

ResolveName returns a resolved fully qualified name

type NamespaceResolver

type NamespaceResolver struct {
	Namespace     *Namespace
	ResolvedNames map[node.Node]string
}

NamespaceResolver visitor

func NewNamespaceResolver

func NewNamespaceResolver() *NamespaceResolver

NewNamespaceResolver NamespaceResolver type constructor

func (*NamespaceResolver) AddAlias

func (nsr *NamespaceResolver) AddAlias(useType string, nn node.Node, prefix []node.Node)

AddAlias adds a new alias

func (*NamespaceResolver) AddNamespacedName

func (nsr *NamespaceResolver) AddNamespacedName(nn node.Node, nodeName string)

AddNamespacedName adds namespaced name by node

func (*NamespaceResolver) EnterNode

func (nsr *NamespaceResolver) EnterNode(w walker.Walkable) bool

EnterNode is invoked at every node in heirerchy

func (*NamespaceResolver) GetChildrenVisitor

func (nsr *NamespaceResolver) GetChildrenVisitor(key string) walker.Visitor

GetChildrenVisitor is invoked at every node parameter that contains children nodes

func (*NamespaceResolver) LeaveNode

func (nsr *NamespaceResolver) LeaveNode(w walker.Walkable)

LeaveNode is invoked after node process

func (*NamespaceResolver) ResolveName

func (nsr *NamespaceResolver) ResolveName(nameNode node.Node, aliasType string)

ResolveName adds a resolved fully qualified name by node

func (*NamespaceResolver) ResolveType

func (nsr *NamespaceResolver) ResolveType(n node.Node)

ResolveType adds a resolved fully qualified type name

type TrackWalker

type TrackWalker struct {
	Writer     io.Writer
	Indent     string
	Comments   parser.Comments
	Positions  parser.Positions
	NsResolver *NamespaceResolver
}

func (TrackWalker) EnterNode

func (d TrackWalker) EnterNode(w walker.Walkable) bool

EnterNode is invoked at every node in hierarchy

func (TrackWalker) GetChildrenVisitor

func (d TrackWalker) GetChildrenVisitor(key string) walker.Visitor

GetChildrenVisitor is invoked at every node parameter that contains children nodes

func (TrackWalker) LeaveNode

func (d TrackWalker) LeaveNode(w walker.Walkable)

LeaveNode is invoked after node process

type VarWalker

type VarWalker struct {
	Writer     io.Writer
	Indent     string
	Comments   parser.Comments
	Positions  parser.Positions
	NsResolver *NamespaceResolver
}

func (VarWalker) EnterNode

func (d VarWalker) EnterNode(w walker.Walkable) bool

func (VarWalker) GetChildrenVisitor

func (d VarWalker) GetChildrenVisitor(key string) walker.Visitor

GetChildrenVisitor is invoked at every node parameter that contains children nodes

func (VarWalker) HandleNode

func (d VarWalker) HandleNode(n node.Node) bool

func (VarWalker) LeaveNode

func (d VarWalker) LeaveNode(w walker.Walkable)

LeaveNode is invoked after node process

type Vardep

type Vardep struct {
	Src_file  string
	Fix_var   string
	Asgn_node []node.Node
}

waiting queue data structure to hold values that needs to be filled

type VariableTree

type VariableTree struct {
	Name     string         // variable name holder
	Content  string         // holds the content if not dynamic
	Dynamic  bool           // defines whether the variable content is dynamic or not
	Op       string         // holds the operation (usually between variables such as concat)
	Children []VariableTree // holds all possible value for the specific value with the name of "Name"
}

type Vd

type Vd = Vardep

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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