schemedoc regexps - 1

This commit is contained in:
erana 2012-01-17 17:05:21 +09:00
parent 737bb17c5f
commit 92499b2635
1 changed files with 13 additions and 5 deletions

View File

@ -26,23 +26,31 @@
;;; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF ;;; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
;;; THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ;;; 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) (define (sod regexp filename)
(let ((in (open-input-file filename))) (let ((in (open-input-file filename)))
(let ((contents "")) (let ((contents ""))
(do ((s (read-char in)(read-char in))) (do ((s (read-char in)(read-char in)))
((eof-object? s)return) ((eof-object? s) contents))
(regexp contents))))) (string-match regexp contents))))
(define (schemedoc-print-doc filename) (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))) (for-each display l)))
(define (schemedoc-print-doc-to-file filename outfilename) (define (schemedoc-print-doc-to-file filename outfilename)
(let ((out (open-output-file 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) (define (display-rec ll)
(do ((e ll (cdr e))) (do ((e ll (cdr e)))
((null? e)0) ((null? e)0)