summaryrefslogtreecommitdiff
path: root/re.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-10-11 09:56:07 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-10-11 09:56:07 +0000
commitde7845773a4f555393bd7ea2b38e11a99bffbeb9 (patch)
treeb6c98b64818de15faa1f36675790bd0be9913313 /re.c
parent3c276224fc8c508a718c912bd0f6297d2435bc7e (diff)
rdoc update.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19757 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 're.c')
-rw-r--r--re.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/re.c b/re.c
index 9b9cb87d02..fa00e8ceab 100644
--- a/re.c
+++ b/re.c
@@ -2569,11 +2569,13 @@ reg_match_pos(VALUE re, VALUE *strp, long pos)
* p rhs #=> nil
*
* This assignment is implemented in the Ruby parser.
- * So a regexp literal is required for the assignment.
+ * The parser detects 'regexp-literal =~ expression' for the assignment.
+ * The regexp must be a literal without interpolation and placed at left hand side.
+ *
* The assignment is not occur if the regexp is not a literal.
*
* re = /(?<lhs>\w+)\s*=\s*(?<rhs>\w+)/
- * re =~ " x = "
+ * re =~ " x = y "
* p lhs # undefined local variable
* p rhs # undefined local variable
*
@@ -2584,6 +2586,11 @@ reg_match_pos(VALUE re, VALUE *strp, long pos)
* /(?<lhs>\w+)\s*=\s*#{rhs_pat}/ =~ "x = y"
* p lhs # undefined local variable
*
+ * The assignment is not occur if the regexp is placed at right hand side.
+ *
+ * " x = y " =~ /(?<lhs>\w+)\s*=\s*(?<rhs>\w+)/
+ * p lhs, rhs # undefined local variable
+ *
*/
VALUE