Skip to content

Add the ability to use the Prism parser#66

Merged
k-tsj merged 1 commit intoruby:masterfrom
kddnewton:prism
Apr 22, 2026
Merged

Add the ability to use the Prism parser#66
k-tsj merged 1 commit intoruby:masterfrom
kddnewton:prism

Conversation

@kddnewton
Copy link
Copy Markdown
Contributor

@kddnewton kddnewton commented Mar 3, 2026

Previously, this relied on Ripper exclusively. This commit adds the ability to use the Prism parser instead. This enables power_assert to handle slightly more syntax, and to not get confused on lines that are lacking column information and have multiple of the same token. It is also faster, when examining runs times of the ident extraction methods.

I have left Ripper as the default parser, as that would require more of a discussion going forward. But switching would yield the above benefits, as well as allowing this to run on other Rubies besides just CRuby.

cc @Earlopain

Previously, this relied on Ripper exclusively. This commit adds the
ability to use the Prism parser instead. This enables power_assert
to handle slightly more syntax, and to not get confused on lines
that are lacking column information and have multiple of the same
token. It is also faster, when examining runs times of the ident
extraction methods.

I have left Ripper as the default parser, as that would require
more of a discussion going forward. But switching would yield the
above benefits, as well as allowing this to run on other Rubies
besides just CRuby.
@kddnewton kddnewton mentioned this pull request Mar 15, 2026
18 tasks
@k-tsj k-tsj merged commit dab72a7 into ruby:master Apr 22, 2026
37 checks passed
@k-tsj
Copy link
Copy Markdown
Member

k-tsj commented Apr 22, 2026

Sorry for the late response.
Looks good, so I've merged the PR.

BTW, power_assert doesn't really promote it, but it does have a configure method. (ref.
https://github.com/ruby/power_assert/blob/master/lib/power_assert/colorize.rb)
It'd be nice if we could use that to switch parsers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants