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

ruby-changes:47495

From: nobu <ko1@a...>
Date: Thu, 17 Aug 2017 21:33:45 +0900 (JST)
Subject: [ruby-changes:47495] nobu:r59611 (trunk): parse.y: unexpected tINTEGER message

nobu	2017-08-17 21:33:41 +0900 (Thu, 17 Aug 2017)

  New Revision: 59611

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

  Log:
    parse.y: unexpected tINTEGER message
    
    * parse.y (parser_number_literal_suffix): keep token after numeric
      suffix to show the value in an error message.

  Modified files:
    trunk/parse.y
    trunk/test/ruby/test_parse.rb
Index: test/ruby/test_parse.rb
===================================================================
--- test/ruby/test_parse.rb	(revision 59610)
+++ test/ruby/test_parse.rb	(revision 59611)
@@ -987,6 +987,9 @@ x = __ENCODING__ https://github.com/ruby/ruby/blob/trunk/test/ruby/test_parse.rb#L987
     begin;
       assert_syntax_error("def f r:def d; def f 0end", /unexpected/)
     end;
+
+    assert_syntax_error("def\nf(000)end", /^  \^~~/)
+    assert_syntax_error("def\nf(&)end", /^   \^/)
   end
 
   def test_method_location_in_rescue
Index: parse.y
===================================================================
--- parse.y	(revision 59610)
+++ parse.y	(revision 59611)
@@ -6563,7 +6563,6 @@ parser_number_literal_suffix(struct pars https://github.com/ruby/ruby/blob/trunk/parse.y#L6563
 	}
 	break;
     }
-    literal_flush(lex_p);
     return result;
 }
 
@@ -7935,6 +7934,9 @@ parser_yylex(struct parser_params *parse https://github.com/ruby/ruby/blob/trunk/parse.y#L7934
     parser->token_seen = TRUE;
   retry:
     last_state = lex_state;
+#ifndef RIPPER
+    token_flush(parser);
+#endif
     switch (c = nextc()) {
       case '\0':		/* NUL */
       case '\004':		/* ^D */
@@ -7959,8 +7961,6 @@ parser_yylex(struct parser_params *parse https://github.com/ruby/ruby/blob/trunk/parse.y#L7961
       outofloop:
 	pushback(c);
 	dispatch_scan_event(tSP);
-#else
-	token_flush(parser);
 #endif
 	goto retry;
 

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

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