Documentation
¶
Overview ¶
Package internalast contains helpers shared by every per-language strategy implementation. Kept in a sub-package so that experimentation in one strategy can not accidentally widen the helper API.
Index ¶
- func FindChildByType(n *sitter.Node, kind string) *sitter.Node
- func FirstLine(s string) string
- func HasModifier(modifiers []string, m string) bool
- func IsCapitalized(name string) bool
- func NodeSpan(n *sitter.Node) astkit.LineRange
- func NodeText(n *sitter.Node, src []byte) string
- func SignatureBeforeBody(n *sitter.Node, src []byte) string
- func WalkChildren(n *sitter.Node, fn func(*sitter.Node))
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindChildByType ¶
FindChildByType returns the first immediate child of n whose Type() equals kind.
func HasModifier ¶
HasModifier reports whether modifiers contains m.
func IsCapitalized ¶
IsCapitalized reports whether name begins with an uppercase ASCII letter. Useful for Go's export rule.
func SignatureBeforeBody ¶ added in v0.4.17
SignatureBeforeBody returns the declaration header of n — everything from the node start up to (not including) its "body" child — with annotation nodes excised and whitespace collapsed to single spaces. Unlike FirstLine, this survives declarations that wrap `extends`/`implements` clauses or parameter lists onto continuation lines, and never returns a leading `@Override` line as the signature. Falls back to the whole node text when there is no body (e.g. abstract or interface methods).
Types ¶
This section is empty.