-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Labels
documentationImprovements or additions to documentationImprovements or additions to documentation
Description
Somewhere in the documentation, we should highlight that you can pretty-print RuleNodes in tree form using print_tree from AbstractTrees. Assuming Herb-AI/HerbCore.jl#39 is merged, this will be available from within Herb without the need for an extra using AbstractTree.
Also, while not specific to Herb, it'd be nice to note that Exprs can be pretty-printed in the same way.
julia> using Herb
julia> using AbstractTrees: print_tree # until HerbCore.jl#39 is merged
julia> g = @csgrammar begin
Int = 1 | 2
Int = 3 + Int
end
julia> rn = @rulenode 3{3{3{2}}}
julia> print_tree(rn)
3
└─ 3
└─ 3
└─ 2
julia> print_tree(rulenode2expr(rn, g))
:(3 + (3 + (3 + 2)))
├─ :+
├─ 3
└─ :(3 + (3 + 2))
├─ :+
├─ 3
└─ :(3 + 2)
├─ :+
├─ 3
└─ 2
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
documentationImprovements or additions to documentationImprovements or additions to documentation