Function: srecode-create-dictionaries-from-tags

srecode-create-dictionaries-from-tags is a byte-compiled function defined in dictionary.el.gz.

Signature

(srecode-create-dictionaries-from-tags TAGS STATE)

Documentation

Create a dictionary with entries according to TAGS.

TAGS should be in the format produced by the template file grammar. That is

TAGS = (ENTRY_1 ENTRY_2 ...)

where

ENTRY_N = (NAME ENTRY_N_1 ENTRY_N_2 ...) | TAG

where TAG is a semantic tag of class variable. The (NAME ... ) form creates a child dictionary which is stored under the name NAME. The TAG form creates a value entry or section dictionary entry whose name is the name of the tag.

STATE is the current compiler state.

Source Code

;; Defined in /usr/src/emacs/lisp/cedet/srecode/dictionary.el.gz
;;; Higher level dictionary functions
;;
(defun srecode-create-dictionaries-from-tags (tags state)
  "Create a dictionary with entries according to TAGS.

TAGS should be in the format produced by the template file
grammar.  That is

TAGS = (ENTRY_1 ENTRY_2 ...)

where

ENTRY_N = (NAME ENTRY_N_1 ENTRY_N_2 ...) | TAG

where TAG is a semantic tag of class `variable'.  The (NAME ... )
form creates a child dictionary which is stored under the name
NAME.  The TAG form creates a value entry or section dictionary
entry whose name is the name of the tag.

STATE is the current compiler state."
  (let ((dict    (srecode-create-dictionary t))
	(entries (apply #'append
			(mapcar
			 (lambda (entry)
			   (cond
			    ;; Entry is a tag
			    ((semantic-tag-p entry)
			     (let ((name  (semantic-tag-name entry))
				   (value (semantic-tag-variable-default entry)))
			       (list name
				     (if (and (listp value)
					      (= (length value) 1)
					      (stringp (car value)))
					 (car value)
				       value))))

			    ;; Entry is a nested dictionary
			    (t
			     (let ((name    (car entry))
				   (entries (cdr entry)))
			       (list name
				     (srecode-create-dictionaries-from-tags
				      entries state))))))
			 tags))))
    (srecode-dictionary-add-entries
     dict entries state)
    dict)
  )