summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-05-08 15:54:32 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-05-08 15:54:32 +0000
commit2acb400eb1fdda72608a0d9fa59382666af84026 (patch)
tree3ed29863ffb47062423ccab22d9714b3b65b30d4
parent65b55c26a15d1b7bf3387e7f31a44f0a669431d0 (diff)
* parse.y (arg): operator assignment "a += b rescue c" should be
parsed as "a += (b rescue c)" just like normal assignment. [ruby-talk:301000] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16336 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog6
-rw-r--r--lib/csv.rb2
-rw-r--r--parse.y37
-rw-r--r--version.h6
4 files changed, 45 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 944b48cb55..8cebaf799d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Fri May 9 00:03:50 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (arg): operator assignment "a += b rescue c" should be
+ parsed as "a += (b rescue c)" just like normal assignment.
+ [ruby-talk:301000]
+
Thu May 8 18:14:00 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
* bignum.c (rb_big_and): bit-wise operation should not take float
diff --git a/lib/csv.rb b/lib/csv.rb
index f488141eb2..f846205637 100644
--- a/lib/csv.rb
+++ b/lib/csv.rb
@@ -1524,7 +1524,7 @@ class CSV
#
loop do
# add another read to the line
- line += @io.gets(@row_sep) rescue return nil
+ (line += @io.gets(@row_sep)) rescue return nil
# copy the line so we can chop it up in parsing
parse = line.dup
parse.sub!(@parsers[:line_end], "")
diff --git a/parse.y b/parse.y
index bda57f428f..f98d0c3700 100644
--- a/parse.y
+++ b/parse.y
@@ -1792,9 +1792,11 @@ arg : lhs '=' arg
| lhs '=' arg modifier_rescue arg
{
/*%%%*/
- $$ = node_assign($1, NEW_RESCUE($3, NEW_RESBODY(0,$5,0), 0));
+ value_expr($3);
+ $3 = NEW_RESCUE($3, NEW_RESBODY(0,$5,0), 0);
+ $$ = node_assign($1, $3);
/*%
- $$ = dispatch2(assign, $1, dispatch2(rescue_mod,$3,$5));
+ $$ = dispatch2(assign, $1, dispatch2(rescue_mod, $3, $5));
%*/
}
| var_lhs tOP_ASGN arg
@@ -1826,6 +1828,37 @@ arg : lhs '=' arg
$$ = dispatch3(opassign, $1, $2, $3);
%*/
}
+ | var_lhs tOP_ASGN arg modifier_rescue arg
+ {
+ /*%%%*/
+ value_expr($3);
+ $3 = NEW_RESCUE($3, NEW_RESBODY(0,$5,0), 0);
+ if ($1) {
+ ID vid = $1->nd_vid;
+ if ($2 == tOROP) {
+ $1->nd_value = $3;
+ $$ = NEW_OP_ASGN_OR(gettable(vid), $1);
+ if (is_asgn_or_id(vid)) {
+ $$->nd_aid = vid;
+ }
+ }
+ else if ($2 == tANDOP) {
+ $1->nd_value = $3;
+ $$ = NEW_OP_ASGN_AND(gettable(vid), $1);
+ }
+ else {
+ $$ = $1;
+ $$->nd_value = NEW_CALL(gettable(vid), $2, NEW_LIST($3));
+ }
+ }
+ else {
+ $$ = NEW_BEGIN(0);
+ }
+ /*%
+ $3 = dispatch2(rescue_mod, $3, $5);
+ $$ = dispatch3(opassign, $1, $2, $3);
+ %*/
+ }
| primary_value '[' opt_call_args rbracket tOP_ASGN arg
{
/*%%%*/
diff --git a/version.h b/version.h
index 5a250d845f..b36ed6cc4f 100644
--- a/version.h
+++ b/version.h
@@ -1,7 +1,7 @@
#define RUBY_VERSION "1.9.0"
-#define RUBY_RELEASE_DATE "2008-05-08"
+#define RUBY_RELEASE_DATE "2008-05-09"
#define RUBY_VERSION_CODE 190
-#define RUBY_RELEASE_CODE 20080508
+#define RUBY_RELEASE_CODE 20080509
#define RUBY_PATCHLEVEL 0
#define RUBY_VERSION_MAJOR 1
@@ -9,7 +9,7 @@
#define RUBY_VERSION_TEENY 0
#define RUBY_RELEASE_YEAR 2008
#define RUBY_RELEASE_MONTH 5
-#define RUBY_RELEASE_DAY 8
+#define RUBY_RELEASE_DAY 9
#ifdef RUBY_EXTERN
RUBY_EXTERN const char ruby_version[];