blob: dc8ce98dac7bce882acd7434d37d781a4f6f5054 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
(define-module (patterns)
#:use-module (ice-9 peg)
#:export (file))
(define-peg-pattern field-part all
(* (or "\\\""
(followed-by (or "|" "\""))
peg-any)))
(define-peg-pattern field all
(and (ignore "\"")
(* (and field-part (ignore (? (or "|")))))
(ignore "\"")) )
(define-peg-pattern line all
(+ (and field
(ignore (? ","))
(ignore (* " ")))))
(define-peg-pattern file body
(+ (and line (ignore (? "\n")))))
|