Allow user to terminate the parser - close #13

This commit is contained in:
josh committed 2024-01-03 22:32:10 -05:00
1 parent 92c76b74c8
commit 24af3590d1
8 files changed
+162 -14

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
import testparser;
import std.stdio;
int main()
{
return 0;
}
unittest
{
string input = "aacc";
p_context_t context;
p_context_init(&context, input);
assert(p_parse(&context) == P_SUCCESS);
input = "abc";
p_context_init(&context, input);
assert(p_parse(&context) == P_USER_TERMINATED);
assert(p_user_terminate_code(&context) == 4200);
}