ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:120819] [Ruby master Bug#21097] `x = a rescue b in c` and `def f = a rescue b in c` parsed differently between parse.y and prism
@ 2025-01-29  8:51 tompng (tomoya ishida) via ruby-core
  2025-01-29 10:06 ` [ruby-core:120821] " tompng (tomoya ishida) via ruby-core
  2025-01-29 20:05 ` [ruby-core:120835] " tenderlovemaking (Aaron Patterson) via ruby-core
  0 siblings, 2 replies; 3+ messages in thread
From: tompng (tomoya ishida) via ruby-core @ 2025-01-29  8:51 UTC (permalink / raw)
  To: ruby-core; +Cc: tompng (tomoya ishida)

Issue #21097 has been reported by tompng (tomoya ishida).

----------------------------------------
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

* Author: tompng (tomoya ishida)
* Status: Open
* ruby -v: ruby 3.5.0dev (2025-01-27T08:19:32Z master c3c7300b89) +YJIT +MN +PRISM [arm64-darwin22]
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN
----------------------------------------
~~~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/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ruby-core:120821] [Ruby master Bug#21097] `x = a rescue b in c` and `def f = a rescue b in c` parsed differently between parse.y and prism
  2025-01-29  8:51 [ruby-core:120819] [Ruby master Bug#21097] `x = a rescue b in c` and `def f = a rescue b in c` parsed differently between parse.y and prism tompng (tomoya ishida) via ruby-core
@ 2025-01-29 10:06 ` tompng (tomoya ishida) via ruby-core
  2025-01-29 20:05 ` [ruby-core:120835] " tenderlovemaking (Aaron Patterson) via ruby-core
  1 sibling, 0 replies; 3+ messages in thread
From: tompng (tomoya ishida) via ruby-core @ 2025-01-29 10:06 UTC (permalink / raw)
  To: ruby-core; +Cc: tompng (tomoya ishida)

Issue #21097 has been updated by tompng (tomoya ishida).


`not` `in` and `not` `rescue` has the same problem
~~~
$ ruby --parser=parse.y -e "def f = not 1 in 2; p f"
false
$ ruby --parser=prism   -e "def f = not 1 in 2; p f"
true
$ ruby --parser=parse.y -e "def f = not a rescue true; p f"
false
$ ruby --parser=prism   -e "def f = not a rescue true; p f"
true
~~~

----------------------------------------
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-111688

* Author: tompng (tomoya ishida)
* Status: Open
* ruby -v: ruby 3.5.0dev (2025-01-27T08:19:32Z master c3c7300b89) +YJIT +MN +PRISM [arm64-darwin22]
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN
----------------------------------------
~~~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/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ruby-core:120835] [Ruby master Bug#21097] `x = a rescue b in c` and `def f = a rescue b in c` parsed differently between parse.y and prism
  2025-01-29  8:51 [ruby-core:120819] [Ruby master Bug#21097] `x = a rescue b in c` and `def f = a rescue b in c` parsed differently between parse.y and prism tompng (tomoya ishida) via ruby-core
  2025-01-29 10:06 ` [ruby-core:120821] " tompng (tomoya ishida) via ruby-core
@ 2025-01-29 20:05 ` tenderlovemaking (Aaron Patterson) via ruby-core
  1 sibling, 0 replies; 3+ messages in thread
From: tenderlovemaking (Aaron Patterson) via ruby-core @ 2025-01-29 20:05 UTC (permalink / raw)
  To: ruby-core; +Cc: tenderlovemaking (Aaron Patterson)

Issue #21097 has been updated by tenderlovemaking (Aaron Patterson).

Assignee set to prism

----------------------------------------
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-111699

* Author: tompng (tomoya ishida)
* Status: Open
* Assignee: prism
* ruby -v: ruby 3.5.0dev (2025-01-27T08:19:32Z master c3c7300b89) +YJIT +MN +PRISM [arm64-darwin22]
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN
----------------------------------------
~~~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/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-01-29 20:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-29  8:51 [ruby-core:120819] [Ruby master Bug#21097] `x = a rescue b in c` and `def f = a rescue b in c` parsed differently between parse.y and prism tompng (tomoya ishida) via ruby-core
2025-01-29 10:06 ` [ruby-core:120821] " tompng (tomoya ishida) via ruby-core
2025-01-29 20:05 ` [ruby-core:120835] " tenderlovemaking (Aaron Patterson) via ruby-core

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).