class Rsec::Join

Join base

Public Instance Methods

_parse(ctx) click to toggle source
# File lib/rsec/parsers/join.rb, line 5
def _parse ctx
  e = left._parse ctx
  return INVALID if INVALID[e]
  ret = [e]
  loop do
    save_point = ctx.pos
    i = right._parse ctx
    if INVALID[i]
      ctx.pos = save_point
      break
    end

    t = left._parse ctx
    if INVALID[t]
      ctx.pos = save_point
      break
    end

    break if save_point == ctx.pos # stop if no advance, prevent infinite loop
    ret << i
    ret << t
  end # loop
  ret
end
even(&p) click to toggle source

@ desc.join

Only keep the even(left, token) parts
# File lib/rsec/helpers.rb, line 367
def even &p
  JoinEven[left, Rsec.try_skip_pattern(right)].map p
end
odd(&p) click to toggle source

@ desc.join

Only keep the odd(right, inter) parts
# File lib/rsec/helpers.rb, line 373
def odd &p
  JoinOdd[Rsec.try_skip_pattern(left), right].map p
end
unbox(&p) click to toggle source
# File lib/rsec/helpers.rb, line 361
def unbox &p
  Unbox[self].map p
end