Closed mnewt closed 6 years ago
Addresses #8
I think a proper parser is a way to go. I haven't looked too deeply into this yet. If we could extend the clojure reader that would the best. Otherwise some hybrid approach to have parser for the command mode and hand the the clojure parts to the reader.
I think the string based approaches might not be viable. It is not hard to come up with counter examples which blow up like: echo (str "(") ~
.
I've been collecting forms that are broken and would be fixed by improved reader, I created an issue so where we can track it https://github.com/dundalek/closh/issues/39
Withdrawing this in favor of a more considered approach
Work in progress
The idea is to parse the string straight from
readline
and make modifications before the reader touches it. A basic assumption is that we want to expand all tildes outside of parens but leave everything inside parens untouched. This seems to me to be what a user would expect.Examples:
@dundalek I have some questions for you:
handle-line
the right place from which to do this? Is that going to be in the code path in all scenarios where we want tildes expanded?expand-tilde
ever be successfully called? Should it be factored out?TODO: