transform: handle ./source.
This commit is contained in:
parent
9d1ed9ef57
commit
74454c2156
|
@ -245,6 +245,8 @@
|
|||
(('compound compound) (transform compound))
|
||||
(('compound compound ...) `(begin ,@(map transform compound)))
|
||||
|
||||
(('command (word (or "." "source")) file-name)
|
||||
`(source ,(transform file-name)))
|
||||
(('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)))
|
||||
|
|
|
@ -59,6 +59,7 @@
|
|||
script-status
|
||||
sequence
|
||||
singlequotes
|
||||
source
|
||||
splice
|
||||
split
|
||||
substitution
|
||||
|
@ -72,6 +73,11 @@
|
|||
(('pipeline command) (pke 'background: `(pipeline+ #f ,command)))
|
||||
(_ term)))
|
||||
|
||||
(define (source file-name)
|
||||
(let* ((string (with-input-from-file file-name read-string))
|
||||
(ast (parse-string string)))
|
||||
(run ast)))
|
||||
|
||||
(define (command . args)
|
||||
(define (exec command)
|
||||
(cond ((procedure? command) command)
|
||||
|
|
Loading…
Reference in New Issue