From: duerst Date: 2021-11-15T06:30:51+00:00 Subject: [ruby-core:106065] [Ruby master Bug#18294] error when parsing regexp comment Issue #18294 has been updated by duerst (Martin D��rst). thyresias (Thierry Lambert) wrote: > The following code generates the error "too short escaped multibyte character" > ``` ruby > _re = / > foo # \M-ca > /x > ``` > Removing the \ or doubling it makes the error disappear. > Since this is in comment text, I would expect to be able to type anything there: am I missing something? I guess yes. It's somewhat counter-intuitive, but I guess the implementation is handling escapes while it reads the regexp up to the /x, and only then it knows that some parts of it are comments. It would be possible to change the implementation, but I don't know if it's worth it for such an edge case. ---------------------------------------- Bug #18294: error when parsing regexp comment https://bugs.ruby-lang.org/issues/18294#change-94656 * Author: thyresias (Thierry Lambert) * Status: Open * Priority: Normal * ruby -v: ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [i386-mingw32] * Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN ---------------------------------------- The following code generates the error "too short escaped multibyte character" ``` ruby _re = / foo # \M-ca /x ``` Removing the \ or doubling it makes the error disappear. Since this is in comment text, I would expect to be able to type anything there: am I missing something? -- https://bugs.ruby-lang.org/ Unsubscribe: