about summary refs log tree commit diff stats
path: root/test-fff.scm
blob: f1cf746cfc2532b5a6e2607b0367886d08555e31 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
(use-modules (ice-9 format)
             (ice-9 peg)
             (ice-9 textual-ports)
             (fff))

(define (read-file file)
  (call-with-input-file file get-string-all))

(define (test-parse input)
  (let loop ((str "")
             (num 0)
             (lst (string-split input #\newline)))
    (cond
     ((null? lst) (match-pattern fff str))
     ((not (match-pattern fff str))
      (format #t "!!!!!!!!!!!!!!!!!!!!!!!~%~s~%" lst))
     (else
      (format #t "~s~%~%" (peg:tree (match-pattern fff str)))
      (when (match-pattern fff str)
        (format #t "~s~%" (car lst)))
      (loop (string-append str "\n" (car lst))
            (+ num 1)
            (cdr lst))))))