diff --git a/src/Makefile b/src/Makefile index c71d1ff..9ce79b5 100644 --- a/src/Makefile +++ b/src/Makefile @@ -291,7 +291,7 @@ util-io.o: util-io.import.scm util-io.import.scm: $(UTIL-IO-SOURCES) UTIL-PARSER-SOURCES=util-parser.scm testing.import.scm \ - duck.import.scm + duck.import.scm racket-kwargs.import.scm util-parser.o: util-parser.import.scm util-parser.import.scm: $(UTIL-PARSER-SOURCES) diff --git a/src/dokuwiki.scm b/src/dokuwiki.scm index f57a85e..40c2585 100644 --- a/src/dokuwiki.scm +++ b/src/dokuwiki.scm @@ -54,8 +54,7 @@ (users '())) (if (null? lines) users - (let ((line (parser-preprocess-line (car lines)))) - (print line) + (let ((line (parser-preprocess-line (car lines) #:strip-comments? #f))) (if (equal? line "") (loop (cdr lines) users) diff --git a/src/util-parser.scm b/src/util-parser.scm index 789827f..40f49ac 100644 --- a/src/util-parser.scm +++ b/src/util-parser.scm @@ -39,11 +39,12 @@ member file parsers. All functions are UTF-8 aware.") (import scheme (chicken base) + racket-kwargs testing) ;; Pass 0: Removes any comments and removes any leading and trailing ;; whitespace. - (define/doc (parser-preprocess-line line) + (define*/doc (parser-preprocess-line line #:strip-comments? (strip-comments? #t)) ("* ```line``` - a string with contents of one source line If the input ```line``` contains the ```#``` character, the rest of @@ -62,7 +63,8 @@ Returns a string representing the preprocessed line.") (ploop (add1 pidx))))) (hpos (let hloop ((hidx ppos)) (if (or (= hidx llen) - (eq? (string-ref line hidx) #\#)) + (and strip-comments? + (eq? (string-ref line hidx) #\#))) hidx (hloop (add1 hidx))))) (spos (let sloop ((sidx (sub1 hpos)))