Function: rng-normalize-group-list

rng-normalize-group-list is a byte-compiled function defined in rng-match.el.gz.

Signature

(rng-normalize-group-list IPATTERNS)

Documentation

Normalize a list containing members of a group.

Expands nested groups, removes empty members, handles notAllowed. Returns a pair whose car says whether the list is nullable and whose cdr is the normalized list.

Source Code

;; Defined in /usr/src/emacs/lisp/nxml/rng-match.el.gz
(defun rng-normalize-group-list (ipatterns)
  "Normalize a list containing members of a group.
Expands nested groups, removes empty members, handles notAllowed.
Returns a pair whose car says whether the list is nullable and whose
cdr is the normalized list."
  (let ((nullable t)
	(result nil)
	member)
    (while ipatterns
      (setq member (car ipatterns))
      (setq ipatterns (cdr ipatterns))
      (when nullable
	(setq nullable (rng--ipattern-nullable member)))
      (cond ((eq (rng--ipattern-type member) 'group)
	     (setq result
		   (nconc (reverse (rng--ipattern-child member))
			  result)))
	    ((eq member rng-not-allowed-ipattern)
	     (setq result (list rng-not-allowed-ipattern))
	     (setq ipatterns nil))
	    ((not (eq member rng-empty-ipattern))
	     (setq result (cons member result)))))
    (cons nullable (nreverse result))))