mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
parse.y: zero codepoints
* parse.y (parser_tokadd_utf8): relax restriction to allow zero or more codepoints. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57050 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
1d51f427ff
commit
7e8b910a56
2 changed files with 3 additions and 5 deletions
5
parse.y
5
parse.y
|
@ -5809,14 +5809,15 @@ parser_tokadd_utf8(struct parser_params *parser, rb_encoding **encp,
|
|||
int c, last = nextc();
|
||||
do c = nextc(); while (ISSPACE(c));
|
||||
pushback(c);
|
||||
do {
|
||||
while (!string_literal || c != close_brace) {
|
||||
if (regexp_literal) tokadd(last);
|
||||
if (!parser_tokadd_codepoint(parser, encp, regexp_literal, TRUE)) {
|
||||
return 0;
|
||||
}
|
||||
while (ISSPACE(c = nextc())) last = c;
|
||||
pushback(c);
|
||||
} while (string_literal && c != close_brace);
|
||||
if (!string_literal) break;
|
||||
}
|
||||
|
||||
if (c != close_brace) {
|
||||
yyerror("unterminated Unicode escape");
|
||||
|
|
|
@ -535,9 +535,6 @@ class TestParse < Test::Unit::TestCase
|
|||
assert_nothing_raised(SyntaxError, bug) do
|
||||
assert_equal(sym, eval(':"foo\u{0}bar"'))
|
||||
end
|
||||
assert_raise(SyntaxError) do
|
||||
eval ':"foo\u{}bar"'
|
||||
end
|
||||
end
|
||||
|
||||
def test_parse_string
|
||||
|
|
Loading…
Reference in a new issue