From f0e778a85c943e527a01909b20edaf588d4a4397 Mon Sep 17 00:00:00 2001 From: TopchetoEU <36534413+TopchetoEU@users.noreply.github.com> Date: Tue, 11 Oct 2022 13:14:25 +0300 Subject: [PATCH] chore: remove token printing in main --- src/main/main.cc | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/src/main/main.cc b/src/main/main.cc index d140119..338d3b2 100644 --- a/src/main/main.cc +++ b/src/main/main.cc @@ -153,29 +153,16 @@ int main(int argc, const char *argv[]) { for (const auto &file : files) { std::ifstream f { file, std::ios_base::in }; - std::stringstream res; try { auto tokens = token_t::parse_many(msg_stack, lex::token_t::parse_file(msg_stack, file, f)); data::map_t ast; - if (!ast::ast_ctx_t::parse(msg_stack, tokens, ast)) throw msg_stack.peek(); + if (!ast::ast_ctx_t::parse(msg_stack, tokens, ast)) continue; - for (auto tok : tokens) { - if (tok.is_identifier()) res << "Identifier: \t" << tok.identifier(); - if (tok.is_operator()) res << "Operator: \t" << operator_stringify(tok._operator()); - if (tok.is_float_lit()) res << "Float: \t" << tok.float_lit(); - if (tok.is_int_lit()) res << "Int: \t" << tok.int_lit(); - if (tok.is_char_lit()) res << "Char: \t" << tok.char_lit(); - if (tok.is_string_lit()) res << "String: \t" << std::string { tok.string_lit().begin(), tok.string_lit().end() }; - res << '\n'; - } - - res << '\n' << data::json::stringify(ast); + std::cout << data::json::stringify(ast) << std::endl; } catch (const messages::message_t &msg) { msg_stack.push(msg); } - - std::cout << res.str() << std::endl; } msg_stack.print(std::cout, messages::message_t::DEBUG, true);