Class: RedParse::CommaOpNode

Inherits:
ListOpNode show all
Defined in:
lib/redparse/node.rb,
lib/redparse/ReduceWithsFor_RedParse_1_9.rb,
lib/redparse/ReduceWithsFor_RedParse_1_8.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 ValueNode

#reducer_method

Methods inherited from Node

#+, #+@, #==, [], #[]=, #add_parent_links!, #args_rip, #begin_parsetree, #classic_inspect, create, #data, #deep_copy, #delete_extraneous_ivars!, #delete_linenums!, #depthwalk, #depthwalk_nodes, #error?, #evalable_inspect, #fixup_multiple_assignments!, #fixup_rescue_assignments!, #force_stmt_list_rip, #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, #rfind, #rfind_all, #rgrep, #rip_and_rescues, #rip_explode!, #short_inspect, #stmts_rip, #to_parsetree, #to_parsetree_and_warnings, #to_ruby, #to_s, #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



1505
1506
1507
1508
# File 'lib/redparse/node.rb', line 1505

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

Instance Method Details

#extract_unbraced_hashObject



1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
# File 'lib/redparse/node.rb', line 1512

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



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

def image; '(,)' end

#reducer_identObject



17520
17521
17522
# File 'lib/redparse/ReduceWithsFor_RedParse_1_9.rb', line 17520

def reducer_ident
  :CommaOpNode
end

#to_lispObject



1502
1503
1504
# File 'lib/redparse/node.rb', line 1502

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