Class: RedParse::UndefNode

Inherits:
ValueNode show all
Includes:
BareSymbolUtils
Defined in:
lib/redparse/node.rb,
lib/redparse/ReduceWithsFor_RedParse_1_9.rb,
lib/redparse/ReduceWithsFor_RedParse_1_8.rb

Constant Summary

Constants included from FlattenedIvars

FlattenedIvars::EXCLUDED_IVARS

Instance Attribute Summary

Attributes inherited from Node

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

Attributes included from Stackable::Meta

#boolean_identity_params, #identity_params

Instance Method Summary collapse

Methods included from BareSymbolUtils

#baresym2str, #str2parsetree, #str_unparse

Methods inherited from ValueNode

#lvalue, #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_ivars, inline_symbols, #inspect, #lhs_unparse, #linerange, #lvalue, #lvars_defined_in, #merge_replacement_session, namelist, #negate, #original_brackets_assign, param_names, #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

#initialize(first, middle, last = nil) ⇒ UndefNode

Returns a new instance of UndefNode.



5026
5027
5028
5029
5030
5031
5032
5033
5034
# File 'lib/redparse/node.rb', line 5026

def initialize(first,middle,last=nil)
  @offset=first.offset
  if last
    node,newsym=first,last
    super(*node << baresym2str(newsym))
  else
    super(baresym2str(middle))
  end
end

Instance Method Details

#imageObject



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

def image; "(undef)" end

#parsetree(o) ⇒ Object



5042
5043
5044
5045
5046
5047
5048
5049
# File 'lib/redparse/node.rb', line 5042

def parsetree(o)
  result=map{|name| [:undef, str2parsetree(name,o)] }
  if result.size==1
    result.first
  else
    result.unshift :block 
  end
end

#reducer_identObject



17595
17596
17597
# File 'lib/redparse/ReduceWithsFor_RedParse_1_9.rb', line 17595

def reducer_ident
  :UndefNode
end

#unparse(o = default_unparse_options) ⇒ Object



5038
5039
5040
# File 'lib/redparse/node.rb', line 5038

def unparse o=default_unparse_options
  "undef #{map{|name| str_unparse name,o}.join(', ')}"
end