schemedoc own parser load.scm - 2
This commit is contained in:
parent
5496960c82
commit
831b1d9e94
|
@ -1,3 +1,4 @@
|
|||
version 0.1
|
||||
* 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
|
||||
|
|
|
@ -40,20 +40,17 @@
|
|||
(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)
|
||||
(define directoriesl (schemedoc-get-env-list SCHEMEDOCDIR))
|
||||
(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)))
|
||||
)
|
||||
(display "Your search is in the variable SCHEMEDOCITEMS list.")(newline)
|
||||
(display "You can regexp it if you want.")(newline)
|
||||
|
||||
|
||||
|
||||
;;(for-each directory-files directoriesl)
|
||||
|
|
|
@ -85,15 +85,29 @@
|
|||
(define (schemedoc-parser-grep filename)
|
||||
(let ((le (schemedoc-parser-doc filename))
|
||||
(line "")
|
||||
(lines '()))
|
||||
(headline "")
|
||||
(itemlines '())
|
||||
(itemtext "")
|
||||
(itemtexts '())
|
||||
)
|
||||
(do ((l le (cdr l)))
|
||||
((eof-object? l)0)
|
||||
(if (and (eq? (car l) #\newline)(string<=? "=item" line))
|
||||
(begin
|
||||
(set! lines (append lines (list line)))
|
||||
(set! line "")))
|
||||
(set! line (string-append line (string (car l)))))
|
||||
(for-each display lines)))
|
||||
(cond ((and (eq? (car l) #\newline)(string<=? "=item" line))
|
||||
(set! itemlines (append itemlines (list line)))
|
||||
(set! line "")
|
||||
(set! itemtexts (append itemtexts (list itemtext)))
|
||||
(set! itemtext ""))
|
||||
((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)
|
||||
(let ((directory "")
|
||||
|
|
Loading…
Reference in New Issue