xo-reader2 stack: expand symbol table to store typedefs

+ typedef utest
+ misc qol policy choices
This commit is contained in:
Roland Conybeare 2026-03-11 07:49:14 -05:00
commit 76af3ff3b5
42 changed files with 1050 additions and 110 deletions

View file

@ -77,7 +77,8 @@ namespace xo {
ParserConfig cfg;
cfg.parser_arena_config_.size_ = 16 * 1024;
/* editor bait: symbol table */
cfg.symtab_config_.hint_max_capacity_ = 128;
cfg.symtab_var_config_.hint_max_capacity_ = 128;
cfg.symtab_types_config_.hint_max_capacity_ = 64;
cfg.max_stringtable_capacity_ = 512;
cfg.debug_flag_ = false;
@ -272,6 +273,45 @@ namespace xo {
log && fixture.log_memory_layout(&log);
}
TEST_CASE("SchematikaParser-batch-deftype", "[reader2][SchematikaParser]")
{
const auto & testname = Catch::getResultCapture().getCurrentTestName();
constexpr bool c_debug_flag = true;
scope log(XO_DEBUG(c_debug_flag), xtag("test", testname));
ParserFixture fixture(testname, c_debug_flag);
auto & parser = *(fixture.parser_);
parser.begin_batch_session();
/** Walkthrough parsing input equivalent to:
*
* deftype foo :: f64;
**/
std::vector<Token> tk_v{
Token::deftype_token(),
Token::symbol_token("foo"),
Token::doublecolon_token(),
Token::symbol_token("f64"),
Token::semicolon_token(),
};
utest_tokenizer_loop(&parser, tk_v, c_debug_flag);
const auto & result = parser.result();
{
// placeholder for form's sake.
// deftype doesn't actuallly produce any executable content
auto expr = obj<AExpression,DConstant>::from(result.result_expr());
REQUIRE(expr);
}
log && fixture.log_memory_layout(&log);
}
TEST_CASE("SchematikaParser-interactive-def2", "[reader2][SchematikaParser]")
{
const auto & testname = Catch::getResultCapture().getCurrentTestName();
@ -1325,7 +1365,7 @@ namespace xo {
const auto & testname = Catch::getResultCapture().getCurrentTestName();
constexpr bool c_debug_flag = true;
constexpr bool c_debug_flag = false;
scope log(XO_DEBUG(c_debug_flag), xtag("test", testname));
ParserFixture fixture(testname, c_debug_flag);