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

ruby-changes:49847

From: mame <ko1@a...>
Date: Sat, 20 Jan 2018 01:24:13 +0900 (JST)
Subject: [ruby-changes:49847] mame:r61965 (trunk): parse.y: Remove double meaning of backref_assign_error

mame	2018-01-20 01:24:07 +0900 (Sat, 20 Jan 2018)

  New Revision: 61965

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61965

  Log:
    parse.y: Remove double meaning of backref_assign_error

  Modified files:
    trunk/ext/ripper/tools/dsl.rb
    trunk/parse.y
Index: parse.y
===================================================================
--- parse.y	(revision 61964)
+++ parse.y	(revision 61965)
@@ -413,7 +413,6 @@ static NODE *new_const_op_assign(struct https://github.com/ruby/ruby/blob/trunk/parse.y#L413
 static NODE *const_decl(struct parser_params *p, NODE* path, const YYLTYPE *loc);
 
 #define var_field(p, n) (n)
-#define backref_assign_error(p, n, a, loc) (rb_backref_error(p, n), NEW_BEGIN(0, loc))
 
 static NODE *opt_arg_append(NODE*, NODE*);
 static NODE *kwd_append(NODE*, NODE*);
@@ -505,7 +504,6 @@ static VALUE const_decl(struct parser_pa https://github.com/ruby/ruby/blob/trunk/parse.y#L504
 
 static VALUE var_field(struct parser_params *p, VALUE a);
 static VALUE assign_error(struct parser_params *p, VALUE a);
-#define backref_assign_error(p, n, a, loc) assign_error(p, a)
 
 #define block_dup_check(p, n1,n2) ((void)(n1), (void)(n2))
 #define fixpos(n1,n2) ((void)(n1), (void)(n2))
@@ -1256,8 +1254,11 @@ command_asgn	: lhs '=' command_rhs https://github.com/ruby/ruby/blob/trunk/parse.y#L1254
 		    }
 		| backref tOP_ASGN command_rhs
 		    {
-			$1 = var_field(p, $1);
-			$$ = backref_assign_error(p, $1, node_assign(p, $1, $3, &@$), &@$);
+		    /*%%%*/
+			rb_backref_error(p, $1);
+			$$ = NEW_BEGIN(0, &@$);
+		    /*% %*/
+		    /*% ripper[var_field_1,error]: assign_error!(assign!($1, $3)) %*/
 		    }
 		;
 
@@ -1596,8 +1597,11 @@ mlhs_node	: user_variable https://github.com/ruby/ruby/blob/trunk/parse.y#L1597
 		    }
 		| backref
 		    {
-			$1 = var_field(p, $1);
-			$$ = backref_assign_error(p, $1, $1, &@$);
+		    /*%%%*/
+			rb_backref_error(p, $1);
+			$$ = NEW_BEGIN(0, &@$);
+		    /*% %*/
+		    /*% ripper[var_field_1,error]: assign_error!($1) %*/
 		    }
 		;
 
@@ -1647,8 +1651,11 @@ lhs		: user_variable https://github.com/ruby/ruby/blob/trunk/parse.y#L1651
 		    }
 		| backref
 		    {
-			$1 = var_field(p, $1);
-			$$ = backref_assign_error(p, $1, $1, &@$);
+		    /*%%%*/
+			rb_backref_error(p, $1);
+			$$ = NEW_BEGIN(0, &@$);
+		    /*% %*/
+		    /*% ripper[var_field_1,error]: assign_error!($1) %*/
 		    }
 		;
 
@@ -1820,8 +1827,11 @@ arg		: lhs '=' arg_rhs https://github.com/ruby/ruby/blob/trunk/parse.y#L1827
 		    }
 		| backref tOP_ASGN arg_rhs
 		    {
-			$1 = var_field(p, $1);
-			$$ = backref_assign_error(p, $1, new_op_assign(p, $1, $2, $3, &@$), &@$);
+		    /*%%%*/
+			rb_backref_error(p, $1);
+			$$ = NEW_BEGIN(0, &@$);
+		    /*% %*/
+		    /*% ripper[var_field_1,error]: assign_error!(opassign!($1, $2, $3)) %*/
 		    }
 		| arg tDOT2 arg
 		    {
Index: ext/ripper/tools/dsl.rb
===================================================================
--- ext/ripper/tools/dsl.rb	(revision 61964)
+++ ext/ripper/tools/dsl.rb	(revision 61965)
@@ -9,6 +9,7 @@ class DSL https://github.com/ruby/ruby/blob/trunk/ext/ripper/tools/dsl.rb#L9
     @error = options.include?("error")
     @brace = options.include?("brace")
     @final = options.include?("final")
+    @var_field_1 = options.include?("var_field_1")
 
     # create $1 == "$1", $2 == "$2", ...
     re, s = "", ""
@@ -33,6 +34,7 @@ class DSL https://github.com/ruby/ruby/blob/trunk/ext/ripper/tools/dsl.rb#L34
     s = "\t\t\t#{ s } = #@code;"
     s << "ripper_error(p);" if @error
     s = "{#{ s }}" if @brace
+    s = "$1 = var_field(p, $1);" + s if @var_field_1
     s
   end
 

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

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