Project

General

Profile

Actions

Bug #21945

open

Ripper lexes newline between identifier and `and?` as ignored newline

Bug #21945: Ripper lexes newline between identifier and `and?` as ignored newline

Added by Earlopain (Earlopain _) about 11 hours ago.

Status:
Open
Assignee:
-
Target version:
-
ruby -v:
ruby 4.0.0 (2025-12-25 revision 553f1675f3) +PRISM [x86_64-linux]
[ruby-core:124934]

Description

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.

No data to display

Actions

Also available in: PDF Atom