ruby-changes:20336
From: yugui <ko1@a...>
Date: Sun, 3 Jul 2011 21:24:48 +0900 (JST)
Subject: [ruby-changes:20336] yugui:r32384 (ruby_1_9_2): merges r32067 from trunk into ruby_1_9_2.
yugui 2011-07-03 21:24:13 +0900 (Sun, 03 Jul 2011) New Revision: 32384 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=32384 Log: merges r32067 from trunk into ruby_1_9_2. -- * parse.y (parser_parse_string): flush delayed token. based on a patch by Masaya Tarui in [ruby-dev:43762]. Bug #4544 * parse.y (yylex): revert r24557. delayed token at the end of string should be flushed already by the above change. Modified files: branches/ruby_1_9_2/ChangeLog branches/ruby_1_9_2/ext/socket/unixsocket.c branches/ruby_1_9_2/parse.y branches/ruby_1_9_2/test/ripper/test_scanner_events.rb branches/ruby_1_9_2/version.h Index: ruby_1_9_2/ChangeLog =================================================================== --- ruby_1_9_2/ChangeLog (revision 32383) +++ ruby_1_9_2/ChangeLog (revision 32384) @@ -1,3 +1,11 @@ +Mon Jun 13 23:38:23 2011 Nobuyoshi Nakada <nobu@r...> + + * parse.y (parser_parse_string): flush delayed token. based on a + patch by Masaya Tarui in [ruby-dev:43762]. Bug #4544 + + * parse.y (yylex): revert r24557. delayed token at the end of + string should be flushed already by the above change. + Mon Jun 13 23:05:01 2011 Tanaka Akira <akr@f...> * ext/socket/unixsocket.c (unix_send_io): race condition fixed. Index: ruby_1_9_2/parse.y =================================================================== --- ruby_1_9_2/parse.y (revision 32383) +++ ruby_1_9_2/parse.y (revision 32384) @@ -5973,6 +5973,18 @@ tokfix(); set_yylval_str(STR_NEW3(tok(), toklen(), enc, func)); + +#ifdef RIPPER + if (!NIL_P(parser->delayed)){ + ptrdiff_t len = lex_p - parser->tokp; + if (len > 0) { + rb_enc_str_buf_cat(parser->delayed, parser->tokp, len, enc); + } + ripper_dispatch_delayed_token(parser, tSTRING_CONTENT); + parser->tokp = lex_p; + } +#endif + return tSTRING_CONTENT; } @@ -7821,6 +7833,7 @@ #ifdef RIPPER if (!NIL_P(parser->delayed)) { ripper_dispatch_delayed_token(parser, t); + return t; } if (t != 0) ripper_dispatch_scan_event(parser, t); Index: ruby_1_9_2/ext/socket/unixsocket.c =================================================================== --- ruby_1_9_2/ext/socket/unixsocket.c (revision 32383) +++ ruby_1_9_2/ext/socket/unixsocket.c (revision 32384) @@ -248,7 +248,7 @@ #endif arg.fd = fptr->fd; - while ((int)BLOCKING_REGION_FD(sendmsg_blocking, &arg) == -1) { + while ((int)BLOCKING_REGION(sendmsg_blocking, &arg) == -1) { if (!rb_io_wait_writable(arg.fd)) rb_sys_fail("sendmsg(2)"); } @@ -335,7 +335,7 @@ #endif arg.fd = fptr->fd; - while ((int)BLOCKING_REGION_FD(recvmsg_blocking, &arg) == -1) { + while ((int)BLOCKING_REGION(recvmsg_blocking, &arg) == -1) { if (!rb_io_wait_readable(arg.fd)) rb_sys_fail("recvmsg(2)"); } Index: ruby_1_9_2/version.h =================================================================== --- ruby_1_9_2/version.h (revision 32383) +++ ruby_1_9_2/version.h (revision 32384) @@ -1,5 +1,5 @@ #define RUBY_VERSION "1.9.2" -#define RUBY_PATCHLEVEL 283 +#define RUBY_PATCHLEVEL 284 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 9 #define RUBY_VERSION_TEENY 1 Index: ruby_1_9_2/test/ripper/test_scanner_events.rb =================================================================== --- ruby_1_9_2/test/ripper/test_scanner_events.rb (revision 32383) +++ ruby_1_9_2/test/ripper/test_scanner_events.rb (revision 32384) @@ -67,10 +67,17 @@ [[3, 0], :on_heredoc_end, "EOS"]], Ripper.lex("<<EOS\nheredoc\nEOS") assert_equal [[[1, 0], :on_regexp_beg, "/"], - [[1, 1], :on_tstring_content, "foo\n"], - [[2, 0], :on_tstring_content, "bar"], + [[1, 1], :on_tstring_content, "foo\nbar"], [[2, 3], :on_regexp_end, "/"]], Ripper.lex("/foo\nbar/") + assert_equal [[[1, 0], :on_regexp_beg, "/"], + [[1, 1], :on_tstring_content, "foo\n\u3020"], + [[2, 3], :on_regexp_end, "/"]], + Ripper.lex("/foo\n\u3020/") + assert_equal [[[1, 0], :on_tstring_beg, "'"], + [[1, 1], :on_tstring_content, "foo\n\xe3\x80\xa0"], + [[2, 3], :on_tstring_end, "'"]], + Ripper.lex("'foo\n\xe3\x80\xa0'") end def test_location @@ -534,6 +541,12 @@ scan('tstring_content', '"abc#{1}def"') assert_equal ['sym'], scan('tstring_content', ':"sym"') + assert_equal ['a b c'], + scan('tstring_content', ':"a b c"'), + "bug#4544" + assert_equal ["a\nb\nc"], + scan('tstring_content', ":'a\nb\nc'"), + "bug#4544" end def test_tstring_end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/