#lang scheme/base
(require "depend.ss"
mzlib/defmacro
(for-syntax scheme/base
)
)
(define p:comment (seq #\(
chars <- (zero-many (choice (char-not-in '(#\( #\)))
p:comment))
#\)
(return (flatten chars))))
(define p:comments (tokens v <- (zero-many (token p:comment))
(return v)))
(define (p:comment-tokenizer parser)
(token parser p:comments))
(define (p:comment-tokenizer-ci parser)
(p:comment-tokenizer (literal-ci parser)))
(define-macro (tokens/comment . exps)
`(tokens/by p:comment-tokenizer . ,exps))
(define-macro (tokens/comment-ci . exps)
`(tokens/by p:comment-tokenizer-ci . ,exps))
(provide tokens/comment
tokens/comment-ci
)
(provide/contract
(p:comment-tokenizer (-> Literal-Parser/c Parser/c))
(p:comment Parser/c)
(p:comments Parser/c)
(p:comment-tokenizer-ci (-> Literal-Parser/c Parser/c))
)