;; generated automatically.  DO NOT EDIT
#!no-fold-case
(define-module parser.peg (use srfi-13) (use srfi-14) (use gauche.collection) (use gauche.generator) (use gauche.lazy) (use text.tree) (use util.match) (export <parse-error> make-peg-parse-error peg-run-parser peg-parse-string peg-parse-port peg-parser->generator parse-success? return-result return-failure/expect return-failure/unexpect return-failure/message return-failure/compound $return $fail $expect $lift $lift* $debug $do $try $seq $or $fold-parsers $fold-parsers-right $many $many1 $skip-many $skip-many1 $repeat $optional $alternate $sep-by $end-by $sep-end-by $count $between $followed-by $not $many-till $chain-left $chain-right $lazy $s $c $y $string $string-ci $char $one-of $none-of $many-chars $satisfy anychar upper lower letter alphanum digit hexdigit newline tab space spaces eof $->rope $->string $->symbol rope->string rope-finalize))
(select-module parser.peg)
(dynamic-load "parser--peg")
(define-syntax $do (syntax-rules () ((_ body) body) ((_ (var parser) clause . rest) ($bind parser (^ (var) ($do clause . rest)))) ((_ (parser) clause . rest) ($bind parser (^_ ($do clause . rest)))) ((_ parser clause . rest) ($bind parser (^_ ($do clause . rest)))) ((_ . other) (syntax-error "malformed $do" ($do . other)))))
(define-syntax $lazy (syntax-rules () ((_ parse) (let ((p (delay parse))) (lambda (s) ((force p) s))))))
(define-syntax $satisfy (syntax-rules (cut <>) ((_ (cut p x <>) expect) (lambda (s) (if (and (pair? s) (p x (car s))) (return-result (car s) (cdr s)) (return-failure/expect expect s)))) ((_ pred expect) (lambda (s) (if (and (pair? s) (pred (car s))) (return-result (car s) (cdr s)) (return-failure/expect expect s))))))
(define-syntax $many-chars (syntax-rules () ((_ parser) ($many ($one-of parser))) ((_ parser min) ($many ($one-of parser) min)) ((_ parser min max) ($many ($one-of parser) min max))))
