Ticket #500 (new enhancement)
Opened 12 years ago
Request for adding parser combinator "zero"
Reported by: | anonymous | Owned by: | bzlib |
---|---|---|---|
Priority: | major | Milestone: | |
Component: | bzlib/parseq.plt | Keywords: | |
Cc: | Version: | (1 3) | |
Racket Version: |
Description
The library would benefit from having a parser combinator that succeeds if the parser given as a parameter fails. As far as I can tell, the implementation would be:
(define (zero parser)
(lambda (in)
(let-values
(((v in) ((literal parser) in)))
((if (failed? v) (return '()) fail) in))))
Note: See
TracTickets for help on using
tickets.