class RedParse::ListInNode::BlockNode
Attributes
do_end[R]
Public Class Methods
new(open_brace,formals,stmts,close_brace)
click to toggle source
Calls superclass method
RedParse::ListInNode::Node::new
# File lib/redparse/node.rb, line 3414 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 if formals and formals.size==1 and SequenceNode===formals[0] formals,blocklocals,* = formals[0] formals&&=BlockParams[formals] if CommaOpNode===blocklocals blocklocals=Array(blocklocals) else blocklocals=[blocklocals] end blocklocals.map!{|bl| bl.ident} blocklocals.extend ListInNode end formals&&=BlockParams.new(Array.new(formals)) @do_end=true unless open_brace.not_real? super(formals,blocklocals,stmts) end
Public Instance Methods
parsetree(o)
click to toggle source
# File lib/redparse/node.rb, line 3441 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()
click to toggle source
# File lib/redparse/node.rb, line 3437 def to_lisp "(#{params.to_lisp} #{body.to_lisp})" end