1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

parse.y: Remove unneeded var_field_1 trick

I thought this trick was needed because the result of var_field was
passed to different arguments, as follows:

```
$1 = var_field(p, $1);
$$ = backref_assign_error(p, $1, $1, &@$);
```

Currently the DSL supports that one result is passed to one argument.

However, after the refactoring, I found that `backref_assign_error`
uses only one `$1`.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
mame 2018-01-20 06:11:21 +00:00
parent a8a4bdb72e
commit 9e95513781
2 changed files with 10 additions and 12 deletions

View file

@ -9,7 +9,6 @@ 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 = "", ""
@ -37,7 +36,6 @@ class DSL
s = "#{ s } = #@code;"
s << "ripper_error(p);" if @error
s = "{#{ s }}" if @brace
s = "$1 = var_field(p, $1);" + s if @var_field_1
"\t\t\t#{s}"
end

20
parse.y
View file

@ -1260,7 +1260,7 @@ command_asgn : lhs '=' command_rhs
rb_backref_error(p, $1);
$$ = NEW_BEGIN(0, &@$);
/*% %*/
/*% ripper[var_field_1,error]: assign_error!(assign!($1, $3)) %*/
/*% ripper[error]: assign_error!(assign!(var_field(p, $1), $3)) %*/
}
;
@ -1559,14 +1559,14 @@ mlhs_node : user_variable
/*%%%*/
$$ = assignable(p, $1, 0, &@$);
/*% %*/
/*% ripper[var_field_1]: assignable(p, $1) %*/
/*% ripper: assignable(p, var_field(p, $1)) %*/
}
| keyword_variable
{
/*%%%*/
$$ = assignable(p, $1, 0, &@$);
/*% %*/
/*% ripper[var_field_1]: assignable(p, $1) %*/
/*% ripper: assignable(p, var_field(p, $1)) %*/
}
| primary_value '[' opt_call_args rbracket
{
@ -1610,7 +1610,7 @@ mlhs_node : user_variable
rb_backref_error(p, $1);
$$ = NEW_BEGIN(0, &@$);
/*% %*/
/*% ripper[var_field_1,error]: assign_error!($1) %*/
/*% ripper[error]: assign_error!(var_field(p, $1)) %*/
}
;
@ -1619,14 +1619,14 @@ lhs : user_variable
/*%%%*/
$$ = assignable(p, $1, 0, &@$);
/*% %*/
/*% ripper[var_field_1]: assignable(p, $1) %*/
/*% ripper: assignable(p, var_field(p, $1)) %*/
}
| keyword_variable
{
/*%%%*/
$$ = assignable(p, $1, 0, &@$);
/*% %*/
/*% ripper[var_field_1]: assignable(p, $1) %*/
/*% ripper: assignable(p, var_field(p, $1)) %*/
}
| primary_value '[' opt_call_args rbracket
{
@ -1670,7 +1670,7 @@ lhs : user_variable
rb_backref_error(p, $1);
$$ = NEW_BEGIN(0, &@$);
/*% %*/
/*% ripper[var_field_1,error]: assign_error!($1) %*/
/*% ripper[error]: assign_error!(var_field(p, $1)) %*/
}
;
@ -1849,7 +1849,7 @@ arg : lhs '=' arg_rhs
rb_backref_error(p, $1);
$$ = NEW_BEGIN(0, &@$);
/*% %*/
/*% ripper[var_field_1,error]: assign_error!(opassign!($1, $2, $3)) %*/
/*% ripper[error]: assign_error!(opassign!(var_field(p, $1), $2, $3)) %*/
}
| arg tDOT2 arg
{
@ -3675,14 +3675,14 @@ var_lhs : user_variable
/*%%%*/
$$ = assignable(p, $1, 0, &@$);
/*% %*/
/*% ripper[var_field_1]: assignable(p, $1) %*/
/*% ripper: assignable(p, var_field(p, $1)) %*/
}
| keyword_variable
{
/*%%%*/
$$ = assignable(p, $1, 0, &@$);
/*% %*/
/*% ripper[var_field_1]: assignable(p, $1) %*/
/*% ripper: assignable(p, var_field(p, $1)) %*/
}
;