Function: rx--translate-rep

rx--translate-rep is a byte-compiled function defined in rx.el.gz.

Signature

(rx--translate-rep OP-STRING GREEDY BODY)

Documentation

Translate a repetition; OP-STRING is one of "*", "+" or "?".

GREEDY is a boolean. Return (REGEXP . PRECEDENCE).

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/rx.el.gz
(defun rx--translate-rep (op-string greedy body)
  "Translate a repetition; OP-STRING is one of \"*\", \"+\" or \"?\".
GREEDY is a boolean.  Return (REGEXP . PRECEDENCE)."
  (let ((operand (rx--translate-seq body)))
    (if (car operand)
        (cons (append (rx--atomic-regexp operand)
                      (list (concat op-string (unless greedy "?"))))
              ;; The result has precedence seq to avoid (? (* "a")) -> "a*?"
              'seq)
      operand)))