From 36208390a90c2e1e0f4a58f2362f6183c7892836 Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 26 Aug 2016 23:26:03 +0000 Subject: 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 --- parse.y | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'parse.y') diff --git a/parse.y b/parse.y index 2a22c082cd..d7d15456d2 100644 --- a/parse.y +++ b/parse.y @@ -6401,6 +6401,7 @@ static int parser_heredoc_identifier(struct parser_params *parser) { int c = nextc(), term, func = 0; + int token = tSTRING_BEG; long len; if (c == '-') { @@ -6419,7 +6420,9 @@ parser_heredoc_identifier(struct parser_params *parser) case '"': func |= str_dquote; goto quoted; case '`': - func |= str_xquote; + token = tXSTRING_BEG; + func |= str_xquote; goto quoted; + quoted: newtok(); tokadd(func); @@ -6442,7 +6445,6 @@ parser_heredoc_identifier(struct parser_params *parser) return 0; } newtok(); - term = '"'; tokadd(func |= str_dquote); do { if (tokadd_mbchar(c) == -1) return 0; @@ -6461,7 +6463,7 @@ parser_heredoc_identifier(struct parser_params *parser) lex_lastline); /* nd_orig */ nd_set_line(lex_strterm, ruby_sourceline); ripper_flush(parser); - return term == '`' ? tXSTRING_BEG : tSTRING_BEG; + return token; } static void -- cgit v1.2.3