Project

General

Profile

Bug #11485 ยป ripper-ignored-nl-nil.patch

jeremyevans0 (Jeremy Evans), 07/03/2019 08:31 PM

View differences:

parse.y
case '|':
case '&':
case '.': {
#ifndef RIPPER
dispatch_delayed_token(p, tIGNORED_NL);
#else
if (p->delayed != Qnil) {
dispatch_delayed_token(p, tIGNORED_NL);
}
#endif
if (c == '|' ? peek(p, '>') : (peek(p, '.') == (c == '&'))) {
pushback(p, c);
dispatch_scan_event(p, tSP);
test/ripper/test_parser_events.rb
assert_equal true, thru_ifop
end
def test_ignored_nl
ignored_nl = []
parse("foo # comment\n...\n", :on_ignored_nl) {|_, a| ignored_nl << a}
assert_equal ["\n"], ignored_nl
end
def test_lambda
thru_lambda = false
parse('->{}', :on_lambda) {thru_lambda = true}
    (1-1/1)