ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:120144] [Ruby master Bug#20938] Percent String literal delimiter impacts string contents with parse.y
@ 2024-12-09 22:02 eightbitraptor (Matt V-H) via ruby-core
  2024-12-10 16:32 ` [ruby-core:120164] " nobu (Nobuyoshi Nakada) via ruby-core
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: eightbitraptor (Matt V-H) via ruby-core @ 2024-12-09 22:02 UTC (permalink / raw)
  To: ruby-core; +Cc: eightbitraptor (Matt V-H)

Issue #20938 has been reported by eightbitraptor (Matt V-H).

----------------------------------------
Bug #20938: Percent String literal delimiter impacts string contents with parse.y
https://bugs.ruby-lang.org/issues/20938

* Author: eightbitraptor (Matt V-H)
* Status: Open
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
The following code defines 2 programs that declare string literals using `%` and a single byte delimiter. I'd expect these programs to have the same output no matter which delimiter is used.

With Prism, both programs output the same value (the string content: `1_\n`), but using parse.y the output values differ depending on the delimiter.

Are the outputs supposed to be the same or different?

```
program1 = "%\n1_\r\n\n" # => parse.y: 1_, prism: "1_\n"
program2 = "%'1_\r\n'"   # => "1_\n"

p eval(program1)
p eval(program2)
```



-- 
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] 6+ messages in thread

* [ruby-core:120164] [Ruby master Bug#20938] Percent String literal delimiter impacts string contents with parse.y
  2024-12-09 22:02 [ruby-core:120144] [Ruby master Bug#20938] Percent String literal delimiter impacts string contents with parse.y eightbitraptor (Matt V-H) via ruby-core
@ 2024-12-10 16:32 ` nobu (Nobuyoshi Nakada) via ruby-core
  2024-12-10 16:33 ` [ruby-core:120165] " nobu (Nobuyoshi Nakada) via ruby-core
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: nobu (Nobuyoshi Nakada) via ruby-core @ 2024-12-10 16:32 UTC (permalink / raw)
  To: ruby-core; +Cc: nobu (Nobuyoshi Nakada)

Issue #20938 has been updated by nobu (Nobuyoshi Nakada).


Prism seems to cut the string content out, then convert EOLs.

The conversion of EOL is lower layer than parsing, so the result of "program1" should be "1_" without "\n".

----------------------------------------
Bug #20938: Percent String literal delimiter impacts string contents with parse.y
https://bugs.ruby-lang.org/issues/20938#change-110922

* Author: eightbitraptor (Matt V-H)
* Status: Open
* ruby -v: ruby 3.4.0dev (2024-11-28T09:19:02Z master 31a3e87777) +PRISM +GC [arm64-darwin24]
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
The following code defines 2 programs that declare string literals using `%` and a single byte delimiter. I'd expect these programs to have the same output no matter which delimiter is used.

With Prism, both programs output the same value (the string content: `1_\n`), but using parse.y the output values differ depending on the delimiter.

Are the outputs supposed to be the same or different?

```
program1 = "%\n1_\r\n\n" # => parse.y: 1_, prism: "1_\n"
program2 = "%'1_\r\n'"   # => "1_\n"

p eval(program1)
p eval(program2)
```

[[Github Issue]](https://github.com/ruby/prism/pull/3290)



-- 
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] 6+ messages in thread

* [ruby-core:120165] [Ruby master Bug#20938] Percent String literal delimiter impacts string contents with parse.y
  2024-12-09 22:02 [ruby-core:120144] [Ruby master Bug#20938] Percent String literal delimiter impacts string contents with parse.y eightbitraptor (Matt V-H) via ruby-core
  2024-12-10 16:32 ` [ruby-core:120164] " nobu (Nobuyoshi Nakada) via ruby-core
@ 2024-12-10 16:33 ` nobu (Nobuyoshi Nakada) via ruby-core
  2024-12-10 17:02 ` [ruby-core:120166] " tenderlovemaking (Aaron Patterson) via ruby-core
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: nobu (Nobuyoshi Nakada) via ruby-core @ 2024-12-10 16:33 UTC (permalink / raw)
  To: ruby-core; +Cc: nobu (Nobuyoshi Nakada)

Issue #20938 has been updated by nobu (Nobuyoshi Nakada).

Status changed from Open to Assigned
Assignee set to prism

----------------------------------------
Bug #20938: Percent String literal delimiter impacts string contents with parse.y
https://bugs.ruby-lang.org/issues/20938#change-110923

* Author: eightbitraptor (Matt V-H)
* Status: Assigned
* Assignee: prism
* ruby -v: ruby 3.4.0dev (2024-11-28T09:19:02Z master 31a3e87777) +PRISM +GC [arm64-darwin24]
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
The following code defines 2 programs that declare string literals using `%` and a single byte delimiter. I'd expect these programs to have the same output no matter which delimiter is used.

With Prism, both programs output the same value (the string content: `1_\n`), but using parse.y the output values differ depending on the delimiter.

Are the outputs supposed to be the same or different?

```
program1 = "%\n1_\r\n\n" # => parse.y: 1_, prism: "1_\n"
program2 = "%'1_\r\n'"   # => "1_\n"

p eval(program1)
p eval(program2)
```

[[Github Issue]](https://github.com/ruby/prism/pull/3290)



-- 
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] 6+ messages in thread

* [ruby-core:120166] [Ruby master Bug#20938] Percent String literal delimiter impacts string contents with parse.y
  2024-12-09 22:02 [ruby-core:120144] [Ruby master Bug#20938] Percent String literal delimiter impacts string contents with parse.y eightbitraptor (Matt V-H) via ruby-core
  2024-12-10 16:32 ` [ruby-core:120164] " nobu (Nobuyoshi Nakada) via ruby-core
  2024-12-10 16:33 ` [ruby-core:120165] " nobu (Nobuyoshi Nakada) via ruby-core
@ 2024-12-10 17:02 ` tenderlovemaking (Aaron Patterson) via ruby-core
  2024-12-10 17:07 ` [ruby-core:120167] " tenderlovemaking (Aaron Patterson) via ruby-core
  2024-12-10 17:24 ` [ruby-core:120168] " nobu (Nobuyoshi Nakada) via ruby-core
  4 siblings, 0 replies; 6+ messages in thread
From: tenderlovemaking (Aaron Patterson) via ruby-core @ 2024-12-10 17:02 UTC (permalink / raw)
  To: ruby-core; +Cc: tenderlovemaking (Aaron Patterson)

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


nobu (Nobuyoshi Nakada) wrote in #note-3:
> Prism seems to cut the string content out, then convert EOLs.
> 
> The conversion of EOL is lower layer than parsing, so the result of "program1" should be "1_" without "\n".

Sorry, I don't understand. Can you explain more?  Why does EOL conversion impact `program1` but not `program2`?

----------------------------------------
Bug #20938: Percent String literal delimiter impacts string contents with parse.y
https://bugs.ruby-lang.org/issues/20938#change-110924

* Author: eightbitraptor (Matt V-H)
* Status: Assigned
* Assignee: prism
* ruby -v: ruby 3.4.0dev (2024-11-28T09:19:02Z master 31a3e87777) +PRISM +GC [arm64-darwin24]
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
The following code defines 2 programs that declare string literals using `%` and a single byte delimiter. I'd expect these programs to have the same output no matter which delimiter is used.

With Prism, both programs output the same value (the string content: `1_\n`), but using parse.y the output values differ depending on the delimiter.

Are the outputs supposed to be the same or different?

```
program1 = "%\n1_\r\n\n" # => parse.y: 1_, prism: "1_\n"
program2 = "%'1_\r\n'"   # => "1_\n"

p eval(program1)
p eval(program2)
```

[[Github Issue]](https://github.com/ruby/prism/pull/3290)



-- 
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] 6+ messages in thread

* [ruby-core:120167] [Ruby master Bug#20938] Percent String literal delimiter impacts string contents with parse.y
  2024-12-09 22:02 [ruby-core:120144] [Ruby master Bug#20938] Percent String literal delimiter impacts string contents with parse.y eightbitraptor (Matt V-H) via ruby-core
                   ` (2 preceding siblings ...)
  2024-12-10 17:02 ` [ruby-core:120166] " tenderlovemaking (Aaron Patterson) via ruby-core
@ 2024-12-10 17:07 ` tenderlovemaking (Aaron Patterson) via ruby-core
  2024-12-10 17:24 ` [ruby-core:120168] " nobu (Nobuyoshi Nakada) via ruby-core
  4 siblings, 0 replies; 6+ messages in thread
From: tenderlovemaking (Aaron Patterson) via ruby-core @ 2024-12-10 17:07 UTC (permalink / raw)
  To: ruby-core; +Cc: tenderlovemaking (Aaron Patterson)

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


tenderlovemaking (Aaron Patterson) wrote in #note-5:
> nobu (Nobuyoshi Nakada) wrote in #note-3:
> > Prism seems to cut the string content out, then convert EOLs.
> > 
> > The conversion of EOL is lower layer than parsing, so the result of "program1" should be "1_" without "\n".
> 
> Sorry, I don't understand. Can you explain more?  Why does EOL conversion impact `program1` but not `program2`?

I think I understand, but I will try to explain.  In `program1` EOL conversion first changes it to `"%\n1_\n\n"`, so the second `\n` becomes the delimiter?

Is that correct?

Thanks

----------------------------------------
Bug #20938: Percent String literal delimiter impacts string contents with parse.y
https://bugs.ruby-lang.org/issues/20938#change-110925

* Author: eightbitraptor (Matt V-H)
* Status: Assigned
* Assignee: prism
* ruby -v: ruby 3.4.0dev (2024-11-28T09:19:02Z master 31a3e87777) +PRISM +GC [arm64-darwin24]
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
The following code defines 2 programs that declare string literals using `%` and a single byte delimiter. I'd expect these programs to have the same output no matter which delimiter is used.

With Prism, both programs output the same value (the string content: `1_\n`), but using parse.y the output values differ depending on the delimiter.

Are the outputs supposed to be the same or different?

```
program1 = "%\n1_\r\n\n" # => parse.y: 1_, prism: "1_\n"
program2 = "%'1_\r\n'"   # => "1_\n"

p eval(program1)
p eval(program2)
```

[[Github Issue]](https://github.com/ruby/prism/pull/3290)



-- 
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] 6+ messages in thread

* [ruby-core:120168] [Ruby master Bug#20938] Percent String literal delimiter impacts string contents with parse.y
  2024-12-09 22:02 [ruby-core:120144] [Ruby master Bug#20938] Percent String literal delimiter impacts string contents with parse.y eightbitraptor (Matt V-H) via ruby-core
                   ` (3 preceding siblings ...)
  2024-12-10 17:07 ` [ruby-core:120167] " tenderlovemaking (Aaron Patterson) via ruby-core
@ 2024-12-10 17:24 ` nobu (Nobuyoshi Nakada) via ruby-core
  4 siblings, 0 replies; 6+ messages in thread
From: nobu (Nobuyoshi Nakada) via ruby-core @ 2024-12-10 17:24 UTC (permalink / raw)
  To: ruby-core; +Cc: nobu (Nobuyoshi Nakada)

Issue #20938 has been updated by nobu (Nobuyoshi Nakada).


tenderlovemaking (Aaron Patterson) wrote in #note-6:
> I think I understand, but I will try to explain.  In `program1` EOL conversion first changes it to `"%\n1_\n\n"`, so the second `\n` becomes the delimiter?
> 
> Is that correct?

Correct!

----------------------------------------
Bug #20938: Percent String literal delimiter impacts string contents with parse.y
https://bugs.ruby-lang.org/issues/20938#change-110926

* Author: eightbitraptor (Matt V-H)
* Status: Assigned
* Assignee: prism
* ruby -v: ruby 3.4.0dev (2024-11-28T09:19:02Z master 31a3e87777) +PRISM +GC [arm64-darwin24]
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
The following code defines 2 programs that declare string literals using `%` and a single byte delimiter. I'd expect these programs to have the same output no matter which delimiter is used.

With Prism, both programs output the same value (the string content: `1_\n`), but using parse.y the output values differ depending on the delimiter.

Are the outputs supposed to be the same or different?

```
program1 = "%\n1_\r\n\n" # => parse.y: 1_, prism: "1_\n"
program2 = "%'1_\r\n'"   # => "1_\n"

p eval(program1)
p eval(program2)
```

[[Github Issue]](https://github.com/ruby/prism/pull/3290)



-- 
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] 6+ messages in thread

end of thread, other threads:[~2024-12-10 17:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-09 22:02 [ruby-core:120144] [Ruby master Bug#20938] Percent String literal delimiter impacts string contents with parse.y eightbitraptor (Matt V-H) via ruby-core
2024-12-10 16:32 ` [ruby-core:120164] " nobu (Nobuyoshi Nakada) via ruby-core
2024-12-10 16:33 ` [ruby-core:120165] " nobu (Nobuyoshi Nakada) via ruby-core
2024-12-10 17:02 ` [ruby-core:120166] " tenderlovemaking (Aaron Patterson) via ruby-core
2024-12-10 17:07 ` [ruby-core:120167] " tenderlovemaking (Aaron Patterson) via ruby-core
2024-12-10 17:24 ` [ruby-core:120168] " nobu (Nobuyoshi Nakada) 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).