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

ruby-changes:35320

From: usa <ko1@a...>
Date: Fri, 5 Sep 2014 13:52:29 +0900 (JST)
Subject: [ruby-changes:35320] usa:r47402 (ruby_2_0_0): merge revision(s) 47090: [Backport #10114]

usa	2014-09-05 13:52:24 +0900 (Fri, 05 Sep 2014)

  New Revision: 47402

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

  Log:
    merge revision(s) 47090: [Backport #10114]
    
    * parse.y (parser_yyerror): preserve source code encoding in
      syntax error messages.  [ruby-core:64228] [Bug #10114]

  Modified directories:
    branches/ruby_2_0_0/
  Modified files:
    branches/ruby_2_0_0/ChangeLog
    branches/ruby_2_0_0/parse.y
    branches/ruby_2_0_0/test/ruby/test_syntax.rb
    branches/ruby_2_0_0/version.h
Index: ruby_2_0_0/ChangeLog
===================================================================
--- ruby_2_0_0/ChangeLog	(revision 47401)
+++ ruby_2_0_0/ChangeLog	(revision 47402)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1
+Fri Sep  5 13:51:10 2014  Nobuyoshi Nakada  <nobu@r...>
+
+	* parse.y (parser_yyerror): preserve source code encoding in
+	  syntax error messages.  [ruby-core:64228] [Bug #10114]
+
 Fri Sep  5 13:44:53 2014  Nobuyoshi Nakada  <nobu@r...>
 
 	* string.c (rb_str_count): fix wrong single-byte optimization.
Index: ruby_2_0_0/parse.y
===================================================================
--- ruby_2_0_0/parse.y	(revision 47401)
+++ ruby_2_0_0/parse.y	(revision 47402)
@@ -5246,7 +5246,7 @@ parser_yyerror(struct parser_params *par https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/parse.y#L5246
 	buf = ALLOCA_N(char, len+2);
 	MEMCPY(buf, p, char, len);
 	buf[len] = '\0';
-	rb_compile_error_append("%s%s%s", pre, buf, post);
+	rb_compile_error_with_enc(NULL, 0, (void *)current_enc, "%s%s%s", pre, buf, post);
 
 	i = (int)(lex_p - p);
 	p2 = buf; pe = buf + len;
Index: ruby_2_0_0/version.h
===================================================================
--- ruby_2_0_0/version.h	(revision 47401)
+++ ruby_2_0_0/version.h	(revision 47402)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/version.h#L1
 #define RUBY_VERSION "2.0.0"
 #define RUBY_RELEASE_DATE "2014-09-05"
-#define RUBY_PATCHLEVEL 551
+#define RUBY_PATCHLEVEL 552
 
 #define RUBY_RELEASE_YEAR 2014
 #define RUBY_RELEASE_MONTH 9
Index: ruby_2_0_0/test/ruby/test_syntax.rb
===================================================================
--- ruby_2_0_0/test/ruby/test_syntax.rb	(revision 47401)
+++ ruby_2_0_0/test/ruby/test_syntax.rb	(revision 47402)
@@ -352,6 +352,12 @@ eom https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/test_syntax.rb#L352
     assert_constant_reassignment_toplevel("11",    "+",  %w[53], already)
   end
 
+  def test_error_message_encoding
+    bug10114 = '[ruby-core:64228] [Bug #10114]'
+    code = "# -*- coding: utf-8 -*-\n" "def n \"\u{2208}\"; end"
+    assert_syntax_error(code, /def n "\u{2208}"; end/, bug10114)
+  end
+
   private
 
   def not_label(x) @result = x; @not_label ||= nil end

Property changes on: ruby_2_0_0
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r47090


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

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