diff options
author | nagachika <nagachika@ruby-lang.org> | 2021-05-22 16:47:24 +0900 |
---|---|---|
committer | nagachika <nagachika@ruby-lang.org> | 2021-05-22 16:47:24 +0900 |
commit | af9de56c6fde7f9adb81d6ed0ef3067af81f90e5 (patch) | |
tree | 51766458ece2e3f456eb61510503d64a20fadafb /parse.y | |
parent | 5e21726cda22e3cb34127751aec7e9babb4308b3 (diff) |
merge revision(s) 110f242ef9b495037f59e4972ee102a8b8b372d5: [Backport #17861]
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.
---
parse.y | 12 ++++++++++--
test/ruby/test_parse.rb | 15 +++++++++++++++
2 files changed, 25 insertions(+), 2 deletions(-)
Diffstat (limited to 'parse.y')
-rw-r--r-- | parse.y | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -6763,7 +6763,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; @@ -6788,7 +6792,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 == '?') |