Function: eshell-parse-pipeline
eshell-parse-pipeline is a byte-compiled function defined in
esh-cmd.el.gz.
Signature
(eshell-parse-pipeline TERMS)
Documentation
Parse a pipeline from TERMS, return the appropriate Lisp forms.
Source Code
;; Defined in /usr/src/emacs/lisp/eshell/esh-cmd.el.gz
(defun eshell-parse-pipeline (terms)
"Parse a pipeline from TERMS, return the appropriate Lisp forms."
(let* (eshell--sep-terms
(bigpieces (eshell-separate-commands terms "\\(&&\\|||\\)"
nil 'eshell--sep-terms))
(bp bigpieces)
(results (list t))
final)
(while bp
(let ((subterms (car bp)))
(let* ((pieces (eshell-separate-commands subterms "|"))
(p pieces))
(while p
(let ((cmd (car p)))
(run-hook-with-args 'eshell-pre-rewrite-command-hook cmd)
(setq cmd (run-hook-with-args-until-success
'eshell-rewrite-command-hook cmd))
(let ((eshell--cmd cmd))
(run-hook-with-args 'eshell-post-rewrite-command-hook
'eshell--cmd)
(setq cmd eshell--cmd))
(setcar p (funcall eshell-post-rewrite-command-function cmd)))
(setq p (cdr p)))
(nconc results
(list
(if (<= (length pieces) 1)
(car pieces)
(cl-assert (not eshell-in-pipeline-p))
`(eshell-execute-pipeline (quote ,pieces))))))
(setq bp (cdr bp))))
;; `results' might be empty; this happens in the case of
;; multi-line input
(setq results (cdr results)
results (nreverse results)
final (car results)
results (cdr results)
eshell--sep-terms (nreverse eshell--sep-terms))
(while results
(cl-assert (car eshell--sep-terms))
(setq final (eshell-structure-basic-command
'if (string= (car eshell--sep-terms) "&&") "if"
`(eshell-protect ,(car results))
`(eshell-protect ,final))
results (cdr results)
eshell--sep-terms (cdr eshell--sep-terms)))
final))