summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOxore <oxore@protonmail.com>2023-06-27 00:26:02 +0300
committerOxore <oxore@protonmail.com>2023-06-27 00:26:02 +0300
commit91bc07e04e9009d5eddaacf7002551046699d313 (patch)
tree15b8108b739bf9d1a263210e0a6913c79d00a4ac
parent565f95997c5e5b8707bb3a259796cbaf14de2b50 (diff)
Fix expression parsing and complex EA parsing
-rw-r--r--main.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/main.c b/main.c
index 98b4061..df5849c 100644
--- a/main.c
+++ b/main.c
@@ -1761,12 +1761,7 @@ static int pars_parse_arg_after_prefix_expr(
return OK;
}
const struct token token0 = pars_peek(self);
- if (token0.type == TT_NEWLINE) {
- // It was a standalone expression without size suffix, yield an
- // argument from here
- arg->type = ARG_ADDR_UNSPEC;
- return OK;
- } if (token0.type == TT_DOT_ID) {
+ if (token0.type == TT_DOT_ID) {
// It must be a size specifier, or error otherwise
const size_t size_spec_id = pars_commit(self);
if (token0.length != 2) {
@@ -1784,7 +1779,10 @@ static int pars_parse_arg_after_prefix_expr(
pars_commit(self);
return pars_parse_arg_inside_parens(self, arg);
}
- return pars_yield_error_msg(self, self->cur_tok_id, E_UNIMPL);
+ // It was a standalone expression without size suffix, yield an
+ // argument from here
+ arg->type = ARG_ADDR_UNSPEC;
+ return OK;
}
static int pars_parse_arg_starts_with_minus(
@@ -1967,7 +1965,7 @@ static int pars_parse_arg_inside_parens(
return OK;
} else if (parts == 3 && an1_found && arg->expr.first_token && (an2_found || dn_found)) {
// It is (d8,An,Xn)
- assert((an1_found && !dn_found) || (!an1_found && dn_found));
+ assert((an2_found && !dn_found) || (!an2_found && dn_found));
arg->type = ARG_AN_ADDR_8_XI;
arg->xi = an2_found ? (an2 | 0x8) : dn;
arg->num_tokens = self->cur_tok_id - arg->first_token;