Skip to content

Add repl sub-command#3580

Merged
kddnewton merged 1 commit into
ruby:mainfrom
Shopify:amomchilov/repl
Jun 11, 2025
Merged

Add repl sub-command#3580
kddnewton merged 1 commit into
ruby:mainfrom
Shopify:amomchilov/repl

Conversation

@amomchilov

@amomchilov amomchilov commented Jun 9, 2025

Copy link
Copy Markdown
Contributor

I built this for myself, and found it really useful for faster debugging.

Example usage:

$ bin/prism repl
Prism> 1
@ IntegerNode (location: (1,0)-(1,1))
├── flags: newline, static_literal, decimal
└── value: 1

Prism> 1 +
#<Prism::ParseError @type=:expect_expression_after_operator @message="unexpected end-of-input; expected an expression after the operator" @location=#<Prism::Location @start_offset=3 @length=0 start_line=1> @level=:syntax>
#<Prism::ParseError @type=:unexpected_token_close_context @message="unexpected end-of-input, assuming it is closing the parent top level context" @location=#<Prism::Location @start_offset=3 @length=0 start_line=1> @level=:syntax>
@ CallNode (location: (1,0)-(1,3))
├── flags: newline
├── receiver:
│   @ IntegerNode (location: (1,0)-(1,1))
│   ├── flags: static_literal, decimal
│   └── value: 1
├── call_operator_loc: ∅
├── name: :+
├── message_loc: (1,2)-(1,3) = "+"
├── opening_loc: ∅
├── arguments:
│   @ ArgumentsNode (location: (1,2)-(1,3))
│   ├── flags: ∅
│   └── arguments: (length: 1)
│       └── @ MissingNode (location: (1,2)-(1,3))
│           └── flags: ∅
├── closing_loc: ∅
└── block: ∅

(Well really, it's more a read-parse-print-loop, "RPPL", not "REPL" 😛)

@kddnewton kddnewton left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Sure!

@kddnewton
kddnewton merged commit 4ef6e9f into ruby:main Jun 11, 2025
56 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