1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-11 16:20:19 +02:00

(file-commentary): Move make-regexp into

file-commentary so that it's possible to get to the repl prompt when
regexps are not available.
This commit is contained in:
Kevin Ryde 2006-05-27 22:38:53 +00:00
parent 4178042bbc
commit 6cfcc3b916

View file

@ -90,14 +90,21 @@
;;
;; commentary extraction
;;
(define default-in-line-re (make-regexp "^;;; Commentary:"))
(define default-after-line-re (make-regexp "^;;; Code:"))
(define default-scrub (let ((dirt (make-regexp "^;+")))
(lambda (line)
(let ((m (regexp-exec dirt line)))
(if m (match:suffix m) line)))))
(define (file-commentary filename . cust) ; (IN-LINE-RE AFTER-LINE-RE SCRUB)
;; These are constants but are not at the top level because the repl in
;; boot-9.scm loads session.scm which in turn loads this file, and we want
;; that to work even even when regexps are not available (ie. make-regexp
;; doesn't exist), as for instance is the case on mingw.
;;
(define default-in-line-re (make-regexp "^;;; Commentary:"))
(define default-after-line-re (make-regexp "^;;; Code:"))
(define default-scrub (let ((dirt (make-regexp "^;+")))
(lambda (line)
(let ((m (regexp-exec dirt line)))
(if m (match:suffix m) line)))))
;; fixme: might be cleaner to use optargs here...
(let ((in-line-re (if (> 1 (length cust))
default-in-line-re