mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* parse.y (parser_tokadd_string): insert a backslash only if
quoted by single quotes. [ruby-dev:45281] [Bug #6069] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34796 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
eec0b2d88a
commit
785521bd51
3 changed files with 15 additions and 5 deletions
|
@ -1,3 +1,8 @@
|
|||
Sat Feb 25 07:53:58 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* parse.y (parser_tokadd_string): insert a backslash only if
|
||||
quoted by single quotes. [ruby-dev:45281] [Bug #6069]
|
||||
|
||||
Sat Feb 25 07:53:49 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* dir.c (dir_inspect), io.c (rb_io_inspect): keep encoding of path.
|
||||
|
|
3
parse.y
3
parse.y
|
@ -6507,7 +6507,7 @@ parser_tokadd_string(struct parser_params *parser,
|
|||
default:
|
||||
if (c == -1) return -1;
|
||||
if (!ISASCII(c)) {
|
||||
tokadd('\\');
|
||||
if ((func & STR_FUNC_EXPAND) == 0) tokadd('\\');
|
||||
goto non_ascii;
|
||||
}
|
||||
if (func & STR_FUNC_REGEXP) {
|
||||
|
@ -7597,7 +7597,6 @@ parser_yylex(struct parser_params *parser)
|
|||
}
|
||||
else if (!lex_eol_p() && !(c = *lex_p, ISASCII(c))) {
|
||||
nextc();
|
||||
tokadd('\\');
|
||||
if (tokadd_mbchar(c) == -1) return 0;
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -79,9 +79,15 @@ class TestRubyLiteral < Test::Unit::TestCase
|
|||
assert_equal "\x13", "\c\x33"
|
||||
assert_equal "\x13", "\C-\x33"
|
||||
assert_equal "\xB3", "\M-\x33"
|
||||
assert_equal "\\\u201c", eval(%["\\\u{201c}"]), bug6069
|
||||
assert_equal "\\\u201c".encode("euc-jp"), eval(%["\\\u{201c}"].encode("euc-jp")), bug6069
|
||||
assert_equal "\\\u201c".encode("iso-8859-13"), eval(%["\\\u{201c}"].encode("iso-8859-13")), bug6069
|
||||
assert_equal "\u201c", eval(%["\\\u{201c}"]), bug5262
|
||||
assert_equal "\u201c".encode("euc-jp"), eval(%["\\\u{201c}"].encode("euc-jp")), bug5262
|
||||
assert_equal "\u201c".encode("iso-8859-13"), eval(%["\\\u{201c}"].encode("iso-8859-13")), bug5262
|
||||
assert_equal "\\\u201c", eval(%['\\\u{201c}']), bug6069
|
||||
assert_equal "\\\u201c".encode("euc-jp"), eval(%['\\\u{201c}'].encode("euc-jp")), bug6069
|
||||
assert_equal "\\\u201c".encode("iso-8859-13"), eval(%['\\\u{201c}'].encode("iso-8859-13")), bug6069
|
||||
assert_equal "\u201c", eval(%[?\\\u{201c}]), bug6069
|
||||
assert_equal "\u201c".encode("euc-jp"), eval(%[?\\\u{201c}].encode("euc-jp")), bug6069
|
||||
assert_equal "\u201c".encode("iso-8859-13"), eval(%[?\\\u{201c}].encode("iso-8859-13")), bug6069
|
||||
end
|
||||
|
||||
def test_dstring
|
||||
|
|
Loading…
Reference in a new issue