Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

Use rustyline for REPL #372

Open
jyn514 opened this issue Apr 18, 2020 · 2 comments · May be fixed by #515
Open

Use rustyline for REPL #372

jyn514 opened this issue Apr 18, 2020 · 2 comments · May be fixed by #515
Labels
ui Helpful for user experience when seeing error or warnings

Comments

@jyn514
Copy link
Owner

jyn514 commented Apr 18, 2020

Currently the 'repl' is reading from stdin if a filename isn't given. I've had a couple different people tell me this is confusing on their first use. It would be nice to have a proper repl with line-by-line feedback as well as line editing. @repnop suggested https://docs.rs/rustyline/

https://github.com/repnop/bismite/blob/c8354f8534a7488ac25c92f3d8497149cce46004/repl/src/repl.rs#L190

@jyn514 jyn514 added the ui Helpful for user experience when seeing error or warnings label Apr 18, 2020
@repnop
Copy link
Contributor

repnop commented Apr 18, 2020

I handle multiline input by checking to see if the parser runs into EOF and building up the code in the REPL until it successfully parses, then do a couple more checks. I'm not sure how elegant this is in the long run and it makes for a bit of a couple weird edge cases -- for instance, expressions need to return successfully on EOF so the REPL can properly evaluate them. I'm not sure if this is a problem for you (allowing arbitrary expression evaluation without making it a statement) but I figured it might be worth noting 👍

@repnop

This comment has been minimized.

@Stupremee Stupremee linked a pull request Sep 8, 2020 that will close this issue
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
ui Helpful for user experience when seeing error or warnings
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants