def code_tree
      kids = j_instance.getChildren

      kids.each_with_object([]) do |kid, acc|
        data = { type: kid.getType, parent_type: j_instance.getType, token: kid.toString }
        subtree = self.class.new(kid).code_tree
        data[:children] = subtree unless subtree.empty?
        acc << data
      end
    end
def code_tree
      kids = j_instance.getChildren

      kids.each_with_object([]) do |kid, acc|
        data = { type: kid.getType, parent_type: j_instance.getType, token: kid.toString }
        subtree = self.class.new(kid).code_tree
        data[:children] = subtree unless subtree.empty?
        acc << data
      end
    end
Composes array representation of sentence tree where
 each hash has following fields:

  :type => <[String] node type>,
  :parent_type => <[String] type of parent node>,
  :token => <[String] current token>,
  :children => <Array[Hash] array of child nodes hashes>

 @return [Array<Hash>]