Function: match-nested-urlmaps

Source

(defun match-nested-urlmaps (request-url url-nested-maps &key (nested? nil))
  (flet ((match-rec (map &key nested?)
	   (with-slots (url-regex nested-map-name) map
	     (awhen (=~ url-regex request-url $a)
	       (match-url-dispatch it (get-urlmap nested-map-name) :nested? nested?)))))
    (dolist (map (butlast url-nested-maps))
      (awhen2 (match-rec map :nested? t)
	(return-from match-nested-urlmaps (values it t))))
    ;; tail-recurse to the last nested urlmap
    (aand (last1 url-nested-maps) (match-rec it :nested? nested?))))
Source Context