Store tree nodes in congruent, compact arena array. Define handle types to refer to tree nodes rather than pointers to structure instances. Free tree with context.
20 lines
337 B
D
20 lines
337 B
D
import testparser;
|
|
import std.stdio;
|
|
import testutils;
|
|
|
|
int main()
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
unittest
|
|
{
|
|
string input = "hi";
|
|
p_context_t * context;
|
|
context = p_context_new(input);
|
|
assert_eq(P_SUCCESS, p_parse(context));
|
|
Top top = p_result(context);
|
|
assert(top.pToken.valid);
|
|
assert_eq(TOKEN_hi, top.pToken.token);
|
|
}
|