schemedoc own parser load.scm - 2

This commit is contained in:
erana 2012-01-17 23:32:15 +09:00
parent 5496960c82
commit 831b1d9e94
3 changed files with 35 additions and 23 deletions

View File

@ -1,3 +1,4 @@
version 0.1 version 0.1
* printing a regexp on a filename * printing a regexp on a filename
* explode (file to list) function for file contents * file to list function for file contents in chars
* load.scm script

View File

@ -40,20 +40,17 @@
(exit) ;; NOTE exit (exit) ;; NOTE exit
))) )))
(define SCHEMEDOCITEMS '())
(let ((directoriesl (schemedoc-get-env-list SCHEMEDOCDIR)))
(do ((l directoriesl (cdr l)))
((null? l)
0)
(display (directory-files (car l)) )
(do ((l2 (directory-files (car l)) (cdr l2)))
((null? l2)0)
(set! SCHEMEDOCITEMS (append SCHEMEDOCITEMS (list (schemedoc-parser-grep (car l2)))))
)))
;;(for-each schemedoc-parser-grep SCHEMEDOCDIR) (display "Your search is in the variable SCHEMEDOCITEMS list.")(newline)
(define directoriesl (schemedoc-get-env-list SCHEMEDOCDIR)) (display "You can regexp it if you want.")(newline)
(for-each display directoriesl)
(display directoriesl)
(do ((l directoriesl (cdr l)))
((null? l)
0)
(display (directory-files (car l)) )
(do ((l2 (directory-files (car l)) (cdr l2)))
((null? l2)0)
(schemedoc-parser-grep (car l2)))
)
;;(for-each directory-files directoriesl)

View File

@ -85,15 +85,29 @@
(define (schemedoc-parser-grep filename) (define (schemedoc-parser-grep filename)
(let ((le (schemedoc-parser-doc filename)) (let ((le (schemedoc-parser-doc filename))
(line "") (line "")
(lines '())) (headline "")
(itemlines '())
(itemtext "")
(itemtexts '())
)
(do ((l le (cdr l))) (do ((l le (cdr l)))
((eof-object? l)0) ((eof-object? l)0)
(if (and (eq? (car l) #\newline)(string<=? "=item" line)) (cond ((and (eq? (car l) #\newline)(string<=? "=item" line))
(begin (set! itemlines (append itemlines (list line)))
(set! lines (append lines (list line))) (set! line "")
(set! line ""))) (set! itemtexts (append itemtexts (list itemtext)))
(set! line (string-append line (string (car l))))) (set! itemtext ""))
(for-each display lines))) ((and (eq? (car l) #\newline)(string<=? "=head" line))
(set! headline line)
(set! line ""))
;;((eq? (car l) #\newline)
)
(set! line (string-append line (string (car l))))
(set! itemtext (string-append itemtext (string (car l))))
)
itemtexts
))
(define (schemedoc-get-env-list SCHEMEDOCDIR) (define (schemedoc-get-env-list SCHEMEDOCDIR)
(let ((directory "") (let ((directory "")