Documentation
¶
Index ¶
- Variables
- func ConvertCST(root *ts.Node, src string, file string) *rl.SourceFile
- func ConvertExpr(node *ts.Node, src string, file string) rl.Node
- func NodeName[T Node]() string
- func NormalizeIndentedText(text string) string
- func ParseFloat(src string) (float64, error)
- func ParseInt(src string) (int64, error)
- func QueryNodes[T Node](rt *RadTree) ([]T, error)
- func SpanFromNode(node *ts.Node, file string) rl.Span
- func ToExternalName(internalName string) string
- type BaseNode
- type CallNode
- type FileHeader
- type FnSignature
- type FunctionSet
- type Node
- type Position
- type RadParser
- type RadTree
- func (rt *RadTree) Close()
- func (rt *RadTree) Dump() string
- func (rt *RadTree) FindCalls() []*CallNode
- func (rt *RadTree) FindFileHeader() (*FileHeader, bool)
- func (rt *RadTree) FindInvalidNodeSpans(file string) []rl.Span
- func (rt *RadTree) FindInvalidNodes() []*ts.Node
- func (rt *RadTree) FindNodes(nodeKind string) []*ts.Node
- func (rt *RadTree) FindShebang() (*Shebang, bool)
- func (rt *RadTree) HasInvalidNodes() bool
- func (rt *RadTree) Root() *ts.Node
- func (rt *RadTree) Sexp() string
- func (rt *RadTree) String() string
- func (rt *RadTree) Update(src string)
- type Shebang
- type StringNode
Constants ¶
This section is empty.
Variables ¶
var FnSignaturesByName map[string]FnSignature
Functions ¶
func ConvertCST ¶ added in v0.9.0
ConvertCST converts a tree-sitter CST into a Go-native AST. The input CST must be valid (no ERROR/MISSING nodes) - if the converter encounters an unexpected node kind, it panics.
func ConvertExpr ¶ added in v0.9.0
ConvertExpr converts a single CST expression node into an AST expression. Used to pre-convert built-in function defaults in signatures.go init() and by the converter for user-defined function parameter defaults.
func NormalizeIndentedText ¶ added in v0.6.18
NormalizeIndentedText removes common leading whitespace from all lines. Handles trailing newlines from tree-sitter, expands tabs to spaces (4-char width), and uses rune-aware slicing for UTF-8 safety. Preserves relative indentation.
func ParseFloat ¶
func QueryNodes ¶
func SpanFromNode ¶ added in v0.9.0
SpanFromNode creates an rl.Span from a tree-sitter node and file path.
func ToExternalName ¶ added in v0.5.59
ToExternalName converts internal argument names to external CLI flag names. This is the single source of truth for name transformations in Rad.
Types ¶
type BaseNode ¶
type BaseNode struct {
// contains filtered or unexported fields
}
func (*BaseNode) CompleteSrc ¶
type FileHeader ¶
type FnSignature ¶
func GetSignature ¶
func GetSignature(name string) *FnSignature
type FunctionSet ¶ added in v0.6.15
type FunctionSet struct {
// contains filtered or unexported fields
}
func GetBuiltInFunctions ¶ added in v0.6.15
func GetBuiltInFunctions() *FunctionSet
GetBuiltInFunctions returns the singleton instance of built-in functions. This is thread-safe and loads the functions only once.
func (*FunctionSet) Contains ¶ added in v0.6.15
func (fs *FunctionSet) Contains(name string) bool
type Position ¶
func NewPosition ¶
type RadParser ¶
type RadParser struct {
// contains filtered or unexported fields
}
func NewRadParser ¶
type RadTree ¶
type RadTree struct {
// contains filtered or unexported fields
}
func (*RadTree) FindFileHeader ¶
func (rt *RadTree) FindFileHeader() (*FileHeader, bool)
func (*RadTree) FindInvalidNodeSpans ¶ added in v0.9.0
FindInvalidNodeSpans returns spans for all invalid/missing nodes.
func (*RadTree) FindInvalidNodes ¶
func (*RadTree) FindShebang ¶
func (*RadTree) HasInvalidNodes ¶ added in v0.9.0
HasInvalidNodes returns true if the tree contains any error/missing nodes.