Function: eshell-parse-index
eshell-parse-index is a byte-compiled function defined in
esh-var.el.gz.
Signature
(eshell-parse-index INDEX)
Documentation
Parse a single INDEX in string form.
If INDEX looks like a number, return that number.
If INDEX looks like "[BEGIN]..[END]", where BEGIN and END look like integers, return a cons cell of BEGIN and END as numbers; BEGIN and/or END can be omitted here, in which case their value in the cons is nil.
Otherwise (including if INDEX is not a string), return the original value of INDEX.
Source Code
;; Defined in /usr/src/emacs/lisp/eshell/esh-var.el.gz
(defun eshell-parse-index (index)
"Parse a single INDEX in string form.
If INDEX looks like a number, return that number.
If INDEX looks like \"[BEGIN]..[END]\", where BEGIN and END look
like integers, return a cons cell of BEGIN and END as numbers;
BEGIN and/or END can be omitted here, in which case their value
in the cons is nil.
Otherwise (including if INDEX is not a string), return
the original value of INDEX."
(cond
((eshell--numeric-string-p index)
(string-to-number index))
((eshell--range-string-p index)
(eshell--string-to-range index))
(t
index)))