Function: semantic-c-reconstitute-token
semantic-c-reconstitute-token is a byte-compiled function defined in
c.el.gz.
Signature
(semantic-c-reconstitute-token TOKENPART DECLMODS TYPEDECL)
Documentation
Reconstitute a token TOKENPART with DECLMODS and TYPEDECL.
This is so we don't have to match the same starting text several times. Optional argument STAR and REF indicate the number of * and & in the typedef.
Source Code
;; Defined in /usr/src/emacs/lisp/cedet/semantic/bovine/c.el.gz
:rawsearchdata allhits)))) ;;)
(defun semantic-c-reconstitute-token (tokenpart declmods typedecl)
"Reconstitute a token TOKENPART with DECLMODS and TYPEDECL.
This is so we don't have to match the same starting text several times.
Optional argument STAR and REF indicate the number of * and & in the typedef."
(when (and (listp typedecl)
(= 1 (length typedecl))
(stringp (car typedecl)))
(setq typedecl (car typedecl)))
(cond ((eq (nth 1 tokenpart) 'variable)
(semantic-tag-new-variable
(car tokenpart)
(or typedecl "int") ;type
nil ;default value (filled with expand)
:constant-flag (if (member "const" declmods) t nil)
:typemodifiers (delete "const" declmods)
)
)
((eq (nth 1 tokenpart) 'function)
;; We should look at part 4 (the arglist) here, and throw an
;; error of some sort if it contains parser errors so that we
;; don't parser function calls, but that is a little beyond what
;; is available for data here.
(let* ((constructor
(and (or (and semantic-c-classname
(string= (car semantic-c-classname)
(car tokenpart)))
(and (stringp (car (nth 2 tokenpart)))
(string= (car (nth 2 tokenpart)) (car tokenpart)))
(nth 10 tokenpart) ; initializers
)
(not (car (nth 3 tokenpart)))))
(fcnpointer (and (> (length (car tokenpart)) 0)
(= (aref (car tokenpart) 0) ?*)))
(fnname (if fcnpointer
(substring (car tokenpart) 1)
(car tokenpart)))
(operator (if (string-match "[a-zA-Z]" fnname)
nil
t))
)
;; The function
(semantic-tag-new-function
fnname
(or typedecl ;type
(cond ((car (nth 3 tokenpart) )
"void") ; Destructors have no return?
(constructor
;; Constructors return an object.
(semantic-tag-new-type
;; name
(or (car semantic-c-classname)
(let ((split (semantic-analyze-split-name-c-mode
(car (nth 2 tokenpart)))))
(if (stringp split) split
(car (last split)))))
;; type
(or (cdr semantic-c-classname)
"class")
;; members
nil
;; parents
nil
))
(t "int")))
;; Argument list can contain things like function pointers
(semantic-c-reconstitute-function-arglist (nth 4 tokenpart))
:constant-flag (if (member "const" declmods) t nil)
:typemodifiers (delete "const" declmods)
:parent (car (nth 2 tokenpart))
:destructor-flag (if (car (nth 3 tokenpart) ) t)
:constructor-flag (if constructor t)
:function-pointer fcnpointer
:pointer (nth 7 tokenpart)
:operator-flag operator
;; Even though it is "throw" in C++, we use
;; `throws' as a common name for things that toss
;; exceptions about.
:throws (nth 5 tokenpart)
;; Reentrant is a C++ thingy. Add it here
:reentrant-flag (if (member "reentrant" (nth 6 tokenpart)) t)
;; A function post-const is funky. Try stuff
:methodconst-flag (if (member "const" (nth 6 tokenpart)) t)
;; prototypes are functions with no body
:prototype-flag (if (nth 8 tokenpart) t)
;; Pure virtual
:pure-virtual-flag (if (eq (nth 8 tokenpart) :pure-virtual-flag) t)
;; Template specifier.
:template-specifier (nth 9 tokenpart))))))