diff options
Diffstat (limited to 'test-fff.scm')
-rw-r--r-- | test-fff.scm | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test-fff.scm b/test-fff.scm new file mode 100644 index 0000000..f1cf746 --- /dev/null +++ b/test-fff.scm | |||
@@ -0,0 +1,23 @@ | |||
1 | (use-modules (ice-9 format) | ||
2 | (ice-9 peg) | ||
3 | (ice-9 textual-ports) | ||
4 | (fff)) | ||
5 | |||
6 | (define (read-file file) | ||
7 | (call-with-input-file file get-string-all)) | ||
8 | |||
9 | (define (test-parse input) | ||
10 | (let loop ((str "") | ||
11 | (num 0) | ||
12 | (lst (string-split input #\newline))) | ||
13 | (cond | ||
14 | ((null? lst) (match-pattern fff str)) | ||
15 | ((not (match-pattern fff str)) | ||
16 | (format #t "!!!!!!!!!!!!!!!!!!!!!!!~%~s~%" lst)) | ||
17 | (else | ||
18 | (format #t "~s~%~%" (peg:tree (match-pattern fff str))) | ||
19 | (when (match-pattern fff str) | ||
20 | (format #t "~s~%" (car lst))) | ||
21 | (loop (string-append str "\n" (car lst)) | ||
22 | (+ num 1) | ||
23 | (cdr lst)))))) | ||