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

parse.y: token name of tSTRING_DEND

* parse.y (rb_yytnamerr): show single-quoted single char as-is, to
  show a quoted closing brace as tSTRING_DEND.  e.g.:

      $ ./ruby -e '"#{true'
      -e:1: syntax error, unexpected end-of-input, expecting '}'

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66911 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2019-01-23 09:39:45 +00:00
parent 71342a46ac
commit c56f61161a

View file

@ -924,7 +924,8 @@ static void token_info_warn(struct parser_params *p, const char *token, token_in
%token tSYMBOLS_BEG "symbol list"
%token tQSYMBOLS_BEG "verbatim symbol list"
%token tSTRING_END "terminator"
%token tSTRING_DBEG tSTRING_DEND tSTRING_DVAR tLAMBEG tLABEL_END
%token tSTRING_DEND "'}'"
%token tSTRING_DBEG tSTRING_DVAR tLAMBEG tLABEL_END
/*
* precedence table
@ -11220,6 +11221,12 @@ rb_yytnamerr(char *yyres, const char *yystr)
bquote = 0;
break;
}
if (yyp[1] && yyp[1] != '\'' && yyp[2] == '\'') {
if (yyres) memcpy(yyres + yyn, yyp, 3);
yyn += 3;
yyp += 2;
break;
}
goto do_not_strip_quotes;
case ',':