ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:119286] [Ruby master Feature#20759] No good API to query which parser is being used
@ 2024-09-24 18:17 luke-gru (Luke Gruber) via ruby-core
  2024-09-24 18:27 ` [ruby-core:119287] " kddnewton (Kevin Newton) via ruby-core
  2024-09-24 18:28 ` [ruby-core:119288] " kddnewton (Kevin Newton) via ruby-core
  0 siblings, 2 replies; 3+ messages in thread
From: luke-gru (Luke Gruber) via ruby-core @ 2024-09-24 18:17 UTC (permalink / raw)
  To: ruby-core; +Cc: luke-gru (Luke Gruber)

Issue #20759 has been reported by luke-gru (Luke Gruber).

----------------------------------------
Feature #20759: No good API to query which parser is being used
https://bugs.ruby-lang.org/issues/20759

* Author: luke-gru (Luke Gruber)
* Status: Open
----------------------------------------
Right now the best way I found is:

```ruby
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 used?



-- 
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/lists/ruby-core.ml.ruby-lang.org/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ruby-core:119287] [Ruby master Feature#20759] No good API to query which parser is being used
  2024-09-24 18:17 [ruby-core:119286] [Ruby master Feature#20759] No good API to query which parser is being used luke-gru (Luke Gruber) via ruby-core
@ 2024-09-24 18:27 ` kddnewton (Kevin Newton) via ruby-core
  2024-09-24 18:28 ` [ruby-core:119288] " kddnewton (Kevin Newton) via ruby-core
  1 sibling, 0 replies; 3+ messages in thread
From: kddnewton (Kevin Newton) via ruby-core @ 2024-09-24 18:27 UTC (permalink / raw)
  To: ruby-core; +Cc: kddnewton (Kevin Newton)

Issue #20759 has been updated by kddnewton (Kevin Newton).

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.

----------------------------------------
Feature #20759: No good API to query which parser is being used
https://bugs.ruby-lang.org/issues/20759#change-109896

* Author: luke-gru (Luke Gruber)
* Status: Rejected
----------------------------------------
Right now the best way I found is:

```ruby
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.



-- 
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/lists/ruby-core.ml.ruby-lang.org/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ruby-core:119288] [Ruby master Feature#20759] No good API to query which parser is being used
  2024-09-24 18:17 [ruby-core:119286] [Ruby master Feature#20759] No good API to query which parser is being used luke-gru (Luke Gruber) via ruby-core
  2024-09-24 18:27 ` [ruby-core:119287] " kddnewton (Kevin Newton) via ruby-core
@ 2024-09-24 18:28 ` kddnewton (Kevin Newton) via ruby-core
  1 sibling, 0 replies; 3+ messages in thread
From: kddnewton (Kevin Newton) via ruby-core @ 2024-09-24 18:28 UTC (permalink / raw)
  To: ruby-core; +Cc: kddnewton (Kevin Newton)

Issue #20759 has been updated by kddnewton (Kevin Newton).


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

----------------------------------------
Feature #20759: No good API to query which parser is being used
https://bugs.ruby-lang.org/issues/20759#change-109897

* Author: luke-gru (Luke Gruber)
* Status: Rejected
----------------------------------------
Right now the best way I found is:

```ruby
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.



-- 
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/lists/ruby-core.ml.ruby-lang.org/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-09-24 18:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-24 18:17 [ruby-core:119286] [Ruby master Feature#20759] No good API to query which parser is being used luke-gru (Luke Gruber) via ruby-core
2024-09-24 18:27 ` [ruby-core:119287] " kddnewton (Kevin Newton) via ruby-core
2024-09-24 18:28 ` [ruby-core:119288] " kddnewton (Kevin Newton) via ruby-core

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 NNTP newsgroup(s).