From 91bc07e04e9009d5eddaacf7002551046699d313 Mon Sep 17 00:00:00 2001 From: Oxore Date: Tue, 27 Jun 2023 00:26:02 +0300 Subject: Fix expression parsing and complex EA parsing --- main.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'main.c') 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; -- cgit v1.2.3