[#109095] [Ruby master Misc#18888] Migrate ruby-lang.org mail services to Google Domains and Google Workspace — "shugo (Shugo Maeda)" <noreply@...>
Issue #18888 has been reported by shugo (Shugo Maeda).
16 messages
2022/06/30
[ruby-core:109032] [Ruby master Feature#18838] Avoid swallowing regexp escapes in the lexer
From:
"andrykonchin (Andrew Konchin)" <noreply@...>
Date:
2022-06-21 09:45:57 UTC
List:
ruby-core #109032
Issue #18838 has been updated by andrykonchin (Andrew Konchin).
Thank you for clarification.
----------------------------------------
Feature #18838: Avoid swallowing regexp escapes in the lexer
https://bugs.ruby-lang.org/issues/18838#change-98148
* Author: andrykonchin (Andrew Konchin)
* Status: Closed
* Priority: Normal
----------------------------------------
According to `Regexp#source` documentation:
```
Returns the original string of the pattern.
/ab+c/ix.source #=> "ab+c"
Note that escape sequences are retained as is.
/\x20\+/.source #=> "\\x20\\+"
```
It works well but backslash (/) is processed in different way by different regexp literal forms.
Examples:
```ruby
/\//.source # => "/"
%r/\//.source # => "/"
%r{\/}.source # => "\\/"
```
Expected result - in all the cases result is the same.
Moreover as documentation states - `escape sequences are retained as is`. So I would say that only `%r{}` works properly.
The issue was reported here https://github.com/oracle/truffleruby/issues/2569.
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>