class RedParse::WhileOpNode

Public Instance Methods

reducer_ident() click to toggle source
# File lib/redparse/ReduceWithsFor_RedParse_1_8.rb, line 17274
def reducer_ident
  :WhileOpNode
end
rip(p) click to toggle source
# File lib/redparse/ripper.rb, line 137
def rip p
  if BeginNode===consequent
    if @quirks
      #this is WRONG!!!, but it's how ripper works... urk
      #if expression modified by a while operator is a begin node,
      #ruby always executes the loop at least once,
      #and doesn't check the condition til after the first execution.
      #Ripper reverses the order of condition and consequent to signal
      #an execute-at-least-once loop. But, that's not good enough.
      #because 'begin a end while b' now parses the same as 'b while begin a end'
      p.on_while_mod( condition.rip(p), consequent.rip(p) ) 
    else
      p.on_while_mod( consequent.rip(p), condition.rip(p), :loop_first )
    end
  else
    p.on_while_mod( consequent.rip(p), condition.rip(p) )
  end
end