summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-01-23 09:39:45 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-01-23 09:39:45 +0000
commitc56f61161a7baefb3d1ed3f815e5dc544b3accd6 (patch)
tree9945d5c7835c439c86f0d4d89920515af3a6e9be
parent71342a46ac4244adb27a514f412aecd012e9ed40 (diff)
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
-rw-r--r--parse.y9
1 files changed, 8 insertions, 1 deletions
diff --git a/parse.y b/parse.y
index 6ee962ca2c..1f7cf2f53f 100644
--- a/parse.y
+++ b/parse.y
@@ -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 ',':