Documentation
¶
Index ¶
- func DropWrapAll(n *Node)
- func ParseNumber(s string) (interface{}, bool)
- func Wrap(n *Node, termWidth int)
- type JsonParser
- type Kind
- type LineParser
- type Node
- func (n *Node) Adjacent(child *Node)
- func (n *Node) Append(child *Node)
- func (n *Node) Bottom() *Node
- func (n *Node) Children() ([]string, []*Node)
- func (n *Node) Collapse() *Node
- func (n *Node) CollapseRecursively()
- func (n *Node) Expand()
- func (n *Node) ExpandRecursively(level, maxLevel int)
- func (n *Node) FindByPath(path []any) *Node
- func (n *Node) FindNextNonErr() *Node
- func (n *Node) ForEach(cb func(*Node))
- func (n *Node) HasChildren() bool
- func (n *Node) IsCollapsed() bool
- func (n *Node) IsWrap() bool
- func (n *Node) Paths(paths *[]string, nodes *[]*Node)
- func (n *Node) Root() *Node
- func (n *Node) String() string
- func (n *Node) ToValue(vm *goja.Runtime) goja.Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DropWrapAll ¶
func DropWrapAll(n *Node)
func ParseNumber ¶
ParseNumber parses a number from a string as int64 or *big.Int.
Types ¶
type JsonParser ¶
type JsonParser struct {
// contains filtered or unexported fields
}
func NewJsonParser ¶
func NewJsonParser(rd io.Reader, strict bool) *JsonParser
func (*JsonParser) Parse ¶
func (p *JsonParser) Parse() (node *Node, err error)
func (*JsonParser) Recover ¶
func (p *JsonParser) Recover() *Node
type LineParser ¶
type LineParser struct {
// contains filtered or unexported fields
}
func NewLineParser ¶
func NewLineParser(in io.Reader) *LineParser
func (*LineParser) Parse ¶
func (p *LineParser) Parse() (*Node, error)
func (*LineParser) Recover ¶
func (p *LineParser) Recover() *Node
type Node ¶
type Node struct {
Prev, Next, End *Node
Parent *Node
Collapsed *Node
Depth uint8
Kind Kind
Key string
Value string
Size int
Chunk string
ChunkEnd *Node
Comma bool
Index int
LineNumber int
}
func DeleteNode ¶
DeleteNode removes the node at from the linked structure and returns a node to select next. It returns (nextToSelect, true) if deletion happened, or (nil, false) if nothing was deleted. Rules: - Do nothing if at is nil, points to root (no parent), or is a bracket/closing node (Index == -1). - If at is a wrap placeholder (Chunk set, Value empty), operate on its parent value. - Maintain Prev/Next links skipping the deleted range [at..endOf]. - Clear trailing comma on the previous sibling when deleting the last child before parent's End. - Decrement parent.Size and reindex subsequent array siblings. - Choose selection: prefer next; if next is nil or parent.End, prefer prev; else parent.
func (*Node) CollapseRecursively ¶
func (n *Node) CollapseRecursively()