WIP refactoring

This commit is contained in:
Daniel Holden
2013-11-10 14:17:32 +00:00
parent 82aa2eefc7
commit 7059268b9b
5 changed files with 213 additions and 243 deletions

View File

@@ -14,7 +14,7 @@ void test_ident(void) {
/* ^[a-zA-Z_][a-zA-Z0-9_]*$ */
mpc_parser_t* Ident = mpc_enclose(
mpc_and(2, mpcf_astrfold,
mpc_and(2, mpcf_strfold,
mpc_or(2, mpc_alpha(), mpc_underscore()),
mpc_many1(mpcf_strfold, mpc_or(3, mpc_alpha(), mpc_underscore(), mpc_digit())),
free),

View File

@@ -18,6 +18,13 @@ void test_regex_basic(void) {
re4 = mpc_re("ab|c(abdd)?");
re5 = mpc_re("abc(ab|dd)+g$");
mpc_print(re0);
mpc_print(re1);
mpc_print(re2);
mpc_print(re3);
mpc_print(re4);
mpc_print(re5);
PT_ASSERT(mpc_match(re0, "abc", "abc", string_eq, free, string_print));
PT_ASSERT(mpc_match(re0, "bcd", "bcd", string_eq, free, string_print));
PT_ASSERT(mpc_unmatch(re0, "bc", "bc", string_eq, free, string_print));