Documentation
¶
Index ¶
- Variables
- 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 ToExternalName(internalName string) string
- type ArgBlock
- type ArgDecl
- type ArgDeclComment
- type ArgDeclDefault
- type ArgDeclName
- type ArgDeclOptional
- type ArgDeclRename
- type ArgDeclShorthand
- type ArgDeclType
- type ArgEnumConstraint
- type ArgEnumValues
- type ArgExclusion
- type ArgName
- type ArgRangeConstraint
- type ArgRangeMinMax
- type ArgRangeOpenerCloser
- type ArgRangeValue
- type ArgRegexConstraint
- type ArgRegexValue
- type ArgRequirement
- type BaseNode
- type CallNode
- type CallbackType
- type CmdBlock
- type CmdCallback
- type CmdDescription
- type CmdName
- 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) FindArgBlock() (*ArgBlock, bool)
- func (rt *RadTree) FindCalls() []*CallNode
- func (rt *RadTree) FindCmdBlocks() ([]*CmdBlock, bool)
- func (rt *RadTree) FindFileHeader() (*FileHeader, bool)
- func (rt *RadTree) FindInvalidNodes() []*ts.Node
- func (rt *RadTree) FindNodes(nodeKind string) []*ts.Node
- func (rt *RadTree) FindShebang() (*Shebang, 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 ¶
View Source
var FnSignaturesByName map[string]FnSignature
Functions ¶
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 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 ArgBlock ¶
type ArgBlock struct {
BaseNode
Args []ArgDecl
// ArgName -> Constraint
EnumConstraints map[string]*ArgEnumConstraint
RegexConstraints map[string]*ArgRegexConstraint
RangeConstraints map[string]*ArgRangeConstraint
Requirements []ArgRequirement
Exclusions []ArgExclusion
}
type ArgDecl ¶
type ArgDecl struct {
BaseNode
Name ArgDeclName
Type ArgDeclType
Rename *ArgDeclRename
Shorthand *ArgDeclShorthand
Optional *ArgDeclOptional
Default *ArgDeclDefault
Comment *ArgDeclComment
IsVariadic bool
}
func (*ArgDecl) CommentStr ¶
func (*ArgDecl) ExternalName ¶
func (*ArgDecl) ShorthandStr ¶
type ArgDeclComment ¶
type ArgDeclDefault ¶
type ArgDeclName ¶
type ArgDeclOptional ¶
type ArgDeclOptional struct {
BaseNode
}
type ArgDeclRename ¶
type ArgDeclShorthand ¶
type ArgDeclType ¶
type ArgEnumConstraint ¶
type ArgEnumConstraint struct {
BaseNode
ArgName ArgName
Values ArgEnumValues
}
type ArgEnumValues ¶
type ArgExclusion ¶
type ArgRangeConstraint ¶
type ArgRangeConstraint struct {
BaseNode
ArgName ArgName
Range ArgRangeValue
}
type ArgRangeMinMax ¶
type ArgRangeOpenerCloser ¶
type ArgRangeValue ¶
type ArgRangeValue struct {
Opener ArgRangeOpenerCloser
Closer ArgRangeOpenerCloser
Min *ArgRangeMinMax
Max *ArgRangeMinMax
}
type ArgRegexConstraint ¶
type ArgRegexConstraint struct {
BaseNode
ArgName ArgName
Regex ArgRegexValue
}
type ArgRegexValue ¶
type ArgRequirement ¶
type BaseNode ¶
type BaseNode struct {
// contains filtered or unexported fields
}
func (*BaseNode) CompleteSrc ¶
type CallbackType ¶ added in v0.6.16
type CallbackType int
const ( CallbackIdentifier CallbackType = iota CallbackLambda )
type CmdBlock ¶ added in v0.6.16
type CmdBlock struct {
BaseNode
Name CmdName
Description *CmdDescription
Args []ArgDecl
// Constraints (reuse from ArgBlock)
EnumConstraints map[string]*ArgEnumConstraint
RegexConstraints map[string]*ArgRegexConstraint
RangeConstraints map[string]*ArgRangeConstraint
Requirements []ArgRequirement
Exclusions []ArgExclusion
// Callback
Callback CmdCallback
}
type CmdCallback ¶ added in v0.6.16
type CmdCallback struct {
BaseNode
Type CallbackType
IdentifierName *string // For function reference callbacks (CallbackIdentifier)
LambdaNode *ts.Node // For inline lambda callbacks (CallbackLambda)
}
type CmdDescription ¶ added in v0.6.16
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 Node ¶
type Node interface {
Node() *ts.Node
CompleteSrc() string
Src() string
// Indexes in the original source code.
// Zero indexed, so add +1 to get human readable values.
// todo wrap in own Range object instead?
StartByte() int
EndByte() int // inclusive
StartPos() Position
EndPos() Position // inclusive
}
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) FindArgBlock ¶
func (*RadTree) FindCmdBlocks ¶ added in v0.6.16
func (*RadTree) FindFileHeader ¶
func (rt *RadTree) FindFileHeader() (*FileHeader, bool)
func (*RadTree) FindInvalidNodes ¶
func (*RadTree) FindShebang ¶
type StringNode ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.