From: "k0kubun (Takashi Kokubun) via ruby-core" Date: 2026-03-16T18:57:49+00:00 Subject: [ruby-core:125017] [Ruby Bug#21945] Ripper lexes newline between identifier and `and?` as ignored newline Issue #21945 has been updated by k0kubun (Takashi Kokubun). Backport changed from 3.2: DONTNEED, 3.3: DONTNEED, 3.4: DONTNEED, 4.0: REQUIRED to 3.2: DONTNEED, 3.3: DONTNEED, 3.4: DONTNEED, 4.0: DONE ruby_4_0 commit:1d3581e18a689f0d392686283e340058ac468ffd merged revision(s) commit:55694ad7efc3f8dc6d5c7aefa60ded4c303ed6cf. ---------------------------------------- Bug #21945: Ripper lexes newline between identifier and `and?` as ignored newline https://bugs.ruby-lang.org/issues/21945#change-116714 * Author: Earlopain (Earlopain _) * Status: Closed * ruby -v: ruby 4.0.0 (2025-12-25 revision 553f1675f3) +PRISM [x86_64-linux] * Backport: 3.2: DONTNEED, 3.3: DONTNEED, 3.4: DONTNEED, 4.0: DONE ---------------------------------------- ```rb Ripper.lex("foo\nand?") => [[[1, 0], :on_ident, "foo", CMDARG], [[1, 3], :on_ignored_nl, "\n", CMDARG], [[2, 0], :on_ident, "and?", ARG]] ``` Presumably this is because until the `?` is encountered, it is considered syntax as introduced in https://bugs.ruby-lang.org/issues/20925. The same is true for `and!` and `or`. If any other character is encountered, it lexes correctly like in `foo\nandbar`. -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/