diff --git a/.github/workflows/Documenter.yml b/.github/workflows/Documenter.yml index 8faa2e2..d836d9a 100644 --- a/.github/workflows/Documenter.yml +++ b/.github/workflows/Documenter.yml @@ -10,7 +10,8 @@ jobs: name: Documentation runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 + - uses: julia-actions/cache@v2 - uses: julia-actions/julia-buildpkg@latest - uses: julia-actions/julia-docdeploy@latest env: diff --git a/docs/Project.toml b/docs/Project.toml index 101c2b6..f2f2b20 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -1,5 +1,6 @@ [deps] +AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c" Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" [compat] -Documenter = "0.26" +Documenter = "1.4" diff --git a/docs/src/index.md b/docs/src/index.md index 398d41b..a0b4855 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -85,6 +85,7 @@ Types with the `IndexedChildren` trait *must* return an indexable object from `c NodeType NodeTypeUnknown HasNodeType +nodetype ``` Providing the `HasNodeType` trait will guarantee that all nodes connected to the node must be of the @@ -180,12 +181,18 @@ ischild isroot intree isdescendant +treesize treebreadth treeheight descendleft getroot -printtree +print_tree printnode +print_child_key +TreeCharSet +shouldprintkeys +repr_tree +repr_node ``` ## Example Implementations diff --git a/docs/src/iteration.md b/docs/src/iteration.md index da04893..cf8e9a0 100644 --- a/docs/src/iteration.md +++ b/docs/src/iteration.md @@ -34,6 +34,7 @@ PostOrderDFS Leaves Siblings StatelessBFS +MapNode treemap ``` @@ -56,4 +57,6 @@ instance initial next statetype +ascend +descend ``` diff --git a/src/AbstractTrees.jl b/src/AbstractTrees.jl index 2f2f9b0..893be0a 100644 --- a/src/AbstractTrees.jl +++ b/src/AbstractTrees.jl @@ -1,11 +1,3 @@ -""" - AbstractTrees - -This package is intended to provide an abstract interface for working -with tree structures. -Though the package itself is not particularly sophisticated, it defines -the interface that can be used by other packages to talk about trees. -""" module AbstractTrees using Base: HasLength, SizeUnknown, HasEltype, EltypeUnknown diff --git a/src/base.jl b/src/base.jl index b6bdbba..76f69ff 100644 --- a/src/base.jl +++ b/src/base.jl @@ -2,7 +2,7 @@ """ nodevalue(node) -Get the value associated with a node in a tree. This removes wrappers such as [`Indexed`](@ref) or [`TreeCursor`](@ref)s. +Get the value associated with a node in a tree. This removes wrappers such as [`IndexNode`](@ref) or [`TreeCursor`](@ref)s. By default, this function is the identity. diff --git a/src/iteration.jl b/src/iteration.jl index fe01eac..d8410ed 100644 --- a/src/iteration.jl +++ b/src/iteration.jl @@ -36,7 +36,7 @@ Obtain the next [`IteratorState`](@ref) after the current one. If `s` is the fi `nothing`. This provides an alternative iteration protocol which only uses the states directly as opposed to -[`Base.iterate`](@ref) which takes an iterator object and the current state as separate arguments. +`Base.iterate` which takes an iterator object and the current state as separate arguments. """ function next end diff --git a/src/printing.jl b/src/printing.jl index 35fb267..0426e01 100644 --- a/src/printing.jl +++ b/src/printing.jl @@ -19,7 +19,7 @@ signature `g(io::IO, key;)`. truncated nodes. * `charset::TreeCharSet` - [`TreeCharSet`](@ref) to use to print branches. * `printkeys::Union{Bool, Nothing}` - Whether to print keys of child nodes (using - `pairs(children(node))`). A value of `nothing` uses [`printkeys_default`](@ref) do decide the + `pairs(children(node))`). A value of `nothing` uses [`shouldprintkeys`](@ref) to decide the behavior on a node-by-node basis. * `printnode_kw = (;)` - keyword arguments to forward to `f`.