class RedParse::UntilOpNode

Public Instance Methods

reducer_ident() click to toggle source
# File lib/redparse/ReduceWithsFor_RedParse_1_8.rb, line 17334
def reducer_ident
  :UntilOpNode
end
rip(p) click to toggle source
# File lib/redparse/ripper.rb, line 158
def rip p
  if BeginNode===consequent
    if @quirks
      #this is WRONG!!!, but it's how ripper works... urk
      #if expression modified by a until 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 until b' now parses the same as 'b until begin a end'
      p.on_until_mod( condition.rip(p), consequent.rip(p) ) 
    else
      p.on_until_mod( consequent.rip(p), condition.rip(p), :loop_first )
    end
  else
    p.on_until_mod( consequent.rip(p), condition.rip(p) )
  end
end