[#106355] [Ruby master Bug#18373] RBS build failure: '/include/x86_64-linux/ruby/config.h', needed by 'constants.o'. — "vo.x (Vit Ondruch)" <noreply@...>
Issue #18373 has been reported by vo.x (Vit Ondruch).
28 messages
2021/12/01
[ruby-core:106911] [Ruby master Bug#18294] error when parsing regexp comment
From:
janosch-x <noreply@...>
Date:
2021-12-29 22:26:15 UTC
List:
ruby-core #106911
Issue #18294 has been updated by janosch-x (Janosch M端ller).
this affects:
- all String escapes that can be invalid (`\x`, `\u`, `\u{...}`, `\M`, `\C`, `\c`)
- only invalid escapes (e.g. `\x7F` is fine)
- no Regexp-specific escapes such as `\p{...}`, `\g<...>`, `\k<...>`
- Regexp literals (`SyntaxError`) and `Regexp::new` (`RegexpError`)
- end-of-line comments as well as comment groups (these don't require x-mode)
- all Ruby versions
to give an example that is maybe a bit less edge-casy:
```ruby
/ C:\\[a-z]{5} # e.g. C:\users /x
# => ^
# => invalid Unicode escape (SyntaxError)
```
the comment handling in `regparse.c` could probably be changed fairly easily, it only happens [here]( https://github.com/ruby/ruby/blob/efa0c31ce518bb26aca80392cce7fc5471ca9fef/regparse.c#L3884 ) and [here]( https://github.com/ruby/ruby/blob/efa0c31ce518bb26aca80392cce7fc5471ca9fef/regparse.c#L4025 ). i could take this on with a few pointers.
i'm just wondering if the flags [here]( https://github.com/ruby/ruby/blob/efa0c31ce518bb26aca80392cce7fc5471ca9fef/parse.y#L6496 ) mean that escape sequences in Regexp literals are actually pre-processed by Ruby's main parser? it seems like this would make a fix much more complicated.
----------------------------------------
Bug #18294: error when parsing regexp comment
https://bugs.ruby-lang.org/issues/18294#change-95731
* 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: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>