Function: reftex-parse-args

reftex-parse-args is a byte-compiled function defined in reftex.el.gz.

Signature

(reftex-parse-args MACRO)

Documentation

Return a list of MACRO name, nargs, arg-nr.

arg-nr is label and a list of optional argument indices.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/reftex.el.gz
(defun reftex-parse-args (macro)
  "Return a list of MACRO name, nargs, arg-nr.
arg-nr is label and a list of optional argument indices."
  (if (string-match "[[{]\\*?[]}]" macro)
      (progn
        (let ((must-match (substring macro 0 (match-beginning 0)))
              (args (substring macro (match-beginning 0)))
              opt-list nlabel (cnt 0))
          (while (string-match "\\`[[{]\\(\\*\\)?[]}]" args)
            (incf cnt)
            (when (eq ?\[ (string-to-char args))
              (push cnt opt-list))
            (when (and (match-end 1)
                       (not nlabel))
              (setq nlabel cnt))
            (setq args (substring args (match-end 0))))
          (list must-match cnt nlabel opt-list)))
    nil))