classafPegger::TreeItem
sys::Obj afPegger::TreeItem
@Js
Represents an item in a tree structure.
- add
TreeItem add(Str type, Str? matched := null, Obj? data := null)Creates and adds a
TreeItemto the end of the child items. Returns the createdTreeItem.- addItem
TreeItem addItem(TreeItem item)Adds the
TreeItemto the end of the child items and sets the parent. Returns the givenTreeItem.- data
Obj? dataUser data.
- items
TreeItem[] items := TreeItem#.emptyListThe child items.
- matched
Str? matchedAny character data matched to this item.
- next
TreeItem? next()Returns a sibling
TreeItemornullif this is the last item in the list.- parent
TreeItem? parentThe parent item.
- prev
TreeItem? prev()Returns a sibling
TreeItemornullif this is the first item in the list.- toStr
virtual override Str toStr()Prints the tree structure.
- type
Str typeThe item type.
- walk
Void walk(|TreeItem? enter, |TreeItem? exit)Walks this item and it's children, calling the given funcs when entering and exiting.