jo

package
v0.0.0-...-bcd339c Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const JavaExt = ".java"

Variables

View Source
var JavaLangClasses = NewSet(
	"AbstractMethodError",
	"AbstractStringBuilder",
	"Appendable",
	"ApplicationShutdownHooks",
	"ArithmeticException",
	"ArrayIndexOutOfBoundsException",
	"ArrayStoreException",
	"AssertionError",
	"AssertionStatusDirectives",
	"AutoCloseable",
	"Boolean",
	"BootstrapMethodError",
	"Byte",
	"Character",
	"CharacterData",
	"CharacterData0E",
	"CharacterData00",
	"CharacterData01",
	"CharacterData02",
	"CharacterData03",
	"CharacterDataLatin1",
	"CharacterDataPrivateUse",
	"CharacterDataUndefined",
	"CharacterName",
	"CharSequence",
	"Class",
	"ClassCastException",
	"ClassCircularityError",
	"ClassFormatError",
	"ClassLoader",
	"ClassNotFoundException",
	"ClassValue",
	"Cloneable",
	"CloneNotSupportedException",
	"Comparable",
	"Compiler",
	"CompoundEnumeration",
	"ConditionalSpecialCasing",
	"Deprecated",
	"Double",
	"Enum",
	"EnumConstantNotPresentException",
	"Error",
	"Exception",
	"ExceptionInInitializerError",
	"FdLibm",
	"Float",
	"FunctionalInterface",
	"IllegalAccessError",
	"IllegalAccessException",
	"IllegalArgumentException",
	"IllegalCallerException",
	"IllegalMonitorStateException",
	"IllegalStateException",
	"IllegalThreadStateException",
	"IncompatibleClassChangeError",
	"IndexOutOfBoundsException",
	"InheritableThreadLocal",
	"InstantiationError",
	"InstantiationException",
	"Integer",
	"InternalError",
	"InterruptedException",
	"Iterable",
	"LayerInstantiationException",
	"LinkageError",
	"LiveStackFrame",
	"LiveStackFrameInfo",
	"Long",
	"Math",
	"Module",
	"ModuleLayer",
	"NamedPackage",
	"NegativeArraySizeException",
	"NoClassDefFoundError",
	"NoSuchFieldError",
	"NoSuchFieldException",
	"NoSuchMethodError",
	"NoSuchMethodException",
	"NullPointerException",
	"Number",
	"NumberFormatException",
	"Object",
	"OutOfMemoryError",
	"Override",
	"Package",
	"Process",
	"ProcessBuilder",
	"ProcessEnvironment",
	"ProcessHandle",
	"ProcessHandleImpl",
	"ProcessImpl",
	"PublicMethods",
	"Readable",
	"Record",
	"ReflectiveOperationException",
	"Runnable",
	"Runtime",
	"RuntimeException",
	"RuntimePermission",
	"SafeVarargs",
	"SecurityException",
	"SecurityManager",
	"Short",
	"Shutdown",
	"StackFrameInfo",
	"StackOverflowError",
	"StackStreamFactory",
	"StackTraceElement",
	"StackWalker",
	"StrictMath",
	"String",
	"StringBuffer",
	"StringBuilder",
	"StringCoding",
	"StringConcatHelper",
	"StringIndexOutOfBoundsException",
	"StringLatin1",
	"StringUTF16",
	"SuppressWarnings",
	"System",
	"Terminator",
	"Thread",
	"ThreadDeath",
	"ThreadGroup",
	"ThreadLocal",
	"Throwable",
	"TypeNotPresentException",
	"UnknownError",
	"UnsatisfiedLinkError",
	"UnsupportedClassVersionError",
	"UnsupportedOperationException",
	"VerifyError",
	"VersionProps",
	"VirtualMachineError",
	"Void",
	"WeakPairMap",
)

Functions

This section is empty.

Types

type Node

type Node struct {
	*sitter.Node
	Unit *Unit
}

func (*Node) Child

func (n *Node) Child(idx int) *Node

func (*Node) Children

func (n *Node) Children() NodeList

func (*Node) Contains

func (n *Node) Contains(types ...nodetype.NodeType) bool

func (*Node) Content

func (n *Node) Content() string

func (*Node) FindDeclaration

func (n *Node) FindDeclaration() *Node

func (*Node) FindNodeByType

func (n *Node) FindNodeByType(types ...nodetype.NodeType) *Node

func (*Node) FindNodeByTypeRecursive

func (n *Node) FindNodeByTypeRecursive(t nodetype.NodeType) *Node

