diff --git a/src/r8asm.cc b/src/r8asm.cc index d64495a..d237913 100644 --- a/src/r8asm.cc +++ b/src/r8asm.cc @@ -77,15 +77,7 @@ r8asm::general_data r8asm::ast::expand_node_to_data(const ast_node &node) { } std::string r8asm::ast::expand_node_to_string(const ast_node &node) { - std::string to_return = ""; - switch (node.type) { - case ast_node_t::STRING: - to_return = node.value; - break; - default: - break; - } - return to_return; + return node.value; } #define EMPTY_CODEBLOCK \ @@ -440,7 +432,8 @@ bool r8asm::is_integer(const std::string &str) { ((present_token->type == token_t::LPAREN || \ present_token->type == token_t::STRING || \ (present_token->type == token_t::OPERATOR && \ - (present_token->value == "neg" || present_token->value == "not"))) && \ + (present_token->value == "op_neg" || \ + present_token->value == "op_not"))) && \ (!((present_token - 1)->type == token_t::OPERATOR || \ (present_token - 1)->type == token_t::LPAREN)))) r8asm::ast_node r8asm::parse_args(const token_line &line) { @@ -461,6 +454,13 @@ r8asm::ast_node r8asm::parse_args(const token_line &line) { } buffer.push_back(*it); } + if (!buffer.empty()) { + raw_args.push_back({line.number, {}}); + while (!buffer.empty()) { + raw_args.back().tokens.push_back(buffer.front()); + buffer.pop_front(); + } + } for (const auto &it : raw_args) to_return.children.push_back(parse_single_arg(it)); return to_return;