зеркало из https://github.com/github/ruby.git
parse.y: preserve encoding
* parse.y (parser_yyerror): preserve source code encoding in syntax error messages. [ruby-core:64228] [Bug #10114] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47090 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
2b14e2ae05
Коммит
2bd1ae1e67
|
@ -1,3 +1,8 @@
|
|||
Thu Aug 7 06:04:49 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* parse.y (parser_yyerror): preserve source code encoding in
|
||||
syntax error messages. [ruby-core:64228] [Bug #10114]
|
||||
|
||||
Wed Aug 6 20:56:02 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
|
||||
|
||||
* ext/win32ole/win32ole.c: separate src of WIN32OLE_TYPELIB from
|
||||
|
|
2
parse.y
2
parse.y
|
@ -5261,7 +5261,7 @@ parser_yyerror(struct parser_params *parser, const char *msg)
|
|||
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;
|
||||
|
|
|
@ -435,6 +435,12 @@ eom
|
|||
assert_syntax_error("0.0.0", msg)
|
||||
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
|
||||
|
|
Загрузка…
Ссылка в новой задаче