Method: ANTLR3::AST::TreeAdaptor#each_ancestor

Defined in:
lib/antlr3/tree.rb

#each_ancestor(tree, include_tree = true) ⇒ Object



735
736
737
738
739
740
741
742
# File 'lib/antlr3/tree.rb', line 735

def each_ancestor( tree, include_tree = true )
  block_given? or return enum_for( :each_ancestor, tree, include_tree )
  if include_tree
    begin yield( tree ) end while tree = parent_of( tree )
  else
    while tree = parent_of( tree ) do yield( tree ) end
  end
end