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

parse.y: relax `&' warning

* parse.y (parser_yylex): disable "`&' interpreted as argument
  prefix" warning when just followed by a symbol literal.
  [ruby-core:79926] [Misc #13283]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57955 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2017-03-13 08:38:12 +00:00
parent 65285fbdb8
commit 8179835101

View file

@ -8147,7 +8147,12 @@ parser_yylex(struct parser_params *parser)
} }
pushback(c); pushback(c);
if (IS_SPCARG(c)) { if (IS_SPCARG(c)) {
rb_warning0("`&' interpreted as argument prefix"); if ((c != ':') ||
(c = peekc_n(1)) == -1 ||
!(c == '\'' || c == '"' ||
is_identchar((lex_p+1), lex_pend, current_enc))) {
rb_warning0("`&' interpreted as argument prefix");
}
c = tAMPER; c = tAMPER;
} }
else if (IS_BEG()) { else if (IS_BEG()) {