Function: eshell-parse-special-reference

eshell-parse-special-reference is a byte-compiled function defined in esh-arg.el.gz.

Signature

(eshell-parse-special-reference)

Documentation

Parse a special syntax reference, of the form #<args>.

args := type whitespace arbitrary-args | arbitrary-args
type := one of the keys in eshell-special-ref-alist
arbitrary-args := any number of Eshell arguments

If the form has no type, the syntax is parsed as if type were eshell-special-ref-default.

Source Code

;; Defined in /usr/src/emacs/lisp/eshell/esh-arg.el.gz
(defun eshell-parse-special-reference ()
  "Parse a special syntax reference, of the form `#<args>'.

args           := `type' `whitespace' `arbitrary-args' | `arbitrary-args'
type           := one of the keys in `eshell-special-ref-alist'
arbitrary-args := any number of Eshell arguments

If the form has no `type', the syntax is parsed as if `type' were
`eshell-special-ref-default'."
  (let ((here (point))
        (special-ref-types (mapcar #'car eshell-special-ref-alist)))
    (when (and (not eshell-current-argument)
               (not eshell-current-quoted)
               (looking-at (rx-to-string
                            `(seq "#<" (? (group (or ,@special-ref-types))
                                          (+ space)))
                            t)))
      (goto-char (match-end 0))         ; Go to the end of the match.
      (let ((end (eshell-find-delimiter ?\< ?\>))
            (creation-fun (eshell--special-ref-function
                           (match-string 1) 'creation-function)))
        (unless end
          (when (match-beginning 1)
            (goto-char (match-beginning 1)))
          (throw 'eshell-incomplete "#<"))
        (if (eshell-arg-delimiter (1+ end))
            (prog1
                (cons creation-fun
                      (let ((eshell-current-argument-plain t))
                        (eshell-parse-arguments (point) end)))
              (goto-char (1+ end)))
          (ignore (goto-char here)))))))