Class: Plasma::Interpreter::ColNode

Inherits:
PlasmaNode show all
Defined in:
lib/plasma/interpreter/plasma_grammarnode.rb

Direct Known Subclasses

ApplyNode, DeclNode, HashNode, ListNode, ParamsNode, SeqNode

Instance Method Summary collapse

Methods inherited from PlasmaNode

#empty?, #evaluate

Instance Method Details

#colObject



180
181
182
183
184
185
186
187
188
189
190
191
192
# File 'lib/plasma/interpreter/plasma_grammarnode.rb', line 180

def col
  if first.empty?
    []
  else
    if rest.empty?
      [first]
    else
      rest.elements.map do |el|
        el.elements.select{|subel| subel.is_a? PlasmaNode}
      end.flatten.unshift(first)
    end
  end
end