ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: "koic (Koichi ITO)" <noreply@ruby-lang.org>
To: ruby-core@ml.ruby-lang.org
Subject: [ruby-core:111228] [Ruby master Bug#19190] `Regexp.compile('regexp', 'n')` raises `unknown regexp option: n (ArgumentError)`
Date: Wed, 07 Dec 2022 09:24:51 +0000 (UTC)	[thread overview]
Message-ID: <redmine.issue-19190.20221207092451.9869@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-19190.20221207092451.9869@ruby-lang.org

Issue #19190 has been reported by koic (Koichi ITO).

----------------------------------------
Bug #19190: `Regexp.compile('regexp', 'n')` raises `unknown regexp option: n (ArgumentError)`
https://bugs.ruby-lang.org/issues/19190

* Author: koic (Koichi ITO)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.2.0dev (2022-12-07T03:32:29Z master bcd8b2f00a) [x86_64-darwin19]
* Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN
----------------------------------------
I get the following unexpected error when using Ruby 3.2.0-dev.

## Expected (Ruby 3.1 and prior)

No errors:

```console
% 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.

```console
% 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.

```console
% 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)
```



-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/

       reply	other threads:[~2022-12-07  9:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-07  9:24 koic (Koichi ITO) [this message]
2022-12-07  9:57 ` [ruby-core:111229] [Ruby master Bug#19190] `Regexp.compile('regexp', 'n')` raises `unknown regexp option: n (ArgumentError)` hsbt (Hiroshi SHIBATA)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.issue-19190.20221207092451.9869@ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    --cc=ruby-core@ml.ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).