AST building #2

Merged
TopchetoEU merged 74 commits from TopchetoEU/ast-building into master 2022-10-28 11:58:03 +00:00
2 changed files with 5 additions and 9 deletions
Showing only changes of commit eb8d7cd1f1 - Show all commits

View File

@ -73,7 +73,7 @@ namespace ppc::comp::tree::ast {
}
bool parse(std::string parser, size_t &pi, data::map_t &out);
static bool parse(msg_stack_t &messages, std::vector<token_t> &tokens, data::map_t &out);
static data::map_t parse(msg_stack_t &messages, std::vector<token_t> &tokens);
~ast_ctx_t();
ast_ctx_t(msg_stack_t &messages, std::vector<token_t> &tokens):

View File

@ -30,18 +30,14 @@ namespace ppc::comp::tree::ast {
groups.emplace(parser);
}
bool ast_ctx_t::parse(msg_stack_t &messages, std::vector<token_t> &tokens, data::map_t &out) {
data::map_t ast_ctx_t::parse(msg_stack_t &messages, std::vector<token_t> &tokens) {
ast_ctx_t ctx(messages, tokens);
ctx.init();
size_t i = 0;
data::map_t res;
try {
return ctx.parse("$_glob", i, out);
}
catch (const message_t &msg) {
messages.push(msg);
return false;
}
if (!ctx.parse("$_glob", i, res)) throw message_t::error("Failed to compile.");
return res;
}
bool ast_ctx_t::parse(std::string parser, size_t &pi, data::map_t &out) {
return this->parser[parser] (*this, pi, out);