mirror of
https://github.com/ruby/ruby.git
synced 2026-10-28 16:36:20 +08:00
Say that Ruby::Prism is the parser that parsed the running program
Ruby::Prism itself does not compile the program (prism_compile.c does, and other implementations may not even compile an AST into bytecode). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
eba94c3725
commit
128308226c
6 files changed
+10
-10
Notes:
git
2026-10-10 19:28:06 +00:00
No files matched your search
@@ -210,7 +210,7 @@ Note: We're only listing outstanding class updates.
|
||||
* Ruby::Prism
|
||||
|
||||
* `Ruby::Prism` is added. It is the prism parser built into the
|
||||
interpreter, i.e., the very parser that compiles the running program,
|
||||
interpreter, i.e., the very parser that parsed the running program,
|
||||
independent of the prism gem. It is autoloaded.
|
||||
`Method#syntax_tree` and others return its nodes. Its API may change
|
||||
between Ruby minor versions; use the `prism` gem unless you need the
|
||||
|
||||
@@ -349,7 +349,7 @@ class RubyVM::InstructionSequence
|
||||
#
|
||||
# The node is a Ruby::Prism::Node, not a node of the prism gem:
|
||||
# Ruby::Prism is the parser built into the interpreter, so the returned
|
||||
# tree always corresponds to the compiled code regardless of which
|
||||
# tree always corresponds to the running code regardless of which
|
||||
# version of the prism gem is installed.
|
||||
#
|
||||
# This method is experimental and might change without notice.
|
||||
@@ -369,8 +369,8 @@ class RubyVM::InstructionSequence
|
||||
node_id = self.node_id
|
||||
if Primitive.iseq_compiled_by_prism_p
|
||||
# Ruby::Prism is the parser built into the interpreter, i.e., the very
|
||||
# parser that compiled this instruction sequence, so node_id always
|
||||
# corresponds. The prism gem (if any) is not involved.
|
||||
# parser that parsed the source of this instruction sequence, so
|
||||
# node_id always corresponds. The prism gem (if any) is not involved.
|
||||
result = source ? Ruby::Prism.parse(source, version: "current") : Ruby::Prism.parse_file(path, version: "current")
|
||||
return nil unless result.success?
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ of each.
|
||||
- `RbConfig`: Information about your Ruby configuration and build
|
||||
- `Gem`: A package management framework for Ruby
|
||||
- `Pathname`: Representation of the name of a file or directory on the filesystem. Pathname is a core class, but only methods that depend on other libraries are provided as a library.
|
||||
- `Ruby::Prism`: The prism parser built into the interpreter, i.e., the parser that compiles the running program
|
||||
- `Ruby::Prism`: The prism parser built into the interpreter, i.e., the parser that parsed the running program
|
||||
|
||||
## Extensions
|
||||
|
||||
|
||||
+3
-3
@@ -5,7 +5,7 @@ void rb_autoload_str(VALUE mod, ID id, VALUE file);
|
||||
|
||||
/*
|
||||
* The prism parser is linked into the interpreter and exposed as the
|
||||
* Ruby::Prism module. It is the very parser that compiled the running
|
||||
* Ruby::Prism module. It is the very parser that parsed the running
|
||||
* code, independent of any version of the prism gem that may be installed.
|
||||
*
|
||||
* `require "ruby/prism"` loads the Ruby part of the library
|
||||
@@ -21,7 +21,7 @@ Init_Prism(void)
|
||||
* Document-module: Ruby::Prism
|
||||
*
|
||||
* \Ruby::Prism is the prism parser built into the interpreter, i.e., the
|
||||
* very parser that compiles the running program.
|
||||
* very parser that parsed the running program.
|
||||
*
|
||||
* Its API follows the version of prism bundled with this Ruby, and may
|
||||
* change incompatibly between Ruby minor versions: not only the node
|
||||
@@ -39,7 +39,7 @@ Init_Prism(void)
|
||||
/*
|
||||
* Set up the autoload of Ruby::Prism, so that programs that do not use it
|
||||
* pay nothing. This is called after the command line options are processed,
|
||||
* and only when prism is the parser that compiles the program: with
|
||||
* and only when prism is the parser that parses the program: with
|
||||
* --parser=parse.y, Ruby::Prism is not defined.
|
||||
*/
|
||||
void
|
||||
|
||||
@@ -1839,7 +1839,7 @@ ruby_opt_init(ruby_cmdline_options_t *opt)
|
||||
rb_zjit_init_builtin_cmes();
|
||||
#endif
|
||||
|
||||
// Ruby::Prism is the parser that compiles the program; it is not
|
||||
// Ruby::Prism is the parser that parsed the program; it is not
|
||||
// exposed when parse.y is selected by --parser.
|
||||
if (rb_ruby_prism_p()) {
|
||||
rb_prism_init_autoload();
|
||||
|
||||
@@ -408,7 +408,7 @@ module SyncDefaultGems
|
||||
|
||||
# The upstream prism is written for the `Prism` namespace of the prism gem.
|
||||
# In ruby/ruby the same code is built into the interpreter as `Ruby::Prism`
|
||||
# so that it is always the very parser that compiled the running code, no
|
||||
# so that it is always the very parser that parsed the running code, no
|
||||
# matter which version of the prism gem is installed. Rewrite the namespace
|
||||
# (and the `prism/...` feature names) of the synced files here, so that the
|
||||
# upstream repository does not need to know about the renaming.
|
||||
|
||||
Reference in new issue
Block a user