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

ruby-changes:8229

From: akr <ko1@a...>
Date: Sat, 11 Oct 2008 18:56:14 +0900 (JST)
Subject: [ruby-changes:8229] Ruby:r19757 (trunk): rdoc update.

akr	2008-10-11 18:56:07 +0900 (Sat, 11 Oct 2008)

  New Revision: 19757

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=19757

  Log:
    rdoc update.

  Modified files:
    trunk/re.c

Index: re.c
===================================================================
--- re.c	(revision 19756)
+++ re.c	(revision 19757)
@@ -2569,11 +2569,13 @@
  *     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 @@
  *     /(?<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

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

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