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

ruby-changes:39448

From: nobu <ko1@a...>
Date: Tue, 11 Aug 2015 11:53:47 +0900 (JST)
Subject: [ruby-changes:39448] nobu:r51529 (trunk): parse.y: optional superclass

nobu	2015-08-11 11:53:31 +0900 (Tue, 11 Aug 2015)

  New Revision: 51529

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

  Log:
    parse.y: optional superclass
    
    * parse.y (superclass): make superclass rule optional and allow
      any contents without a terminator.  [EXPERIMENTAL]

  Modified files:
    trunk/ChangeLog
    trunk/parse.y
    trunk/test/rdoc/test_rdoc_markup_to_html.rb
    trunk/test/ruby/test_parse.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 51528)
+++ ChangeLog	(revision 51529)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Aug 11 11:53:28 2015  Nobuyoshi Nakada  <nobu@r...>
+
+	* parse.y (superclass): make superclass rule optional and allow
+	  any contents without a terminator.  [EXPERIMENTAL]
+
 Tue Aug 11 10:58:42 2015  Juanito Fatas  <juanitofatas@g...>
 
 	* string.c: [DOC] Make #end_with? example doc symmetry
Index: parse.y
===================================================================
--- parse.y	(revision 51528)
+++ parse.y	(revision 51529)
@@ -4465,15 +4465,7 @@ backref		: tNTH_REF https://github.com/ruby/ruby/blob/trunk/parse.y#L4465
 		| tBACK_REF
 		;
 
-superclass	: term
-		    {
-		    /*%%%*/
-			$$ = 0;
-		    /*%
-			$$ = Qnil;
-		    %*/
-		    }
-		| '<'
+superclass	: '<'
 		    {
 			lex_state = EXPR_BEG;
 			command_start = TRUE;
@@ -4482,13 +4474,11 @@ superclass	: term https://github.com/ruby/ruby/blob/trunk/parse.y#L4474
 		    {
 			$$ = $3;
 		    }
-		| error term
+		| /* none */
 		    {
 		    /*%%%*/
-			yyerrok;
 			$$ = 0;
 		    /*%
-			yyerrok;
 			$$ = Qnil;
 		    %*/
 		    }
Index: test/ruby/test_parse.rb
===================================================================
--- test/ruby/test_parse.rb	(revision 51528)
+++ test/ruby/test_parse.rb	(revision 51529)
@@ -206,9 +206,9 @@ class TestParse < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_parse.rb#L206
       END
     end
 
-    assert_raise(SyntaxError) do
+    assert_nothing_raised(SyntaxError) do
       eval <<-END, nil, __FILE__, __LINE__+1
-        class Foo Bar; end
+        class Foo 1; end
       END
     end
   end
Index: test/rdoc/test_rdoc_markup_to_html.rb
===================================================================
--- test/rdoc/test_rdoc_markup_to_html.rb	(revision 51528)
+++ test/rdoc/test_rdoc_markup_to_html.rb	(revision 51529)
@@ -619,6 +619,7 @@ class TestRDocMarkupToHtml < RDoc::Marku https://github.com/ruby/ruby/blob/trunk/test/rdoc/test_rdoc_markup_to_html.rb#L619
       'def x() end',
       'def x; end',
       'class C; end',
+      'class C end',
       "module M end",
       'a # => blah',
       'x { |y| nil }',
@@ -629,7 +630,6 @@ class TestRDocMarkupToHtml < RDoc::Marku https://github.com/ruby/ruby/blob/trunk/test/rdoc/test_rdoc_markup_to_html.rb#L630
     ]
     invalid_syntax = [
       'def x end',
-      'class C end',
       'class C < end',
       'module M < C end',
       'a=># blah',

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

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