Completed refactoring
This commit is contained in:
@@ -16,11 +16,11 @@ void test_grammar(void) {
|
||||
mpc_define(Value, mpca_grammar(" /[0-9]+/ | '(' <expression> ')' ", Expr));
|
||||
mpc_define(Maths, mpca_total(Expr));
|
||||
|
||||
t0 = mpc_ast_build(1, ">", mpc_ast_new("value|regex", "24"));
|
||||
t1 = mpc_ast_build(1, ">",
|
||||
t0 = mpc_ast_new("product|value|regex", "24");
|
||||
t1 = mpc_ast_build(1, "product|>",
|
||||
mpc_ast_build(3, "value|>",
|
||||
mpc_ast_new("char", "("),
|
||||
mpc_ast_new("value|regex", "5"),
|
||||
mpc_ast_new("expression|product|value|regex", "5"),
|
||||
mpc_ast_new("char", ")")));
|
||||
|
||||
t2 = mpc_ast_build(3, ">",
|
||||
@@ -37,11 +37,11 @@ void test_grammar(void) {
|
||||
mpc_ast_new("value|regex", "11")),
|
||||
|
||||
mpc_ast_new("char", "+"),
|
||||
mpc_ast_new("value|regex", "2")),
|
||||
mpc_ast_new("product|value|regex", "2")),
|
||||
mpc_ast_new("char", ")")),
|
||||
|
||||
mpc_ast_new("char", "+"),
|
||||
mpc_ast_new("value|regex", "5"));
|
||||
mpc_ast_new("product|value|regex", "5"));
|
||||
|
||||
PT_ASSERT(mpc_match(Maths, " 24 ", t0, (int(*)(void*,void*))mpc_ast_eq, (mpc_dtor_t)mpc_ast_delete, (void(*)(void*))mpc_ast_print));
|
||||
PT_ASSERT(mpc_match(Maths, "(5)", t1, (int(*)(void*,void*))mpc_ast_eq, (mpc_dtor_t)mpc_ast_delete, (void(*)(void*))mpc_ast_print));
|
||||
|
Reference in New Issue
Block a user