Function: wisent-grammar-nonterminals
wisent-grammar-nonterminals is a byte-compiled function defined in
grammar.el.gz.
Signature
(wisent-grammar-nonterminals)
Documentation
Return the list form of nonterminal definitions.
Source Code
;; Defined in /usr/src/emacs/lisp/cedet/semantic/wisent/grammar.el.gz
(defun wisent-grammar-nonterminals ()
"Return the list form of nonterminal definitions."
(let ((nttags (semantic-find-tags-by-class
'nonterminal (current-buffer)))
;; Setup the cache of macro definitions.
(wisent--grammar-macros (semantic-grammar-macros))
rltags nterms rules rule elems elem actn sexp prec)
(while nttags
(setq rltags (semantic-tag-components (car nttags))
rules nil)
(while rltags
(setq elems (semantic-tag-get-attribute (car rltags) :value)
prec (semantic-tag-get-attribute (car rltags) :prec)
actn (semantic-tag-get-attribute (car rltags) :expr)
rule nil)
(when elems ;; not an EMPTY rule
(while elems
(setq elem (car elems)
elems (cdr elems))
(setq elem (if (consp elem) ;; mid-rule action
(wisent-grammar-expand-macros (read (car elem)))
(semantic-grammar-item-value elem)) ;; item
rule (cons elem rule)))
(setq rule (nreverse rule)))
(if prec
(setq prec (vector (semantic-grammar-item-value prec))))
(if actn
(setq sexp (wisent-grammar-expand-macros (read actn))))
(setq rule (if actn
(if prec
(list rule prec sexp)
(list rule sexp))
(if prec
(list rule prec)
(list rule))))
(setq rules (cons rule rules)
rltags (cdr rltags)))
(setq nterms (cons (cons (intern (semantic-tag-name (car nttags)))
(nreverse rules))
nterms)
nttags (cdr nttags)))
(nreverse nterms)))