diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | parse.y | 4 | ||||
-rw-r--r-- | test/ripper/test_sexp.rb | 5 |
3 files changed, 14 insertions, 0 deletions
@@ -1,3 +1,8 @@ +Sat Nov 28 19:33:55 2015 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * 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 <naruse@ruby-lang.org> * lib/net/http.rb (connect): detect closed connection and reconnect @@ -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 '(?<n>a(b|\g<n>))', search_sexp(:@tstring_content, search_sexp(:regexp_literal, sexp))[1] end + def test_heredoc_content + sexp = Ripper.sexp("<<E\nfoo\nE") + assert_equal "foo\n", search_sexp(:@tstring_content, sexp)[1] + end + def search_sexp(sym, sexp) return sexp if !sexp or sexp[0] == sym sexp.find do |e| |