classafPegger::TreeItem

sys::Obj
  afPegger::TreeItem

@Js

Represents an item in a tree structure.

add

Source

TreeItem add(Str type, Str? matched := null, Obj? data := null)

Creates and adds a TreeItem to the end of the child items. Returns the created TreeItem.

addItem

Source

TreeItem addItem(TreeItem item)

Adds the TreeItem to the end of the child items and sets the parent. Returns the given TreeItem.

data

Source

Obj? data

User data.

items

Source

TreeItem[] items := TreeItem#.emptyList

The child items.

matched

Source

Str? matched

Any character data matched to this item.

Source

TreeItem? next()

Returns a sibling TreeItem or null if this is the last item in the list.

parent

Source

TreeItem? parent

The parent item.

Source

TreeItem? prev()

Returns a sibling TreeItem or null if this is the first item in the list.

toStr

Source

virtual override Str toStr()

Prints the tree structure.

type

Source

Str type

The item type.

walk

Source

Void walk(|TreeItem? enter, |TreeItem? exit)

Walks this item and it's children, calling the given funcs when entering and exiting.