syntax

package
v0.0.0-...-4f4ed7f Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitFuncDuplManager

func InitFuncDuplManager(funcDuplRatio int, verbose bool)

Types

type DuplFrag

type DuplFrag struct {
	StartLine int
	EndLine   int
}

type FuncDupl

type FuncDupl struct {
	FuncNode  *Node
	DuplFrags []*DuplFrag
}

type FuncDuplManager

type FuncDuplManager struct {
	// contains filtered or unexported fields
}
var GlobalFuncDuplManager *FuncDuplManager

func (*FuncDuplManager) AddDuplFrag

func (m *FuncDuplManager) AddDuplFrag(funcNode *Node, duplStartLine, duplEndLine int)

func (*FuncDuplManager) BothFuncNeedExceedRatio

func (m *FuncDuplManager) BothFuncNeedExceedRatio() bool

func (*FuncDuplManager) Exist

func (m *FuncDuplManager) Exist(fileName string, funcPos int) (exist bool)

func (*FuncDuplManager) RemoveFuncLessRatio

func (m *FuncDuplManager) RemoveFuncLessRatio()

type Match

type Match struct {
	Hash  string
	Frags [][]*Node
}

func FindFuncUnits

func FindFuncUnits(data []*Node, m suffixtree.Match, tokenThreshold, funcThreshold int, verbose bool) []Match

func FindSyntaxUnits

func FindSyntaxUnits(data []*Node, m suffixtree.Match, threshold int) Match

FindSyntaxUnits finds all complete syntax units in the match group and returns them with the corresponding hash.

type Node

type Node struct {
	Type               int
	Filename           string
	Pos, End           int
	StartLine, EndLine int
	Children           []*Node
	Owns               int
	Source             string
	StartAtSuffixTree  int
	EndAtSuffixTree    int
}

func NewNode

func NewNode() *Node

func Serialize

func Serialize(n *Node) []*Node

func (*Node) AddChildren

func (n *Node) AddChildren(children ...*Node)

func (*Node) Val

func (n *Node) Val() int

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