Skip to content

Use Prism::ParseResult#continuable? if possible#1184

Open
tompng wants to merge 1 commit intoruby:masterfrom
tompng:prism_termination_check
Open

Use Prism::ParseResult#continuable? if possible#1184
tompng wants to merge 1 commit intoruby:masterfrom
tompng:prism_termination_check

Conversation

@tompng
Copy link
Member

@tompng tompng commented Mar 14, 2026

Prism-head have Prism::ParseResult#continuable? ruby/prism#3530 ruby/prism#3954 (It's not released yet though)

RubyLex#check_code_state will use this new API to classify syntax errors.
When using older Prism, IRB::RubyLex fallbacks to the legacy error message based heuristics. This heuristic was fragile but since we're only using it in Prism <= 1.9.0, error message won't change in the future.

return :valid if result.success?
if result.success?
:valid
elsif result.respond_to?(:continuable?)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add a comment mentioning that we can simplify the conditions when we bumped Prism to a version that continuable? will always be present.

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