Project

General

Profile

Actions

Feature #20759

closed

No good API to query which parser is being used

Added by luke-gru (Luke Gruber) 3 months ago. Updated 3 months ago.

Status:
Rejected
Assignee:
-
Target version:
-
[ruby-core:119286]

Description

Right now the best way I found is:

parser = RUBY_DESCRIPTION =~ /prism/i ? "prism" : "parse.y"

This is useful if you want to invoke a subprocess with the same options given to ruby. ARGV parsing might not work because the option might have been given via RUBYOPT.

Maybe RubyVM::PARSER could be set to the current parser, and this value could either be a String or Symbol.

Actions #1

Updated by luke-gru (Luke Gruber) 3 months ago

  • Description updated (diff)

Updated by kddnewton (Kevin Newton) 3 months ago

  • Status changed from Open to Rejected

This is on purpose. This should be a transparent change and not visible to the end user. If you need to access the parser API, you can use the Prism constant directly, but otherwise it should not be accessible.

Updated by kddnewton (Kevin Newton) 3 months ago

Note that there is another discussion around retrieving command line options given here: https://bugs.ruby-lang.org/issues/6648.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0