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

ruby-changes:16921

From: nobu <ko1@a...>
Date: Sun, 8 Aug 2010 12:41:48 +0900 (JST)
Subject: [ruby-changes:16921] Ruby:r28917 (trunk): * parse.y (parser_tokadd_escape): no similar messages twice.

nobu	2010-08-08 12:41:30 +0900 (Sun, 08 Aug 2010)

  New Revision: 28917

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

  Log:
    * parse.y (parser_tokadd_escape): no similar messages twice.
      [ruby-core:31048]

  Modified files:
    trunk/ChangeLog
    trunk/parse.y
    trunk/test/ruby/test_regexp.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 28916)
+++ ChangeLog	(revision 28917)
@@ -1,3 +1,8 @@
+Sun Aug  8 12:41:19 2010  Nobuyoshi Nakada  <nobu@r...>
+
+	* parse.y (parser_tokadd_escape): no similar messages twice.
+	  [ruby-core:31048]
+
 Sun Aug  8 10:07:45 2010  Tanaka Akira  <akr@f...>
 
 	* strftime.c (rb_strftime_with_timespec): suppress warnings.
Index: parse.y
===================================================================
--- parse.y	(revision 28916)
+++ parse.y	(revision 28917)
@@ -5653,7 +5653,7 @@
       case 'x':	/* hex constant */
 	{
 	    tok_hex(&numlen);
-	    if (numlen == 0) goto eof;
+	    if (numlen == 0) return -1;
 	    tokcopy((int)numlen + 2);
 	}
 	return 0;
Index: test/ruby/test_regexp.rb
===================================================================
--- test/ruby/test_regexp.rb	(revision 28916)
+++ test/ruby/test_regexp.rb	(revision 28917)
@@ -834,4 +834,11 @@
   def test_property_warn
     assert_in_out_err('-w', 'x=/\p%s/', [], %r"warning: invalid Unicode Property \\p: /\\p%s/")
   end
+
+  def test_invalid_escape_error
+    bug3539 = '[ruby-core:31048]'
+    error = assert_raise(SyntaxError) {eval('/\x/', nil, bug3539)}
+    assert_match(/invalid hex escape/, error.message)
+    assert_equal(1, error.message.scan(/.*invalid .*escape.*/i).size, bug3539)
+  end
 end

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

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