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
TreeItem
to the end of the child items. Returns the createdTreeItem
.- addItem
TreeItem addItem(TreeItem item)
Adds the
TreeItem
to the end of the child items and sets the parent. Returns the givenTreeItem
.- data
Obj? data
User data.
- items
TreeItem[] items := TreeItem#.emptyList
The child items.
- matched
Str? matched
Any character data matched to this item.
- next
TreeItem? next()
Returns a sibling
TreeItem
ornull
if this is the last item in the list.- parent
TreeItem? parent
The parent item.
- prev
TreeItem? prev()
Returns a sibling
TreeItem
ornull
if this is the first item in the list.- toStr
virtual override Str toStr()
Prints the tree structure.
- type
Str type
The item type.
- walk
Void walk(|TreeItem? enter, |TreeItem? exit)
Walks this item and it's children, calling the given funcs when entering and exiting.