Rename AST generation mode to tree generation mode
This commit is contained in:
1 parent
6a87bb2d56
commit
77ec7c9de4
34 files changed
+279
-279
No files matched your search
@@ -0,0 +1,37 @@
|
||||
#include "testparser.h"
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include "testutils.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
char const * input = "bbbb";
|
||||
p_context_t context;
|
||||
p_context_init(&context, (uint8_t const *)input, strlen(input));
|
||||
assert(p_parse(&context) == P_SUCCESS);
|
||||
Start * start = p_result(&context);
|
||||
assert_not_null(start->bs);
|
||||
assert_not_null(start->bs->b);
|
||||
assert_not_null(start->bs->bs->b);
|
||||
assert_not_null(start->bs->bs->bs->b);
|
||||
assert_not_null(start->bs->bs->bs->bs->b);
|
||||
p_free_tree(start);
|
||||
|
||||
p_context_init(&context, (uint8_t const *)input, strlen(input));
|
||||
assert(p_parse_Bs(&context) == P_SUCCESS);
|
||||
Bs * bs = p_result_Bs(&context);
|
||||
assert_not_null(bs->b);
|
||||
assert_not_null(bs->bs->b);
|
||||
assert_not_null(bs->bs->bs->b);
|
||||
assert_not_null(bs->bs->bs->bs->b);
|
||||
p_free_tree_Bs(bs);
|
||||
|
||||
input = "c";
|
||||
p_context_init(&context, (uint8_t const *)input, strlen(input));
|
||||
assert(p_parse_R(&context) == P_SUCCESS);
|
||||
R * r = p_result_R(&context);
|
||||
assert_not_null(r->c);
|
||||
p_free_tree_R(r);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user