Allow user-defined context fields

This commit is contained in:
josh committed 2026-02-13 23:53:18 -05:00
1 parent f4bc719aed
commit 78adf86103
8 files changed
+158

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
#include "testparser.h"
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main()
{
char const * input = "aaa\n\n\na\n # comment 1\na a aa\n\naa\n# comment 2\na\n";
p_context_t context;
p_context_init(&context, (uint8_t const *)input, strlen(input));
assert(p_parse(&context) == P_SUCCESS);
fprintf(stderr, "comments: %s", context.comments);
fprintf(stderr, "acount: %u\n", context.acount);
free(context.comments);
return 0;
}