Function: rx--normalise-or-arg

rx--normalise-or-arg is a byte-compiled function defined in rx.el.gz.

Signature

(rx--normalise-or-arg FORM)

Documentation

Normalize the or argument FORM.

Characters become strings, user-definitions and eval forms are expanded, and or forms are normalized recursively.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/rx.el.gz
(defun rx--normalise-or-arg (form)
  "Normalize the `or' argument FORM.
Characters become strings, user-definitions and `eval' forms are expanded,
and `or' forms are normalized recursively."
  (cond ((characterp form)
         (char-to-string form))
        ((and (consp form) (memq (car form) '(or |)))
         (cons (car form) (mapcar #'rx--normalise-or-arg (cdr form))))
        ((and (consp form) (eq (car form) 'eval))
         (rx--normalise-or-arg (rx--expand-eval (cdr form))))
        (t
         (let ((expanded (rx--expand-def form)))
           (if expanded
               (rx--normalise-or-arg expanded)
             form)))))