transform: translate script to begin or command.

This commit is contained in:
Jan Nieuwenhuizen 2018-11-17 08:43:46 +01:00
parent b89ca17134
commit df73d5421f
2 changed files with 5 additions and 4 deletions

View File

@ -228,6 +228,10 @@
(define (transform o)
(match o
(('script command) (transform command))
(('script command ...) `(begin ,@(map transform command)))
(('command word ... ('io-redirect ('io-here "<<" ('io-here-document string))))
`(pipeline (cut display ,string) (command ,@word)))
(('command word ... ('io-redirect filedes ... ('io-file ">" file-name)))
@ -238,5 +242,6 @@
(else (error (format #f "TODO: output to filedes=~a\n" filedes)))))
(('command word ... ('io-redirect ('io-file "<" file-name)))
`(with-input-from-file ,file-name (command ,@word)))
((h t ...) (map transform o))
(_ o)))

View File

@ -57,7 +57,6 @@
or-terms
pipeline
run
script
script-status
sequence
singlequotes
@ -147,9 +146,6 @@
(define (script-status)
((compose string->number variable) "?"))
(define (script . o)
o)
(define (for-clause name sequence body)
(for-each (lambda (value)
(assignment name value)