Function: hif-parse-macro-arglist
hif-parse-macro-arglist is a byte-compiled function defined in
hideif.el.gz.
Signature
(hif-parse-macro-arglist STR)
Documentation
Parse argument list formatted as ( arg1 [ , argn] [,] [...] ).
The ... is also included. Return a list of the arguments, if ... exists the
first arg will be hif-etc.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/hideif.el.gz
(defun hif-parse-macro-arglist (str)
"Parse argument list formatted as `( arg1 [ , argn] [,] [...] )'.
The `...' is also included. Return a list of the arguments, if `...' exists the
first arg will be `hif-etc'."
(let* ((hif-simple-token-only nil) ; Dynamic binding var for `hif-tokenize'
(tokenlist
(cdr (hif-tokenize
(- (point) (length str)) (point)))) ; Remove `hif-lparen'
etc result token prevtok prev2tok)
(while (not (eq (setq prev2tok prevtok
prevtok token
token (pop tokenlist)) 'hif-rparen))
(cond
((eq token 'hif-etc)
;; GNU type "..." or C99 type
(setq etc (if (or (null prevtok)
(eq prevtok 'hif-comma)
(and (eq prevtok 'hif-space)
(eq prev2tok 'hif-comma)))
'c99 t)))
((eq token 'hif-comma)
(if etc
(error "Syntax error: no comma allowed after `...'")))
(t
(push token result))))
(setq result (nreverse result))
(cond
((eq etc 'c99)
(cons 'hif-etc-c99 result))
((eq etc t)
(cons 'hif-etc result))
(t
result))))