Skip to content

Commit 7a1fdd6

Browse files
committed
merge revision(s) r47090: [Backport ruby#10114]
* parse.y (parser_yyerror): preserve source code encoding in syntax error messages. [ruby-core:64228] [Bug ruby#10114] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@47267 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 50d3445 commit 7a1fdd6

File tree

4 files changed

+15
-4
lines changed

4 files changed

+15
-4
lines changed

ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
Mon Aug 25 00:26:12 2014 Nobuyoshi Nakada <[email protected]>
2+
3+
* parse.y (parser_yyerror): preserve source code encoding in
4+
syntax error messages. [ruby-core:64228] [Bug #10114]
5+
16
Sat Aug 23 02:39:20 2014 Nobuyoshi Nakada <[email protected]>
27

38
* vm_insnhelper.c (vm_call_method): unusable super class should cause

parse.y

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5269,7 +5269,7 @@ parser_yyerror(struct parser_params *parser, const char *msg)
52695269
buf = ALLOCA_N(char, len+2);
52705270
MEMCPY(buf, p, char, len);
52715271
buf[len] = '\0';
5272-
rb_compile_error_append("%s%s%s", pre, buf, post);
5272+
rb_compile_error_with_enc(NULL, 0, (void *)current_enc, "%s%s%s", pre, buf, post);
52735273

52745274
i = (int)(lex_p - p);
52755275
p2 = buf; pe = buf + len;

test/ruby/test_syntax.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,12 @@ def test_warning_for_cr
402402
end
403403
end
404404

405+
def test_error_message_encoding
406+
bug10114 = '[ruby-core:64228] [Bug #10114]'
407+
code = "# -*- coding: utf-8 -*-\n" "def n \"\u{2208}\"; end"
408+
assert_syntax_error(code, /def n "\u{2208}"; end/, bug10114)
409+
end
410+
405411
private
406412

407413
def not_label(x) @result = x; @not_label ||= nil end

version.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#define RUBY_VERSION "2.1.2"
2-
#define RUBY_RELEASE_DATE "2014-08-23"
3-
#define RUBY_PATCHLEVEL 207
2+
#define RUBY_RELEASE_DATE "2014-08-25"
3+
#define RUBY_PATCHLEVEL 208
44

55
#define RUBY_RELEASE_YEAR 2014
66
#define RUBY_RELEASE_MONTH 8
7-
#define RUBY_RELEASE_DAY 23
7+
#define RUBY_RELEASE_DAY 25
88

99
#include "ruby/version.h"
1010

0 commit comments

Comments
 (0)