diff options
author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2024-04-15 18:39:37 +0630 |
---|---|---|
committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2024-04-15 18:39:37 +0630 |
commit | 1e7f1bdee91324613a1675642775d6ed32d7e94d (patch) | |
tree | 78733fc657c0bafbd959a7c05dbe9af3c3c1c633 /asm/preprocesser.cpp | |
parent | ba3525d53311dfc89610748ef3ce0a8d9e3756b9 (diff) | |
download | ovm-1e7f1bdee91324613a1675642775d6ed32d7e94d.tar.gz ovm-1e7f1bdee91324613a1675642775d6ed32d7e94d.tar.bz2 ovm-1e7f1bdee91324613a1675642775d6ed32d7e94d.zip |
Changed %const format in preprocesser now
Instead of %const(<name>) ... %end it will now be %const <name>
... %end i.e. the first symbol after %const will be considered the
name of the constant similar to %use.
Diffstat (limited to 'asm/preprocesser.cpp')
-rw-r--r-- | asm/preprocesser.cpp | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/asm/preprocesser.cpp b/asm/preprocesser.cpp index 434a340..d68992c 100644 --- a/asm/preprocesser.cpp +++ b/asm/preprocesser.cpp @@ -81,20 +81,9 @@ pp_err_t preprocess_const_blocks(const vector<token_t *> &tokens, if (t->type == token_type_t::PP_CONST) { string_view capture; - if (t->content == "" && (i == tokens.size() - 1 || - tokens[i + 1]->type != token_type_t::SYMBOL)) - return ERR(pp_err_t{pp_err_type_t::EXPECTED_NAME}); - else if (t->content != "") - capture = t->content; - else + if (i + 1 >= tokens.size() || tokens[i + 1]->type != token_type_t::SYMBOL) capture = tokens[++i]->content; - // Check for brackets - auto start = capture.find('('); - auto end = capture.find(')'); - if (start == string::npos || end == string::npos) - return ERR(pp_err_t{pp_err_type_t::EXPECTED_NAME}); - ++i; size_t block_start = i, block_end = 0; for (; i < tokens.size() && tokens[i]->type != token_type_t::PP_END; ++i) @@ -105,8 +94,7 @@ pp_err_t preprocess_const_blocks(const vector<token_t *> &tokens, block_end = i; - blocks[capture.substr(start + 1, end - 1)] = - const_t{block_start, block_end}; + blocks[capture] = const_t{block_start, block_end}; } } |