Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move input processing out of RubyLex #683

Merged
merged 3 commits into from
Aug 21, 2023
Merged

Conversation

st0012
Copy link
Member

@st0012 st0012 commented Aug 16, 2023

This PR moves the remaining input processing logic from RubyLex to Irb. It will enable a few refactors:

  1. Now that RubyLex's @context is only used to get local variables, we can remove it completely by passing locals as arguments. I will open a PR for this after this is merged.
  2. Since Irb controls a large part of an input's lifecycle (from reading to pre-evaluation), we can shorten the process or at least make it easier to understand.

In addition to the refactor, I also added/improved a few test cases to cover what we were missing.

There are a few places that also need to check symbol aliases before
`Irb#eval_input`. But since the current command test skip them, we
don't have test coverage on them.
@st0012 st0012 requested a review from a team August 16, 2023 22:58
@st0012 st0012 self-assigned this Aug 16, 2023
@st0012 st0012 changed the title Simplify input processing flow Move input processing out of RubyLex Aug 17, 2023
@st0012 st0012 force-pushed the simplify-input-processing-flow branch from 3ef9fed to 9d34cde Compare August 17, 2023 11:02
This will save RubyLex from knowning information about commands and aliases.
@tompng tompng merged commit 69cb5b5 into master Aug 21, 2023
47 checks passed
@tompng tompng deleted the simplify-input-processing-flow branch August 21, 2023 15:42
matzbot pushed a commit to ruby/ruby that referenced this pull request Aug 21, 2023
(ruby/irb#683)

* Add a test case for Ctrl-C handling

* Test symbol aliases with integration tests

There are a few places that also need to check symbol aliases before
`Irb#eval_input`. But since the current command test skip them, we
don't have test coverage on them.

* Move each_top_level_statement and readmultiline to Irb

This will save RubyLex from knowning information about commands and aliases.

ruby/irb@69cb5b5615
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants