Function: semantic-format-tag-summarize-semantic-grammar-mode
semantic-format-tag-summarize-semantic-grammar-mode is a byte-compiled
function defined in grammar.el.gz.
Signature
(semantic-format-tag-summarize-semantic-grammar-mode TAG &optional PARENT COLOR)
Documentation
Return a string summarizing TAG.
Optional PARENT is not used.
Optional argument COLOR determines if color is added to the text.
Override semantic-format-tag-summarize in semantic-grammar-mode
buffers.
Source Code
;; Defined in /usr/src/emacs/lisp/cedet/semantic/grammar.el.gz
(define-mode-local-override semantic-format-tag-summarize
semantic-grammar-mode (tag &optional parent color)
"Return a string summarizing TAG.
Optional PARENT is not used.
Optional argument COLOR determines if color is added to the text."
(let ((class (semantic-tag-class tag))
(name (semantic-format-tag-name tag parent color))
(label nil)
(desc nil))
(cond
((eq class 'nonterminal)
(setq label "Nonterminal: "
desc (format
" with %d match lists."
(length (semantic-tag-components tag)))))
((eq class 'keyword)
(setq label "Keyword: ")
(let (summary)
(semantic--find-tags-by-function
(lambda (put)
(unless summary
(setq summary (cdr (assoc "summary"
(semantic-tag-get-attribute
put :value))))))
;; Get `put' tag with TAG name.
(semantic-find-tags-by-name-regexp
(regexp-quote (semantic-tag-name tag))
(semantic-find-tags-by-class 'put (current-buffer))))
(setq desc (concat " = "
(semantic-tag-get-attribute tag :value)
(if summary
(concat " - " (read summary))
"")))))
((eq class 'token)
(setq label "Token: ")
(let ((val (semantic-tag-get-attribute tag :value))
(names (semantic-tag-get-attribute tag :rest))
(type (semantic-tag-type tag)))
(if names
(setq name (mapconcat #'identity (cons name names) " ")))
(setq desc (concat
(if type
(format " <%s>" type)
"")
(if val
(format "%s%S" val (if type " " ""))
"")))))
((eq class 'assoc)
(setq label "Assoc: ")
(let ((val (semantic-tag-get-attribute tag :value))
(type (semantic-tag-type tag)))
(setq desc (concat
(if type
(format " <%s>" type)
"")
(if val
(concat " " (mapconcat #'identity val " "))
"")))))
(t
(setq desc (semantic-format-tag-abbreviate tag parent color))))
(if (and color label)
(setq label (semantic--format-colorize-text label 'label)))
(if (and color label desc)
(setq desc (semantic--format-colorize-text desc 'comment)))
(if label
(concat label name desc)
;; Just a description is the abbreviated version
desc)))