diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2021-05-13 12:30:48 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2021-05-13 12:54:56 +0900 |
commit | 110f242ef9b495037f59e4972ee102a8b8b372d5 (patch) | |
tree | 32757e308867091c2c5d5e6a4a04941ff1f83996 /parse.y | |
parent | 9ce29c94d82c6bf278b1be088435726a9c47e225 (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.y | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -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 == '?') |