From 448d1d147d3a0b636323d0c8d80f53a399d445af Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 28 Nov 2015 10:33:58 +0000 Subject: [PATCH] parse.y: last content of heredoc * parse.y (parser_here_document): store dispatched result of on_tstring_content at the last fragment of a here document. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52777 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ parse.y | 4 ++++ test/ripper/test_sexp.rb | 5 +++++ 3 files changed, 14 insertions(+) diff --git a/ChangeLog b/ChangeLog index 515b6974f5..024bc0c529 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sat Nov 28 19:33:55 2015 Nobuyoshi Nakada + + * parse.y (parser_here_document): store dispatched result of + on_tstring_content at the last fragment of a here document. + Fri Nov 27 19:19:44 2015 NARUSE, Yui * lib/net/http.rb (connect): detect closed connection and reconnect diff --git a/parse.y b/parse.y index 3a51893d30..86824f9199 100644 --- a/parse.y +++ b/parse.y @@ -6745,6 +6745,10 @@ parser_here_document(struct parser_params *parser, NODE *here) str = STR_NEW3(tok(), toklen(), enc, func); } dispatch_heredoc_end(); +#ifdef RIPPER + str = ripper_new_yylval(ripper_token2eventid(tSTRING_CONTENT), + yylval.val, str); +#endif heredoc_restore(lex_strterm); lex_strterm = NEW_STRTERM(-1, 0, 0); set_yylval_str(str); diff --git a/test/ripper/test_sexp.rb b/test/ripper/test_sexp.rb index 2c5bcdacde..8fc17fdd4a 100644 --- a/test/ripper/test_sexp.rb +++ b/test/ripper/test_sexp.rb @@ -33,6 +33,11 @@ class TestRipper::Sexp < Test::Unit::TestCase assert_equal '(?a(b|\g))', search_sexp(:@tstring_content, search_sexp(:regexp_literal, sexp))[1] end + def test_heredoc_content + sexp = Ripper.sexp("<