func (*Node) FindNodesByType

func (n *Node) FindNodesByType(types ...nodetype.NodeType) NodeList

func (*Node) FindNodesByTypeRecursive

func (n *Node) FindNodesByTypeRecursive(types ...nodetype.NodeType) NodeList

func (*Node) FindParent

func (n *Node) FindParent(t nodetype.NodeType) *Node

func (*Node) FindParents

func (n *Node) FindParents(t nodetype.NodeType) NodeList

func (*Node) GetAbsName

func (n *Node) GetAbsName() string

func (*Node) GetName

func (n *Node) GetName() string

func (*Node) HasParentWithType

func (n *Node) HasParentWithType(types ...nodetype.NodeType) bool

func (*Node) IsFinal

func (n *Node) IsFinal() bool

func (*Node) IsStatic

func (n *Node) IsStatic() bool

func (*Node) IsType

func (n *Node) IsType(types ...nodetype.NodeType) bool

func (*Node) NextSibling

func (n *Node) NextSibling() *Node

func (*Node) Parent

func (n *Node) Parent() *Node

func (*Node) Parents

func (n *Node) Parents() NodeList

func (*Node) PrevSibling

func (n *Node) PrevSibling() *Node

func (*Node) PrevSiblings

func (n *Node) PrevSiblings(types ...nodetype.NodeType) NodeList

func (*Node) PrintAST

func (n *Node) PrintAST()

func (*Node) Traverse

func (n *Node) Traverse(level int, handler NodeHandlerFunc)

func (*Node) Type

func (n *Node) Type() nodetype.NodeType

type NodeHandlerFunc

type NodeHandlerFunc func(node *Node, level int)

type NodeList

type NodeList []*Node

func (NodeList) Add

func (nl NodeList) Add(nodes ...*Node) NodeList

func (NodeList) Concat

func (nl NodeList) Concat(list NodeList) NodeList

func (NodeList) Contains

func (nl NodeList) Contains(node *Node) bool

func (NodeList) Filter

func (nl NodeList) Filter(fn func(node *Node) bool) NodeList

type NodeListMap

type NodeListMap map[string]NodeList

func (NodeListMap) AddNode

func (nlm NodeListMap) AddNode(k string, node *Node)

type NodesById

type NodesById map[uint]*Node

type Project

type Project struct {
	*sitter.Parser

	Units          []*Unit
	UnitsByPkg     UnitsByPkgMap
	UnitsByAbsName UnitsMap

	NodesById
	Declarations NodeListMap

	ExcludeDirs Set[string]
}

func NewProject

func NewProject() *Project

func (*Project) AddExcludeDir

func (p *Project) AddExcludeDir(dirname string) error

func (*Project) AddSource

func (p *Project) AddSource(filename string) (*Unit, error)

func (*Project) AddSourceDir

func (p *Project) AddSourceDir(dirname string) error

func (*Project) IndexDeclarations

func (p *Project) IndexDeclarations() error

type Set

type Set[T comparable] map[T]struct{}

func NewSet

func NewSet[T comparable](elems ...T) Set[T]

func (Set[T]) Add

func (s Set[T]) Add(e T)

func (Set[T]) AddMany

func (s Set[T]) AddMany(elems []T)

func (Set[T]) Contains

func (s Set[T]) Contains(e T) bool

func (Set[T]) Length

func (s Set[T]) Length(e T) int

type Unit

type Unit struct {
	Project    *Project
	SourceCode []byte
	*sitter.Tree
	Root    *Node
	Package string
	Name    string

	SiblingUnits UnitsMap
}

func (*Unit) AbsName

func (u *Unit) AbsName() string

func (*Unit) GetSiblingUnits

func (u *Unit) GetSiblingUnits() UnitsMap

func (*Unit) NodeContent

func (u *Unit) NodeContent(node *sitter.Node) string

func (*Unit) PrintAST

func (u *Unit) PrintAST()

func (*Unit) TraverseAST

func (u *Unit) TraverseAST(handler NodeHandlerFunc)

func (*Unit) TraverseNodeAST

func (u *Unit) TraverseNodeAST(node *Node, level int, handler NodeHandlerFunc)

func (*Unit) WrapNode

func (u *Unit) WrapNode(node *sitter.Node) *Node

func (*Unit) WriteASTToFile

func (u *Unit) WriteASTToFile(filename string) error

type UnitsByPkgMap

type UnitsByPkgMap map[string]UnitsMap

type UnitsMap

type UnitsMap map[string]*Unit

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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