Skip to content

Conversation

@sei40kr
Copy link
Contributor

@sei40kr sei40kr commented Jan 28, 2026

Summary

  • Reorganize ruby-prism crate to mirror lib/prism/ structure
  • Extract types into separate modules:
    • node.rs: NodeList, ConstantList, Integer (like node.rb)
    • parse_result/mod.rs: ParseResult, Location (like parse_result.rb)
    • parse_result/comments.rs: Comment, MagicComment (like parse_result/comments.rb)
    • parse_result/diagnostics.rs: Diagnostic (like parse_result/errors.rb)

Verification

This is a pure structural refactoring with no behavioral changes. The following checks were performed to ensure no regressions:

Public API diff (using cargo-public-api)

Removed items from the public API: (none)
Changed items in the public API:   (none)
Added items to the public API:     (none)

Test case names comparison

All 23 test cases preserved with identical names before and after refactoring.

Documentation comments comparison

All doc comments match between before and after (excluding a typo fix: arbitarilyarbitrarily).

Test execution

All 23 tests pass.

Test plan

  • cargo test -p ruby-prism passes (23 tests)
  • cargo doc -p ruby-prism generates without warnings
  • Public API unchanged (verified with cargo-public-api diff)
  • Test case names unchanged
  • Doc comments unchanged

🤖 Generated with Claude Code

@sei40kr sei40kr changed the title refactor: modularize rust bindings following Ruby's structure [rust] Modularize ruby-prism crate following Ruby's lib/prism structure Jan 28, 2026
@kddnewton
Copy link
Collaborator

Why?

@sei40kr
Copy link
Contributor Author

sei40kr commented Jan 28, 2026

@kddnewton
Compared to the Ruby binding, the Rust binding has many missing APIs.
I want to add them, but if I submit PRs in parallel, it will almost certainly cause conflicts.
Furthermore, adding tests and APIs will inevitably make lib.rs huge, making it necessary to split it sooner or later.

@kddnewton
Copy link
Collaborator

@sei40kr okay, makes sense. Please make lint pass.

Reorganize ruby-prism crate to mirror lib/prism/ structure:

- node.rs: NodeList, ConstantList, Integer (like node.rb)
- parse_result/mod.rs: ParseResult, Location (like parse_result.rb)
- parse_result/comments.rs: Comment, MagicComment (like parse_result/comments.rb)
- parse_result/diagnostics.rs: Diagnostic (like parse_result/errors.rb)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@sei40kr sei40kr force-pushed the refactor/rust-bindings-modularize branch from 3dd2970 to 89fce05 Compare January 28, 2026 16:21
@sei40kr
Copy link
Contributor Author

sei40kr commented Jan 28, 2026

@kddnewton My bad, fixed.

@kddnewton kddnewton merged commit dd27399 into ruby:main Jan 29, 2026
66 checks passed
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