class RedParse::ListInNode::WhileOpNode

Attributes

test_first[R]

Public Class Methods

new(val1,op,val2=nil) click to toggle source
# File lib/redparse/node.rb, line 2919
def initialize(val1,op,val2=nil)
  op,val2=nil,op unless val2
  op=op.ident if op.respond_to? :ident
  @reverse=false
  @loop=true
  @test_first= !( BeginNode===val1 )
  replace [val1,val2]
  condition.special_conditions! if condition.respond_to? :special_conditions!
end

Public Instance Methods

body()
Alias for: do
condition() click to toggle source
# File lib/redparse/node.rb, line 2917
def condition; right end
consequent() click to toggle source
# File lib/redparse/node.rb, line 2918
def consequent; left end
do() click to toggle source
# File lib/redparse/node.rb, line 2930
def do; consequent end
Also aliased as: body
op() click to toggle source
# File lib/redparse/node.rb, line 2932
def op; "while" end
parsetree(o) click to toggle source
# File lib/redparse/node.rb, line 2936
def parsetree(o)
  cond=condition.rescue_parsetree(o)
  body=consequent.parsetree(o)
  !@test_first and
    body.size == 2 and
      body.first == :begin and
        body=body.last
  if cond.first==:not
    kw=:until
    cond=cond.last
  else
    kw=:while
  end
  [kw, cond, body, (@test_first or body==[:nil])]
end
reversed() click to toggle source
# File lib/redparse/node.rb, line 2933
def reversed; false end
while() click to toggle source
# File lib/redparse/node.rb, line 2929
def while; condition end