From 92499b26356ae88a94b38e95cda54b372cfd8d62 Mon Sep 17 00:00:00 2001 From: erana Date: Tue, 17 Jan 2012 17:05:21 +0900 Subject: [PATCH] schemedoc regexps - 1 --- scsh/schemedoc/schemedoc.scm | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/scsh/schemedoc/schemedoc.scm b/scsh/schemedoc/schemedoc.scm index 5953413..315998c 100644 --- a/scsh/schemedoc/schemedoc.scm +++ b/scsh/schemedoc/schemedoc.scm @@ -26,23 +26,31 @@ ;;; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF ;;; THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -(define regexp "");;FIXME grepper for comments +;;FIXME grepper for comments +;;FIXME use make-regexp in a record +(define sod-regexp1 (rx (| "=item"))) (define (sod regexp filename) (let ((in (open-input-file filename))) (let ((contents "")) (do ((s (read-char in)(read-char in))) - ((eof-object? s)return) - (regexp contents))))) + ((eof-object? s) contents)) + (string-match regexp contents)))) (define (schemedoc-print-doc filename) - (let ((l (list (sod regexp filename)))) + (let ((l (list (sod (if (regexp? sod-regexp1) + sod-regexp1 + (rx (""))) + filename)))) (for-each display l))) (define (schemedoc-print-doc-to-file filename outfilename) (let ((out (open-output-file outfilename))) - (let ((l (list (sod regexp filename)))) + (let ((l (list (sod (if (regexp? sod-regexp1) + sod-regexp1 + (rx (""))) + filename)))) (define (display-rec ll) (do ((e ll (cdr e))) ((null? e)0)