Replace parser gem with prism for Witchcraft AST parsing #994
+3
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Motivation
The parser gem only supports Ruby syntax up to version 3.3 and will not receive updates for Ruby 3.4+. Starting with Ruby 3.4, Prism is the
official parser built into Ruby itself and is the recommended tool for all AST-related operations going forward.
This change future-proofs the Witchcraft feature by switching to Prism before parser becomes incompatible with newer Ruby versions.
Changes
Technical Notes
Prism provides a translation layer (Prism::Translation::ParserCurrent) that produces Parser::AST::Node objects identical to those from the parser
gem. This means:
Dependencies
The Witchcraft feature now requires prism instead of parser as a direct dependency. Note that unparser still has parser as a transitive
dependency for its AST node classes, but this is handled internally and does not affect Chewy's public API.