Class: RedParse::CommaOpNode

Inherits:
ListOpNode show all
Defined in:
lib/redparse/node.rb

Overview

not to appear in final tree

Constant Summary

Constants included from FlattenedIvars

FlattenedIvars::EXCLUDED_IVARS

Instance Attribute Summary collapse

Attributes inherited from Node

#endline, #errors, #offset, #parent, #startline

Attributes included from Stackable::Meta

#boolean_identity_params, #identity_params

Instance Method Summary collapse

Methods inherited from ListOpNode

#initialize

Methods inherited from Node

#+, #+@, #==, [], #[]=, #add_parent_links!, #begin_parsetree, create, #data, #deep_copy, #delete_extraneous_ivars!, #delete_linenums!, #depthwalk, #depthwalk_nodes, #error?, #evalable_inspect, #fixup_multiple_assignments!, #fixup_rescue_assignments!, #initialize, #initialize_ivars, inline_symbols, #inspect, #lhs_unparse, #linerange, #lvars_defined_in, #merge_replacement_session, namelist, #negate, #original_brackets_assign, param_names, #parsetree, #parsetrees, #pretty_print, #prohibit_fixup, #replace_ivars_and_self, #replace_value, #rescue_parsetree, #to_parsetree, #to_parsetree_and_warnings, #unary, #walk, #xform_tree!

Methods included from Stackable::Meta

#build_exemplars, #enumerate_exemplars, #identity_param

Methods included from FlattenedIvars

#flattened_ivars, #flattened_ivars_equal?

Methods included from Stackable

#identity_name

Constructor Details

This class inherits a constructor from RedParse::ListOpNode

Instance Attribute Details

#lvalueObject



1413
1414
1415
1416
# File 'lib/redparse/node.rb', line 1413

def lvalue
  return @lvalue if defined? @lvalue
  @lvalue=true
end

Instance Method Details

#extract_unbraced_hashObject



1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
# File 'lib/redparse/node.rb', line 1420

def extract_unbraced_hash
    param_list=Array.new(self)
    first=last=nil
    param_list.each_with_index{|param,i|
      break first=i if ArrowOpNode===param
    }
    (1..param_list.size).each{|i| param=param_list[-i]
      break last=-i if ArrowOpNode===param
    }
    if first
      arrowrange=first..last
      arrows=param_list[arrowrange]
      h=HashLiteralNode.new(nil,arrows,nil)
      h.offset=arrows.first.offset
      h.startline=arrows.first.startline
      h.endline=arrows.last.endline
      return h,arrowrange
    end
end

#imageObject



1409
# File 'lib/redparse/node.rb', line 1409

def image; '(,)' end

#to_lispObject



1410
1411
1412
# File 'lib/redparse/node.rb', line 1410

def to_lisp
  "(#{map{|x| x.to_lisp}.join(" ")})"
end