summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-19 16:24:07 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-19 16:24:07 +0000
commit193b158b2320c8dc4ef6368965300d84c152e125 (patch)
tree7073ef1496e43646fe04f3d3db63f831f4f4859c
parenta64054cd343d53f84efb88794d6cb12a8b676a69 (diff)
parse.y: Remove double meaning of backref_assign_error
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61965 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ext/ripper/tools/dsl.rb2
-rw-r--r--parse.y30
2 files changed, 22 insertions, 10 deletions
diff --git a/ext/ripper/tools/dsl.rb b/ext/ripper/tools/dsl.rb
index 6b4742f17c..524c0e8f8d 100644
--- a/ext/ripper/tools/dsl.rb
+++ b/ext/ripper/tools/dsl.rb
@@ -9,6 +9,7 @@ class DSL
@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
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
diff --git a/parse.y b/parse.y
index 587f2a63fc..97be5a6a2a 100644
--- a/parse.y
+++ b/parse.y
@@ -413,7 +413,6 @@ static NODE *new_const_op_assign(struct parser_params *p, NODE *lhs, ID op, NODE
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_params *p, VALUE path, const YYLTYPE *loc)
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
}
| 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
}
| 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
}
| 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
}
| 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
{