Note: This integration is not finished, and therefore still has many inconsistencies with Ripper. If you’d like to help out, pull requests would be greatly appreciated!

This class is meant to provide a compatibility layer between prism and Ripper. It functions by parsing the entire tree first and then walking it and executing each of the Ripper callbacks as it goes.

This class is going to necessarily be slower than the native Ripper API. It is meant as a stopgap until developers migrate to using prism. It is also meant as a test harness for the prism parser.

To use this class, you treat ‘Prism::RipperCompat` effectively as you would treat the `Ripper` class.


The source that is being parsed.


The current line number of the parser.


The current column number of the parser.

Class Methods

Create a new RipperCompat object with the given source.

This is a convenience method that runs the SexpBuilderPP subclass parser.

This is a convenience method that runs the SexpBuilder subclass parser.

Instance Methods

This method is responsible for updating lineno and column information to reflect the current node.

This method could be drastically improved with some caching on the start of every line, but for now it’s good enough.

True if the parser encountered an error during parsing.

Parse the source and return the result.

Lazily initialize the parse result.

Visit a CallNode node.

Visit a FloatNode node.

Visit a ImaginaryNode node.

Visit an IntegerNode node.

Visit a ProgramNode node.

Visit a RationalNode node.

Visit a StatementsNode node.