From: "alanwu (Alan Wu) via ruby-core" Date: 2025-09-13T14:54:52+00:00 Subject: [ruby-core:123243] [Ruby Bug#21097] `x = a rescue b in c` and `def f = a rescue b in c` parsed differently between parse.y and prism Issue #21097 has been updated by alanwu (Alan Wu). matz (Yukihiro Matsumoto) wrote in #note-5: > The behavior of Prism in 3.5 is close to my intention. > > Matz. naruse (Yui NARUSE) wrote in #note-11: > Prism's behavior should be compatible with Ruby 3.3. > Unless a design change is accepted, it should not break a compatibility. > Could you change behaviors showed in this ticket to Ruby 3.3's behavior? Looks like the behavior for 3.5 is undecided for now. In any case, the behavior for 3.4 should be consistent with 3.3, so it'd be nice to fix Prism's behavior when parsing with 3.4 grammar. ---------------------------------------- Bug #21097: `x = a rescue b in c` and `def f = a rescue b in c` parsed differently between parse.y and prism https://bugs.ruby-lang.org/issues/21097#change-114576 * Author: tompng (tomoya ishida) * Status: Assigned * Assignee: nobu (Nobuyoshi Nakada) * ruby -v: ruby 3.5.0dev (2025-01-27T08:19:32Z master c3c7300b89) +YJIT +MN +PRISM [arm64-darwin22] * Backport: 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONTNEED, 3.4: REQUIRED ---------------------------------------- ~~~ruby x = a rescue b in c (x = (a rescue b)) in c # parse.y, prism(ruby 3.4) x = (a rescue (b in c)) # prism(ruby 3.5) ~~~ ~~~ruby def f = a rescue b in c #=> true(parse.y), :f(prism) (def f = (a rescue b)) in c # parse.y def f = (a rescue (b in c)) # prism ~~~ There is no difference between prism and parse.y parsing these codes ~~~ruby a rescue b in c # a rescue (b in c) x = a rescue b # x = (a rescue b) x = b in c # (x = b) in c def f = a rescue b # def f = (a rescue b) def f = b in c # (def f = a) in b ~~~ -- 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/