1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-02 21:10:27 +02:00

Add commentary; nfc.

This commit is contained in:
Thien-Thi Nguyen 2002-02-08 03:20:56 +00:00
parent cb8aa0ead8
commit 3ae7cde94f

View file

@ -39,6 +39,26 @@
;;;; whether to permit this exception to apply to your modifications.
;;;; If you do not wish that, delete this exception notice.
;;;;
;;; Commentary:
;; These procedures are exported:
;; (match:count match)
;; (match:string match)
;; (match:prefix match)
;; (match:suffix match)
;; (regexp-match? match)
;; (regexp-quote string)
;; (match:start match . submatch-num)
;; (match:end match . submatch-num)
;; (match:substring match . submatch-num)
;; (string-match pattern str . start)
;; (regexp-substitute port match . items)
;; (fold-matches regexp string init proc . flags)
;; (list-matches regexp string . flags)
;; (regexp-substitute/global port regexp string . items)
;;; Code:
;;;; POSIX regex support functions.
@ -83,16 +103,16 @@
(loop (+ 1 i)))
(else #f)))))
(define (regexp-quote regexp)
(define (regexp-quote string)
(call-with-output-string
(lambda (p)
(let loop ((i 0))
(and (< i (string-length regexp))
(and (< i (string-length string))
(begin
(case (string-ref regexp i)
(case (string-ref string i)
((#\* #\. #\( #\) #\+ #\? #\\ #\^ #\$ #\{ #\})
(write-char #\\ p)))
(write-char (string-ref regexp i) p)
(write-char (string-ref string i) p)
(loop (1+ i))))))))
(define (match:start match . args)