summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2021-05-13 12:30:48 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2021-05-13 12:54:56 +0900
commit110f242ef9b495037f59e4972ee102a8b8b372d5 (patch)
tree32757e308867091c2c5d5e6a4a04941ff1f83996 /parse.y
parent9ce29c94d82c6bf278b1be088435726a9c47e225 (diff)
Also `\U` after control/meta is invalid [Bug #17861]
As well as `\u`, `\U` should be invalid there too. And highlight including `u`/`U` not only the backslash before it.
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y12
1 files changed, 10 insertions, 2 deletions
diff --git a/parse.y b/parse.y
index 66813e5ecb..3a03a3e030 100644
--- a/parse.y
+++ b/parse.y
@@ -6825,7 +6825,11 @@ read_escape(struct parser_params *p, int flags, rb_encoding **encp)
goto eof;
}
if ((c = nextc(p)) == '\\') {
- if (peek(p, 'u')) goto eof;
+ switch (peekc(p)) {
+ case 'u': case 'U':
+ nextc(p);
+ goto eof;
+ }
return read_escape(p, flags|ESCAPE_META, encp) | 0x80;
}
else if (c == -1 || !ISASCII(c)) goto eof;
@@ -6850,7 +6854,11 @@ read_escape(struct parser_params *p, int flags, rb_encoding **encp)
case 'c':
if (flags & ESCAPE_CONTROL) goto eof;
if ((c = nextc(p))== '\\') {
- if (peek(p, 'u')) goto eof;
+ switch (peekc(p)) {
+ case 'u': case 'U':
+ nextc(p);
+ goto eof;
+ }
c = read_escape(p, flags|ESCAPE_CONTROL, encp);
}
else if (c == '?')