From 0e5c9340725a5ee0b419c8e61f221049ee3c542e Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Mon, 15 Apr 2024 05:08:07 +0630 Subject: preprocess_* now uses const references to tokens They copy and construct new token vectors and just read the token inputs. --- asm/preprocesser.cpp | 4 ++-- asm/preprocesser.hpp | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/asm/preprocesser.cpp b/asm/preprocesser.cpp index dd7067a..aae1f0b 100644 --- a/asm/preprocesser.cpp +++ b/asm/preprocesser.cpp @@ -22,7 +22,7 @@ using std::pair, std::vector, std::make_pair, std::string, std::string_view; #define VAL(E) std::make_pair(E, pp_err_t{pp_err_type_t::OK}) pair, pp_err_t> -preprocess_use_blocks(vector tokens) +preprocess_use_blocks(const vector &tokens) { vector new_tokens; for (size_t i = 0; i < tokens.size(); ++i) @@ -69,7 +69,7 @@ struct const_t }; pair, pp_err_t> -preprocess_const_blocks(vector &tokens) +preprocess_const_blocks(vector const &tokens) { std::unordered_map blocks; for (size_t i = 0; i < tokens.size(); ++i) diff --git a/asm/preprocesser.hpp b/asm/preprocesser.hpp index a1d8a31..0d340df 100644 --- a/asm/preprocesser.hpp +++ b/asm/preprocesser.hpp @@ -45,13 +45,13 @@ std::pair, pp_err_t> preprocesser(std::vector &); std::pair, pp_err_t> -preprocess_const_blocks(std::vector &); +preprocess_const_blocks(const std::vector &); std::pair, pp_err_t> -preprocess_use_blocks(std::vector &); +preprocess_use_blocks(const std::vector &); // TODO: Implement this std::pair, pp_err_t> -preprocess_macro_blocks(std::vector &); +preprocess_macro_blocks(const std::vector &); #endif -- cgit v1.2.3-13-gbd6f