Class: Flor::Macro::Iterator

Inherits:
Flor::Macro show all
Defined in:
lib/flor/pcore/iterator.rb

Constant Summary

Constants inherited from Procedure

Procedure::RVARS, Procedure::TRUE_ATTS

Instance Attribute Summary

Attributes inherited from Node

#message

Instance Method Summary collapse

Methods inherited from Flor::Macro

#rewrite

Methods inherited from Procedure

[], core?, #debug_msg, #debug_tree, #end, #flank, #heap, inherited, make, names, #pre_execute, #prepare_on_receive_last, #trigger_on_error

Methods inherited from Node

#child_id, #cnodes, #cnodes_any?, #cnodes_empty?, #deref, #descendant_of?, #domain, #exid, #fei, #from, #h, #initialize, #lookup_tree, #lookup_value, #message_or_node_payload, #nid, #node_closed?, #node_ended?, #node_open?, #node_payload, #node_payload_ret, #node_status, #node_status_flavour, #on_error_parent, #parent, #payload, #payload_ret, #point, #reheap, #to_procedure_node, #tree

Constructor Details

This class inherits a constructor from Flor::Node

Instance Method Details

#rewrite_iterator_tree(procedure_name) ⇒ Object



147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# File 'lib/flor/pcore/iterator.rb', line 147

def rewrite_iterator_tree(procedure_name)

  atts = att_children

  l = tree[2]

  th = [ procedure_name, [], l, *tree[3] ]
  atts.each { |ac| th[1] << Flor.dup(ac) }

  if non_att_children.any?

    td = [ 'def', [], l ]

    #td[1] << [ '_att', [ [ 'res', [], l ] ], l ]      #  if procedure_name == 'reduce'
    #td[1] << [ '_att', [ [ 'elt', [], l ] ], l ]
      #
      # the "_apply" does that work now and it distinguishes elt vs key/val

    non_att_children.each { |nac| td[1] << Flor.dup(nac) }

    th[1] << td
  end

  th
end