[前][次][番号順一覧][スレッド一覧]

ruby-changes:36045

From: nobu <ko1@a...>
Date: Fri, 24 Oct 2014 22:49:55 +0900 (JST)
Subject: [ruby-changes:36045] nobu:r48126 (trunk): parse.y: fix fluent interface identifier

nobu	2014-10-24 22:49:44 +0900 (Fri, 24 Oct 2014)

  New Revision: 48126

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=48126

  Log:
    parse.y: fix fluent interface identifier
    
    * parse.y (parser_yylex): dispatch newline and space at fluent
      interface, so that the following identifier does not include the
      space.  [ruby-dev:48684] [Bug #10411]

  Modified files:
    trunk/ChangeLog
    trunk/parse.y
    trunk/test/ripper/test_scanner_events.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 48125)
+++ ChangeLog	(revision 48126)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri Oct 24 22:49:42 2014  Nobuyoshi Nakada  <nobu@r...>
+
+	* parse.y (parser_yylex): dispatch newline and space at fluent
+	  interface, so that the following identifier does not include the
+	  space.  [ruby-dev:48684] [Bug #10411]
+
 Fri Oct 24 20:41:36 2014  Kazuhiro NISHIYAMA  <zn@m...>
 
 	* signal.c (check_reserved_signal_): fix write count since r47991.
Index: parse.y
===================================================================
--- parse.y	(revision 48125)
+++ parse.y	(revision 48126)
@@ -7763,9 +7763,15 @@ parser_yylex(struct parser_params *parse https://github.com/ruby/ruby/blob/trunk/parse.y#L7763
 		space_seen = 1;
 		break;
 	      case '.': {
+#ifdef RIPPER
+		ripper_dispatch_delayed_token(parser, tIGNORED_NL);
+#endif
 		if ((c = nextc()) != '.') {
 		    pushback(c);
 		    pushback('.');
+#ifdef RIPPER
+		    ripper_dispatch_scan_event(parser, tSP);
+#endif
 		    goto retry;
 		}
 	      }
Index: test/ripper/test_scanner_events.rb
===================================================================
--- test/ripper/test_scanner_events.rb	(revision 48125)
+++ test/ripper/test_scanner_events.rb	(revision 48126)
@@ -38,6 +38,10 @@ class TestRipper::ScannerEvents < Test:: https://github.com/ruby/ruby/blob/trunk/test/ripper/test_scanner_events.rb#L38
                  Ripper.tokenize("print( <<""EOS)\nheredoc\nEOS\n")
     assert_equal ["\#\n", "\n", "\#\n", "\n", "nil", "\n"],
                  Ripper.tokenize("\#\n\n\#\n\nnil\n")
+    assert_equal ["1", "  ", ".", "foo", "\n"],
+                 Ripper.tokenize("1  .foo\n")
+    assert_equal ["1", "\n", "  ", ".", "foo", "\n"],
+                 Ripper.tokenize("1\n  .foo\n")
   end
 
   def test_lex

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]