Module

The Prism Ruby parser.

“Parsing Ruby is suddenly manageable!”

- You, hopefully

Here we are reopening the prism module to provide methods on nodes that aren’t templated and are meant as convenience methods.

typed: ignore

Constants

The C extension is the default backend on CRuby.

The version constant is set by reading the result of calling pm_version.

Class Methods

Mirror the Prism.dump API by using the serialization API.

Mirror the Prism.dump_file API by using the serialization API.

Convert the given options into a serialized options string.

Return the value that should be dumped for the command_line option.

Mirror the Prism.lex API by using the serialization API.

Returns a parse result whose value is an array of tokens that closely resembles the return value of Ripper::lex. The main difference is that the ‘:on_sp` token is not emitted.

For supported options, see Prism::parse.

Mirror the Prism.lex_file API by using the serialization API.

This lexes with the Ripper lex. It drops any space events but otherwise returns the same tokens. Raises SyntaxError if the syntax in source is invalid.

Load the serialized AST using the source as a reference into a tree.

Mirror the Prism.parse API by using the serialization API.

Mirror the Prism.parse_comments API by using the serialization API.

Mirror the Prism.parse_failure? API by using the serialization API.

Mirror the Prism.parse_file API by using the serialization API. This uses native strings instead of Ruby strings because it allows us to use mmap when it is available.

Mirror the Prism.parse_file_comments API by using the serialization API. This uses native strings instead of Ruby strings because it allows us to use mmap when it is available.

Mirror the Prism.parse_file_failure? API by using the serialization API.

Mirror the Prism.parse_file_success? API by using the serialization API.

Mirror the Prism.parse_lex API by using the serialization API.

Mirror the Prism.parse_lex_file API by using the serialization API.

Mirror the Prism.parse_stream API by using the serialization API.

Mirror the Prism.parse_success? API by using the serialization API.

Mirror the Prism.profile API by using the serialization API.

Mirror the Prism.profile_file API by using the serialization API.