difference and xor combinators done.

This commit is contained in:
Meredith L. Patterson 2012-05-03 02:31:22 +01:00
parent 3016fd2460
commit 709884faf5
3 changed files with 89 additions and 5 deletions

View file

@ -116,9 +116,22 @@ const parser_t* sequence(const parser_t* p_array[]);
/* Given an array of parsers, p_array, apply each parser in order. The first parser to succeed is the result; if no parsers succeed, the parse fails. */
const parser_t* choice(const parser_t* p_array[]);
/* Given two parsers, p1 and p2, this parser succeeds in the following cases:
* - if p1 succeeds and p2 fails
* - if both succeed but p1's result is shorter than p2's
*/
const parser_t* butnot(const parser_t* p1, const parser_t* p2);
/* Given two parsers, p1 and p2, this parser succeeds in the following cases:
* - if p1 succeeds and p2 fails
* - if both succeed but p2's result is shorter than p1's
*/
const parser_t* difference(const parser_t* p1, const parser_t* p2);
/* Given two parsers, p1 and p2, this parser succeeds if *either* p1 or p2 succeed, but not if they both do.
*/
const parser_t* xor(const parser_t* p1, const parser_t* p2);
const parser_t* repeat0(const parser_t* p);
const parser_t* repeat1(const parser_t* p);
const parser_t* repeat_n(const parser_t* p, const size_t n);