Lines Matching refs:tree
359 def set_child( index, tree ) argument
360 return if tree.nil?
361 tree.flat_list? and raise ArgumentError, "Can't set single child to a list"
362 tree.parent = self
363 tree.child_index = index
364 self[ index ] = tree
690 def add_child( tree, child ) argument
691 tree.add_child( child ) if tree and child
694 def child_count( tree ) argument
695 tree.child_count
698 def child_index( tree ) argument
699 tree.child_index rescue 0
702 def child_of( tree, index ) argument
703 tree.nil? ? nil : tree.child( index )
710 def copy_tree( tree, parent = nil ) argument
711 tree or return nil
712 new_tree = copy_node( tree )
713 set_child_index( new_tree, child_index( tree ) )
715 each_child( tree ) do | child |
722 def delete_child( tree, index ) argument
723 tree.delete_child( index )
727 def each_child( tree ) argument
728 block_given? or return enum_for( :each_child, tree )
729 for i in 0 ... child_count( tree )
730 yield( child_of( tree, i ) )
732 return tree
735 def each_ancestor( tree, include_tree = true ) argument
736 block_given? or return enum_for( :each_ancestor, tree, include_tree )
738 begin yield( tree ) end while tree = parent_of( tree )
740 while tree = parent_of( tree ) do yield( tree ) end
744 def flat_list?( tree ) argument
745 tree.flat_list?
748 def empty?( tree ) argument
749 child_count( tree ).zero?
752 def parent( tree ) argument
753 tree.parent
771 def set_child_index( tree, index ) argument
772 tree.child_index = index
775 def set_parent( tree, parent ) argument
776 tree.parent = parent
779 def set_token_boundaries( tree, start_token = nil, stop_token = nil ) argument
780 return unless tree
784 tree.start_index = start
785 tree.stop_index = stop
786 return tree
789 def text_of( tree ) argument
790 tree.text rescue nil
793 def token( tree ) argument
794 CommonTree === tree ? tree.token : nil
797 def token_start_index( tree ) argument
798 tree ? tree.token_start_index : -1
801 def token_stop_index( tree ) argument
802 tree ? tree.token_stop_index : -1
805 def type_name( tree ) argument
806 tree.name rescue 'INVALID'
809 def type_of( tree ) argument
810 tree.type rescue INVALID_TOKEN_TYPE
862 tree = create_with_payload( from_token )
863 return tree
913 def empty?( tree ) argument
914 tree.empty?
917 def each_child( tree ) argument
918 block_given? or return enum_for( :each_child, tree )
919 tree.each do | child |
1020 def fill_buffer( tree = @root ) argument
1021 @nodes << tree unless nil_tree = @adaptor.flat_list?( tree )
1022 unless @adaptor.empty?( tree )
1024 @adaptor.each_child( tree ) { | c | fill_buffer( c ) }
1027 @position = 0 if tree == @root