Actions
Bug #19190
closed`Regexp.compile('regexp', 'n')` raises `unknown regexp option: n (ArgumentError)`
Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 3.2.0dev (2022-12-07T03:32:29Z master bcd8b2f00a) [x86_64-darwin19]
Description
I get the following unexpected error when using Ruby 3.2.0-dev.
Expected (Ruby 3.1 and prior)¶
No errors:
% ruby -ve "Regexp.compile('regexp', 'n')"
ruby 3.1.3p185 (2022-11-24 revision 1a6b16756e) [x86_64-darwin19]
Actual (Ruby 3.2.0-dev)¶
An unexpected error occurs.
% ruby -ve "Regexp.compile('regexp', 'n')"
ruby 3.2.0dev (2022-12-07T03:32:29Z master bcd8b2f00a) [x86_64-darwin19]
-e:1:in `initialize': unknown regexp option: n (ArgumentError)
Regexp.compile('regexp', 'n')
^^^^^^^^^^^^^
from -e:1:in `compile'
from -e:1:in `<main>'
Context¶
I encountered the following error when developing the Parser gem with Ruby 3.2.0-dev. This is not encountered in Ruby 3.1.
% cd whitequark/parser
% bundle exec rake
racc --superclass=Parser::Base lib/parser/ruby32.y -o lib/parser/ruby32.rb --no-line-convert
/Users/koic/.rbenv/versions/3.2.0-dev/lib/ruby/gems/3.2.0+3/gems/racc-1.6.0/lib/racc/statetransitiontable.rb:219:in `initialize': unknown regexp option: n (ArgumentError)
Regexp.compile(map, 'n')
^^^^^^^^
from /Users/koic/.rbenv/versions/3.2.0-dev/lib/ruby/gems/3.2.0+3/gems/racc-1.6.0/lib/racc/statetransitiontable.rb:219:in `compile'
from /Users/koic/.rbenv/versions/3.2.0-dev/lib/ruby/gems/3.2.0+3/gems/racc-1.6.0/lib/racc/statetransitiontable.rb:219:in `mkmapexp'
from /Users/koic/.rbenv/versions/3.2.0-dev/lib/ruby/gems/3.2.0+3/gems/racc-1.6.0/lib/racc/statetransitiontable.rb:179:in `addent'
from /Users/koic/.rbenv/versions/3.2.0-dev/lib/ruby/gems/3.2.0+3/gems/racc-1.6.0/lib/racc/statetransitiontable.rb:122:in `block in gen_action_tables'
from /Users/koic/.rbenv/versions/3.2.0-dev/lib/ruby/gems/3.2.0+3/gems/racc-1.6.0/lib/racc/state.rb:56:in `each'
from /Users/koic/.rbenv/versions/3.2.0-dev/lib/ruby/gems/3.2.0+3/gems/racc-1.6.0/lib/racc/state.rb:56:in `each_state'
from /Users/koic/.rbenv/versions/3.2.0-dev/lib/ruby/gems/3.2.0+3/gems/racc-1.6.0/lib/racc/statetransitiontable.rb:112:in `gen_action_tables'
from /Users/koic/.rbenv/versions/3.2.0-dev/lib/ruby/gems/3.2.0+3/gems/racc-1.6.0/lib/racc/statetransitiontable.rb:72:in `generate'
from /Users/koic/.rbenv/versions/3.2.0-dev/lib/ruby/gems/3.2.0+3/gems/racc-1.6.0/lib/racc/statetransitiontable.rb:35:in `generate'
from /Users/koic/.rbenv/versions/3.2.0-dev/lib/ruby/gems/3.2.0+3/gems/racc-1.6.0/lib/racc/state.rb:93:in `state_transition_table'
from /Users/koic/.rbenv/versions/3.2.0-dev/lib/ruby/gems/3.2.0+3/gems/racc-1.6.0/lib/racc/grammar.rb:153:in `parser_class'
from /Users/koic/.rbenv/versions/3.2.0-dev/lib/ruby/gems/3.2.0+3/gems/racc-1.6.0/lib/racc/grammarfileparser.rb:144:in `<module:Racc>'
from /Users/koic/.rbenv/versions/3.2.0-dev/lib/ruby/gems/3.2.0+3/gems/racc-1.6.0/lib/racc/grammarfileparser.rb:20:in `<top (required)>'
from /Users/koic/.rbenv/versions/3.2.0-dev/lib/ruby/gems/3.2.0+3/gems/racc-1.6.0/lib/racc/static.rb:3:in `require'
from /Users/koic/.rbenv/versions/3.2.0-dev/lib/ruby/gems/3.2.0+3/gems/racc-1.6.0/lib/racc/static.rb:3:in `<top (required)>'
from /Users/koic/.rbenv/versions/3.2.0-dev/lib/ruby/gems/3.2.0+3/gems/racc-1.6.0/bin/racc:11:in `require'
from /Users/koic/.rbenv/versions/3.2.0-dev/lib/ruby/gems/3.2.0+3/gems/racc-1.6.0/bin/racc:11:in `<top (required)>'
from /Users/koic/.rbenv/versions/3.2.0-dev/bin/racc:25:in `load'
from /Users/koic/.rbenv/versions/3.2.0-dev/bin/racc:25:in `<main>'
rake aborted!
Command failed with status (1): [racc --superclass=Parser::Base lib/parser/...]
/Users/koic/src/github.com/whitequark/parser/Rakefile:166:in `block in <top (required)>'
/Users/koic/.rbenv/versions/3.2.0-dev/bin/bundle:25:in `load'
/Users/koic/.rbenv/versions/3.2.0-dev/bin/bundle:25:in `<main>'
Tasks: TOP => default => test => generate => lib/parser/ruby32.rb
(See full trace by running task with --trace)
Updated by hsbt (Hiroshi SHIBATA) almost 2 years ago
FYI: This issue has been fixed at racc-1.6.1
https://github.com/ruby/racc/commit/65cd26efd88e013c532c223fe9ab9ea4d0c93271
Updated by nobu (Nobuyoshi Nakada) almost 2 years ago
- Status changed from Open to Closed
Actions
Like0
Like1Like0