Class: RedParse::ElsifNode
- 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
- #image ⇒ Object
-
#initialize(elsifword, condition, thenword, consequent) ⇒ ElsifNode
constructor
A new instance of ElsifNode.
-
#parsetree(o) ⇒ Object
obsolete?.
- #reducer_ident ⇒ Object
- #reducer_method(stack) ⇒ Object
- #to_lisp ⇒ Object
- #unparse(o = default_unparse_options) ⇒ Object
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
Constructor Details
#initialize(elsifword, condition, thenword, consequent) ⇒ ElsifNode
Returns a new instance of ElsifNode.
4406 4407 4408 4409 4410 |
# File 'lib/redparse/node.rb', line 4406 def initialize(elsifword,condition,thenword,consequent) @offset=elsifword.offset condition.special_conditions! if condition.respond_to? :special_conditions! super(condition,consequent) end |
Instance Method Details
#image ⇒ Object
4416 |
# File 'lib/redparse/node.rb', line 4416 def image; "(elsif)" end |
#parsetree(o) ⇒ Object
obsolete?
4426 4427 4428 |
# File 'lib/redparse/node.rb', line 4426 def parsetree(o) #obsolete? [:if, condition.rescue_parsetree(o), consequent&&consequent.parsetree(o), ] end |
#reducer_ident ⇒ Object
17248 17249 17250 |
# File 'lib/redparse/ReduceWithsFor_RedParse_1_9.rb', line 17248 def reducer_ident :ElsifNode end |
#reducer_method(stack) ⇒ Object
17245 17246 17247 |
# File 'lib/redparse/ReduceWithsFor_RedParse_1_9.rb', line 17245 def reducer_method(stack) :reduce_with_tos_ElsifNode end |
#to_lisp ⇒ Object
4422 4423 4424 |
# File 'lib/redparse/node.rb', line 4422 def to_lisp "("+condition.to_lisp+" "+consequent.to_lisp+")" end |
#unparse(o = default_unparse_options) ⇒ Object
4418 4419 4420 |
# File 'lib/redparse/node.rb', line 4418 def unparse o= "elsif #{condition.unparse o}#{unparse_nl(consequent,o)}#{consequent.unparse o if consequent};" end |