in lib/rdoc/parser/ruby.rb [2204:2241]
def skip_optional_do_after_expression
skip_tkspace_without_nl
tk = get_tk
b_nest = 0
nest = 0
loop do
break unless tk
case tk[:kind]
when :on_semicolon, :on_nl, :on_ignored_nl then
break if b_nest.zero?
when :on_lparen then
nest += 1
when :on_rparen then
nest -= 1
when :on_kw then
case tk[:text]
when 'begin'
b_nest += 1
when 'end'
b_nest -= 1
when 'do'
break if nest.zero?
end
when :on_comment, :on_embdoc then
if b_nest.zero? and "\n" == tk[:text][-1] then
break
end
end
tk = get_tk
end
skip_tkspace_without_nl
get_tk if peek_tk && :on_kw == peek_tk[:kind] && 'do' == peek_tk[:text]
end