Add support for multiple starting rules - close #38
This commit is contained in:
1 parent
cb426b4be1
commit
6a87bb2d56
14 files changed
+383
-37
No files matched your search
@@ -0,0 +1,27 @@
|
||||
#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);
|
||||
int result = p_result(&context);
|
||||
assert_eq(8, result);
|
||||
|
||||
p_context_init(&context, (uint8_t const *)input, strlen(input));
|
||||
assert(p_parse_Bs(&context) == P_SUCCESS);
|
||||
result = p_result_Bs(&context);
|
||||
assert_eq(8, result);
|
||||
|
||||
input = "c";
|
||||
p_context_init(&context, (uint8_t const *)input, strlen(input));
|
||||
assert(p_parse_R(&context) == P_SUCCESS);
|
||||
result = p_result_R(&context);
|
||||
assert_eq(3, result);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user