From: "Earlopain (Earlopain _) via ruby-core" Date: 2026-03-05T19:29:53+00:00 Subject: [ruby-core:124934] [Ruby Bug#21945] Ripper lexes newline between identifier and `and?` as ignored newline Issue #21945 has been reported by Earlopain (Earlopain _). ---------------------------------------- Bug #21945: Ripper lexes newline between identifier and `and?` as ignored newline https://bugs.ruby-lang.org/issues/21945 * Author: Earlopain (Earlopain _) * Status: Open * 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: UNKNOWN ---------------------------------------- ```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/