[前][次][番号順一覧][スレッド一覧]

ruby-changes:72264

From: Jeremy <ko1@a...>
Date: Tue, 21 Jun 2022 07:56:59 +0900 (JST)
Subject: [ruby-changes:72264] 596f4b0d3a (master): Document that Regexp#source does not retain lexer escapes

https://git.ruby-lang.org/ruby.git/commit/?id=596f4b0d3a

From 596f4b0d3ab8bc2559a52396d3a29ce62e6a3694 Mon Sep 17 00:00:00 2001
From: Jeremy Evans <code@j...>
Date: Mon, 20 Jun 2022 15:17:23 -0700
Subject: Document that Regexp#source does not retain lexer escapes

Related to [Feature #18838]
---
 re.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/re.c b/re.c
index 3e059b6287..002be7ce9e 100644
--- a/re.c
+++ b/re.c
@@ -487,10 +487,14 @@ rb_reg_desc(const char *s, long len, VALUE re) https://github.com/ruby/ruby/blob/trunk/re.c#L487
  *
  *    /ab+c/ix.source # => "ab+c"
  *
- *  Note that escape sequences are retained as is:
+ *  Regexp escape sequences are retained:
  *
  *    /\x20\+/.source  # => "\\x20\\+"
  *
+ *  Lexer escape characters are not retained:
+ *
+ *    /\//.source  # => "/"
+ *
  */
 
 static VALUE
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]