Function: semantic-java-expand-tag
semantic-java-expand-tag is a byte-compiled function defined in
java.el.gz.
Signature
(semantic-java-expand-tag TAG)
Documentation
Expand compound declarations found in TAG into separate tags.
TAG contains compound declarations when its class is variable, and
its name is a list of elements (NAME START . END), where NAME is a
compound variable name, and START/END are the bounds of the
corresponding compound declaration.
Source Code
;; Defined in /usr/src/emacs/lisp/cedet/semantic/java.el.gz
(defun semantic-java-expand-tag (tag)
"Expand compound declarations found in TAG into separate tags.
TAG contains compound declarations when its class is `variable', and
its name is a list of elements (NAME START . END), where NAME is a
compound variable name, and START/END are the bounds of the
corresponding compound declaration."
(let* ((class (semantic-tag-class tag))
(elts (semantic-tag-name tag))
dim type dim0 elt clone start end xpand)
(cond
((and (eq class 'function)
(> (cdr (setq dim (semantic-java-dim elts))) 0))
(setq clone (semantic-tag-clone tag (car dim))
xpand (cons clone xpand))
(semantic-tag-put-attribute clone :dereference (cdr dim)))
((eq class 'variable)
(or (consp elts) (setq elts (list (list elts))))
(setq dim (semantic-java-dim (semantic-tag-get-attribute tag :type))
type (car dim)
dim0 (cdr dim))
(while elts
;; For each compound element, clone the initial tag with the
;; name and bounds of the compound variable declaration.
(setq elt (car elts)
elts (cdr elts)
start (if elts (cadr elt) (semantic-tag-start tag))
end (if xpand (cddr elt) (semantic-tag-end tag))
dim (semantic-java-dim (car elt))
clone (semantic-tag-clone tag (car dim))
xpand (cons clone xpand))
(semantic-tag-put-attribute clone :type type)
(semantic-tag-put-attribute clone :dereference (+ dim0 (cdr dim)))
(semantic-tag-set-bounds clone start end)))
((and (eq class 'type) (string-search "." (semantic-tag-name tag)))
;; javap outputs files where the package name is stuck onto the class or interface
;; name. To make this more regular, we extract the package name into a package statement,
;; then make the class name regular.
(let* ((name (semantic-tag-name tag))
(rsplit (nreverse (split-string name "\\." t)))
(newclassname (car rsplit))
(newpkg (mapconcat #'identity (reverse (cdr rsplit)) ".")))
(semantic-tag-set-name tag newclassname)
(setq xpand
(list tag
(semantic-tag-new-package newpkg nil))))
))
xpand))