Replace p_context_init() with p_context_new()/p_context_delete()

This commit is contained in:
josh committed 2026-02-17 18:40:33 -05:00
1 parent 9f2fe6f84b
commit 6fd5186159
77 files changed
+728 -610

No files matched your search

+9 -7
View File
@@ -6,10 +6,10 @@
int main()
{
char const * input = "abbccc";
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);
p_context_t * context;
context = p_context_new((uint8_t const *)input, strlen(input));
assert(p_parse(context) == P_SUCCESS);
Start * start = p_result(context);
assert_eq(1, start->pT1->pToken->position.row);
assert_eq(1, start->pT1->pToken->position.col);
@@ -44,11 +44,12 @@ int main()
assert_eq(6, start->end_position.col);
p_free_tree(start);
p_context_delete(context);
input = "\n\n bb\nc\ncc\n\n a";
p_context_init(&context, (uint8_t const *)input, strlen(input));
assert(p_parse(&context) == P_SUCCESS);
start = p_result(&context);
context = p_context_new((uint8_t const *)input, strlen(input));
assert(p_parse(context) == P_SUCCESS);
start = p_result(context);
assert_eq(3, start->pT1->pToken->position.row);
assert_eq(3, start->pT1->pToken->position.col);
@@ -83,6 +84,7 @@ int main()
assert_eq(6, start->end_position.col);
p_free_tree(start);
p_context_delete(context);
return 0;
}