Documentation
¶
Index ¶
- Constants
- Variables
- type Node
- func (n *Node) Child(idx int) *Node
- func (n *Node) Children() NodeList
- func (n *Node) Contains(types ...nodetype.NodeType) bool
- func (n *Node) Content() string
- func (n *Node) FindDeclaration() *Node
- func (n *Node) FindNodeByType(types ...nodetype.NodeType) *Node
- func (n *Node) FindNodeByTypeRecursive(t nodetype.NodeType) *Node
- func (n *Node) FindNodesByType(types ...nodetype.NodeType) NodeList
- func (n *Node) FindNodesByTypeRecursive(types ...nodetype.NodeType) NodeList
- func (n *Node) FindParent(t nodetype.NodeType) *Node
- func (n *Node) FindParents(t nodetype.NodeType) NodeList
- func (n *Node) GetAbsName() string
- func (n *Node) GetName() string
- func (n *Node) HasParentWithType(types ...nodetype.NodeType) bool
- func (n *Node) IsFinal() bool
- func (n *Node) IsStatic() bool
- func (n *Node) IsType(types ...nodetype.NodeType) bool
- func (n *Node) NextSibling() *Node
- func (n *Node) Parent() *Node
- func (n *Node) Parents() NodeList
- func (n *Node) PrevSibling() *Node
- func (n *Node) PrevSiblings(types ...nodetype.NodeType) NodeList
- func (n *Node) PrintAST()
- func (n *Node) Traverse(level int, handler NodeHandlerFunc)
- func (n *Node) Type() nodetype.NodeType
- type NodeHandlerFunc
- type NodeList
- type NodeListMap
- type NodesById
- type Project
- type Set
- type Unit
- func (u *Unit) AbsName() string
- func (u *Unit) GetSiblingUnits() UnitsMap
- func (u *Unit) NodeContent(node *sitter.Node) string
- func (u *Unit) PrintAST()
- func (u *Unit) TraverseAST(handler NodeHandlerFunc)
- func (u *Unit) TraverseNodeAST(node *Node, level int, handler NodeHandlerFunc)
- func (u *Unit) WrapNode(node *sitter.Node) *Node
- func (u *Unit) WriteASTToFile(filename string) error
- type UnitsByPkgMap
- type UnitsMap
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 ¶
func (*Node) FindDeclaration ¶
func (*Node) FindNodeByTypeRecursive ¶
func (*Node) FindNodesByTypeRecursive ¶
func (*Node) GetAbsName ¶
func (*Node) NextSibling ¶
func (*Node) PrevSibling ¶
func (*Node) Traverse ¶
func (n *Node) Traverse(level int, handler NodeHandlerFunc)
type NodeHandlerFunc ¶
type NodeListMap ¶
func (NodeListMap) AddNode ¶
func (nlm NodeListMap) AddNode(k string, node *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 (*Project) AddSourceDir ¶
func (*Project) IndexDeclarations ¶
type Set ¶
type Set[T comparable] map[T]struct{}
func NewSet ¶
func NewSet[T comparable](elems ...T) Set[T]
type Unit ¶
type Unit struct {
Project *Project
SourceCode []byte
*sitter.Tree
Root *Node
Package string
Name string
SiblingUnits UnitsMap
}
func (*Unit) GetSiblingUnits ¶
func (*Unit) TraverseAST ¶
func (u *Unit) TraverseAST(handler NodeHandlerFunc)
func (*Unit) TraverseNodeAST ¶
func (u *Unit) TraverseNodeAST(node *Node, level int, handler NodeHandlerFunc)
func (*Unit) WriteASTToFile ¶
type UnitsByPkgMap ¶
Click to show internal directories.
Click to hide internal directories.