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

ruby-changes:44977

From: nobu <ko1@a...>
Date: Sun, 11 Dec 2016 18:20:37 +0900 (JST)
Subject: [ruby-changes:44977] nobu:r57050 (trunk): parse.y: zero codepoints

nobu	2016-12-11 18:20:27 +0900 (Sun, 11 Dec 2016)

  New Revision: 57050

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

  Log:
    parse.y: zero codepoints
    
    * parse.y (parser_tokadd_utf8): relax restriction to allow zero or
      more codepoints.

  Modified files:
    trunk/parse.y
    trunk/test/ruby/test_parse.rb
Index: test/ruby/test_parse.rb
===================================================================
--- test/ruby/test_parse.rb	(revision 57049)
+++ test/ruby/test_parse.rb	(revision 57050)
@@ -535,9 +535,6 @@ class TestParse < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_parse.rb#L535
     assert_nothing_raised(SyntaxError, bug) do
       assert_equal(sym, eval(':"foo\u{0}bar"'))
     end
-    assert_raise(SyntaxError) do
-      eval ':"foo\u{}bar"'
-    end
   end
 
   def test_parse_string
Index: parse.y
===================================================================
--- parse.y	(revision 57049)
+++ parse.y	(revision 57050)
@@ -5809,14 +5809,15 @@ parser_tokadd_utf8(struct parser_params https://github.com/ruby/ruby/blob/trunk/parse.y#L5809
 	int c, last = nextc();
 	do c = nextc(); while (ISSPACE(c));
 	pushback(c);
-	do {
+	while (!string_literal || c != close_brace) {
 	    if (regexp_literal) tokadd(last);
 	    if (!parser_tokadd_codepoint(parser, encp, regexp_literal, TRUE)) {
 		return 0;
 	    }
 	    while (ISSPACE(c = nextc())) last = c;
 	    pushback(c);
-	} while (string_literal && c != close_brace);
+	    if (!string_literal) break;
+	}
 
 	if (c != close_brace) {
 	    yyerror("unterminated Unicode escape");

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

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