Skip to content

Commit

Permalink
Define numchildren() function (#464)
Browse files Browse the repository at this point in the history
  • Loading branch information
c42f authored Jul 17, 2024
1 parent a11e664 commit 6d7abc4
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/syntax_tree.jl
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ end

haschildren(node::TreeNode) = node.children !== nothing
children(node::TreeNode) = (c = node.children; return c === nothing ? () : c)
numchildren(node::TreeNode) = (isnothing(node.children) ? 0 : length(node.children))


"""
Expand Down

0 comments on commit 6d7abc4

Please sign in to comment.