summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-12-02 02:47:11 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-12-02 02:47:11 +0000
commit80045bc2a9e12012d6d16517ea5cb037e67eb2c1 (patch)
treea1040a60e1f79361995a5f3cc0794400c0f56ea4 /parse.y
parent76bb017ad2c818f5250047a935e1ba44e1a7c40d (diff)
parse.y: relax spaces
* parse.y (parser_tokadd_utf8): relax restriction spaces inside "\u{...}". git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56963 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y6
1 files changed, 5 insertions, 1 deletions
diff --git a/parse.y b/parse.y
index d58d14c4dd..80c9667b63 100644
--- a/parse.y
+++ b/parse.y
@@ -5800,6 +5800,8 @@ parser_tokadd_utf8(struct parser_params *parser, rb_encoding **encp,
if (peek(open_brace)) { /* handle \u{...} form */
int c, last = nextc();
+ do c = nextc(); while (ISSPACE(c));
+ pushback(c);
do {
if (regexp_literal) tokadd(last);
codepoint = scan_hex(lex_p, 6, &numlen);
@@ -5816,7 +5818,8 @@ parser_tokadd_utf8(struct parser_params *parser, rb_encoding **encp,
codepoint, (int)numlen)) {
return 0;
}
- if (ISSPACE(c = nextc())) last = c;
+ while (ISSPACE(c = nextc())) last = c;
+ pushback(c);
} while (string_literal && c != close_brace);
if (c != close_brace) {
@@ -5825,6 +5828,7 @@ parser_tokadd_utf8(struct parser_params *parser, rb_encoding **encp,
}
if (regexp_literal) tokadd(close_brace);
+ nextc();
}
else { /* handle \uxxxx form */
codepoint = scan_hex(lex_p, 4, &numlen);