diff options
Diffstat (limited to 'asm')
-rw-r--r-- | asm/preprocesser.cpp | 16 | ||||
-rw-r--r-- | asm/preprocesser.hpp | 3 |
2 files changed, 12 insertions, 7 deletions
diff --git a/asm/preprocesser.cpp b/asm/preprocesser.cpp index 1245ff7..c0cf9e2 100644 --- a/asm/preprocesser.cpp +++ b/asm/preprocesser.cpp @@ -27,13 +27,17 @@ using std::pair, std::vector, std::make_pair, std::string, std::string_view; delete t; \ }); -pair<vector<token_t *>, pp_err_t> preprocesser(vector<token_t *> &tokens) +pp_err_t preprocesser(const vector<token_t *> &tokens, + vector<token_t *> &vec_out) { vector<token_t *> use_block_tokens; pp_err_t pperr{pp_err_type_t::OK}; std::tie(use_block_tokens, pperr) = preprocess_use_blocks(tokens); if (pperr.type != pp_err_type_t::OK) - return ERR(pperr); + { + vec_out = tokens; + return pperr; + } vector<token_t *> const_block_tokens; std::tie(const_block_tokens, pperr) = @@ -41,12 +45,14 @@ pair<vector<token_t *>, pp_err_t> preprocesser(vector<token_t *> &tokens) if (pperr.type != pp_err_type_t::OK) { VCLEAR(tokens); - tokens = use_block_tokens; - return ERR(pperr); + vec_out = use_block_tokens; + return pperr; } VCLEAR(use_block_tokens); - return VAL(const_block_tokens); + vec_out = const_block_tokens; + + return pp_err_t{pp_err_type_t::OK}; } pair<vector<token_t *>, pp_err_t> diff --git a/asm/preprocesser.hpp b/asm/preprocesser.hpp index f4cb3bb..ed5a421 100644 --- a/asm/preprocesser.hpp +++ b/asm/preprocesser.hpp @@ -42,8 +42,7 @@ struct pp_err_t std::ostream &operator<<(std::ostream &, pp_err_t &); -std::pair<std::vector<token_t *>, pp_err_t> -preprocesser(std::vector<token_t *> &); +pp_err_t preprocesser(const std::vector<token_t *> &, std::vector<token_t *> &); std::pair<std::vector<token_t *>, pp_err_t> preprocess_const_blocks(const std::vector<token_t *> &); |