aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-12-11 09:20:27 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-12-11 09:20:27 +0000
commit4d950bb16ef600e7c4e6c510c598df6ebc104ce2 (patch)
treedbdfffa8b14e81a8ee90ceb49f8cb458a9253c5e
parent38b37f7311e8f77aad009ae84b2fe866db421fc4 (diff)
downloadruby-4d950bb16ef600e7c4e6c510c598df6ebc104ce2.tar.gz
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
-rw-r--r--parse.y5
-rw-r--r--test/ruby/test_parse.rb3
2 files changed, 3 insertions, 5 deletions
diff --git a/parse.y b/parse.y
index 1f16794c8c..8162086033 100644
--- a/parse.y
+++ b/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");
diff --git a/test/ruby/test_parse.rb b/test/ruby/test_parse.rb
index 434533fcab..57d03166c7 100644
--- a/test/ruby/test_parse.rb
+++ b/test/ruby/test_parse.rb
@@ -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