sasagawa888 / eisl

ISLisp interpreter/compiler
Other
272 stars 22 forks source link

eislformat program #196

Closed lassik closed 2 years ago

lassik commented 2 years ago

Can you expose formatter.lsp as a standalone program, runnable as a Unix shell command?

Something like: eislformat < unformatted-code.lsp > formatted-code.lsp with error/warning messages to stderr.

If it supports formatting from stdin to stdout, it's easy to add Emacs support.

sasagawa888 commented 2 years ago

It's difficult to make it standalone, but I think I can change the file output to standard output. It is a method to add an option to the formatter function and set the output destination to standard output. I will try it.

sasagawa888 commented 2 years ago

I improved the formatter. If you give the 'stdio symbol instead of file, the input/output will be the standard input/output. Will this work? e.g.

> (formatter 'stdio)
(defun foo (x) (if (= x 1) 2 3))
(defun foo (x)
    (if (= x 1)
        2
        3 ))
^C
Easy-ISLisp Ver2.60
>