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

parse.y: heredoc token

* parse.y (parser_heredoc_identifier): gather branches by quote
  char.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56020 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2016-08-26 23:26:03 +00:00
parent f40be5e64a
commit 0783f55cf8

View file

@ -6401,6 +6401,7 @@ static int
parser_heredoc_identifier(struct parser_params *parser) parser_heredoc_identifier(struct parser_params *parser)
{ {
int c = nextc(), term, func = 0; int c = nextc(), term, func = 0;
int token = tSTRING_BEG;
long len; long len;
if (c == '-') { if (c == '-') {
@ -6419,7 +6420,9 @@ parser_heredoc_identifier(struct parser_params *parser)
case '"': case '"':
func |= str_dquote; goto quoted; func |= str_dquote; goto quoted;
case '`': case '`':
func |= str_xquote; token = tXSTRING_BEG;
func |= str_xquote; goto quoted;
quoted: quoted:
newtok(); newtok();
tokadd(func); tokadd(func);
@ -6442,7 +6445,6 @@ parser_heredoc_identifier(struct parser_params *parser)
return 0; return 0;
} }
newtok(); newtok();
term = '"';
tokadd(func |= str_dquote); tokadd(func |= str_dquote);
do { do {
if (tokadd_mbchar(c) == -1) return 0; if (tokadd_mbchar(c) == -1) return 0;
@ -6461,7 +6463,7 @@ parser_heredoc_identifier(struct parser_params *parser)
lex_lastline); /* nd_orig */ lex_lastline); /* nd_orig */
nd_set_line(lex_strterm, ruby_sourceline); nd_set_line(lex_strterm, ruby_sourceline);
ripper_flush(parser); ripper_flush(parser);
return term == '`' ? tXSTRING_BEG : tSTRING_BEG; return token;
} }
static void static void