Sha256: 8f563c63785354913c3601894b8ae927615a3dd4c5eb1bf033d8f03977d149dc
Contents?: true
Size: 1.18 KB
Versions: 2
Compression:
Stored size: 1.18 KB
Contents
module RipperRubyParser module SexpHandlers module Loops def process_until exp handle_conditional_loop(:until, exp) end def process_until_mod exp handle_conditional_loop_mod(:until, exp) end def process_while exp handle_conditional_loop(:while, exp) end def process_while_mod exp handle_conditional_loop_mod(:while, exp) end def process_for exp _, var, coll, block = exp.shift 4 coll = process(coll) assgn = s(:lasgn, process(var)[1]) block = wrap_in_block(map_body(block)) if block.nil? s(:for, coll, assgn) else s(:for, coll, assgn, block) end end private def check_at_start? block block.sexp_type != :begin end def handle_conditional_loop type, exp _, cond, block = exp.shift 3 s(type, process(cond), wrap_in_block(map_body(block)), true) end def handle_conditional_loop_mod type, exp _, cond, block = exp.shift 3 check_at_start = check_at_start?(block) s(type, process(cond), process(block), check_at_start) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ripper_ruby_parser-1.1.1 | lib/ripper_ruby_parser/sexp_handlers/loops.rb |
ripper_ruby_parser-1.1.0 | lib/ripper_ruby_parser/sexp_handlers/loops.rb |