Class: RedParse::ParenedNode
- Inherits:
-
ValueNode
show all
- Defined in:
- lib/redparse/node.rb,
lib/redparse/ripper.rb,
lib/redparse/ReduceWithsFor_RedParse_1_9.rb,
lib/redparse/ReduceWithsFor_RedParse_1_8.rb
Constant Summary
FlattenedIvars::EXCLUDED_IVARS
Instance Attribute Summary collapse
Attributes inherited from Node
#endline, #errors, #offset, #parent, #startline
#boolean_identity_params, #identity_params
Instance Method Summary
collapse
Methods inherited from ValueNode
#reducer_method
Methods inherited from Node
#+, #+@, #==, [], #[]=, #add_parent_links!, #args_rip, #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, #lvars_defined_in, #merge_replacement_session, namelist, #negate, #original_brackets_assign, param_names, #parsetrees, #pretty_print, #prohibit_fixup, #replace_ivars_and_self, #replace_value, #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!
#build_exemplars, #enumerate_exemplars, #identity_param
#flattened_ivars, #flattened_ivars_equal?
Methods included from Stackable
#identity_name
Constructor Details
#initialize(lparen = nil, body = nil, rparen = nil) ⇒ ParenedNode
Returns a new instance of ParenedNode.
2034
2035
2036
2037
2038
|
# File 'lib/redparse/node.rb', line 2034
def initialize(lparen=nil,body=nil,rparen=nil)
return unless body
@offset=lparen.offset
self[0]=body
end
|
Instance Attribute Details
#after_comma ⇒ Object
Returns the value of attribute after_comma.
2040
2041
2042
|
# File 'lib/redparse/node.rb', line 2040
def after_comma
@after_comma
end
|
#after_equals ⇒ Object
Returns the value of attribute after_equals.
2040
2041
2042
|
# File 'lib/redparse/node.rb', line 2040
def after_equals
@after_equals
end
|
#lvalue ⇒ Object
2068
2069
2070
2071
|
# File 'lib/redparse/node.rb', line 2068
def lvalue
return @lvalue if defined? @lvalue
@lvalue=true
end
|
Instance Method Details
#image ⇒ Object
2042
|
# File 'lib/redparse/node.rb', line 2042
def image; "(#{body.image})" end
|
#op? ⇒ Boolean
2054
|
# File 'lib/redparse/node.rb', line 2054
def op?; false end
|
#parsetree(o) ⇒ Object
Also known as:
begin_parsetree
2056
2057
2058
|
# File 'lib/redparse/node.rb', line 2056
def parsetree(o)
body ? body.parsetree(o) : [:nil]
end
|
#reducer_ident ⇒ Object
17590
17591
17592
|
# File 'lib/redparse/ReduceWithsFor_RedParse_1_9.rb', line 17590
def reducer_ident
:ParenedNode
end
|
#rescue_parsetree(o) ⇒ Object
2060
2061
2062
2063
2064
|
# File 'lib/redparse/node.rb', line 2060
def rescue_parsetree o
body ? body.rescue_parsetree(o) : [:nil]
end
|
#rip(p) ⇒ Object
359
360
361
362
|
# File 'lib/redparse/ripper.rb', line 359
def rip p
list= SequenceNode===val ? val : [val]
p.on_paren stmts_rip list,p
end
|
#special_conditions! ⇒ Object
2044
2045
2046
2047
|
# File 'lib/redparse/node.rb', line 2044
def special_conditions!
node=body
node.special_conditions! if node.respond_to? :special_conditions!
end
|
#to_lisp ⇒ Object
2049
2050
2051
2052
|
# File 'lib/redparse/node.rb', line 2049
def to_lisp
huh body.to_lisp
end
|
#unparse(o = default_unparse_options) ⇒ Object
2076
2077
2078
|
# File 'lib/redparse/node.rb', line 2076
def unparse(o=default_unparse_options)
"(#{body&&body.unparse(o)})"
end
|