Fix 'read-sh' to default to current input port

* geesh/parser.scm (read-sh): Make the 'port' argument optional and
default to using 'current-input-port'.
This commit is contained in:
Timothy Sample 2018-07-16 10:03:58 -04:00
parent aabfd76beb
commit 3ec520596c
1 changed files with 3 additions and 2 deletions

View File

@ -776,10 +776,11 @@ bracket."
((? eof-object?) #f)
(code code))))))
(define (read-sh port)
(define* (read-sh #:optional (port #f))
"Read a complete Shell command from @var{port} (or the current input
port if @var{port} is unspecified)."
(let* ((stop? #f)
(let* ((port (or port (current-output-port)))
(stop? #f)
(stop! (lambda () (set! stop? #t)))
(pre-lex (make-lexer port read-sh/bracketed read-sh/backquoted))
(lex (lambda () (if stop? '*eoi* (pre-lex))))