Class: RedParse::BlockNode
- Defined in:
- lib/redparse/node.rb
Overview
not to appear in final parse tree
Constant Summary
Constants included from FlattenedIvars
FlattenedIvars::EXCLUDED_IVARS
Instance Attribute Summary collapse
-
#do_end ⇒ Object
readonly
Returns the value of attribute do_end.
Attributes inherited from Node
#endline, #errors, #offset, #parent, #startline
Attributes included from Stackable::Meta
#boolean_identity_params, #identity_params
Instance Method Summary collapse
-
#initialize(open_brace, formals, stmts, close_brace) ⇒ BlockNode
constructor
A new instance of BlockNode.
-
#parsetree(o) ⇒ Object
obsolete.
- #to_lisp ⇒ Object
Methods inherited from ValueNode
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!, #image, #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, #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
Constructor Details
#initialize(open_brace, formals, stmts, close_brace) ⇒ BlockNode
Returns a new instance of BlockNode.
3192 3193 3194 3195 3196 3197 3198 3199 |
# File 'lib/redparse/node.rb', line 3192 def initialize(open_brace,formals,stmts,close_brace) stmts||=SequenceNode[{:@offset => open_brace.offset, :@startline=>open_brace.startline}] stmts=SequenceNode[stmts,{:@offset => open_brace.offset, :@startline=>open_brace.startline}] unless SequenceNode===stmts formals&&=BlockParams.new(Array.new(formals)) @do_end=true unless open_brace.not_real? super(formals,stmts) end |
Instance Attribute Details
#do_end ⇒ Object (readonly)
Returns the value of attribute do_end.
3201 3202 3203 |
# File 'lib/redparse/node.rb', line 3201 def do_end @do_end end |
Instance Method Details
#parsetree(o) ⇒ Object
obsolete
3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 |
# File 'lib/redparse/node.rb', line 3207 def parsetree(o) #obsolete callsite=@data[0].parsetree(o) call=@data[0].data[0] callsite[0]=:fcall if call.respond_to? :ident if call.respond_to? :ident case call.ident when "BEGIN" if o[:quirks] return [] else callsite=[:preexe] end when "END"; callsite=[:postexe] end end result=[:iter, callsite, @data[1].parsetree(o)] result.push @data[2].parsetree(o) if @data[2] result end |
#to_lisp ⇒ Object
3203 3204 3205 |
# File 'lib/redparse/node.rb', line 3203 def to_lisp "(#{params.to_lisp} #{body.to_lisp})" end |