From bd39c2b2835974c4ad9313f49a273df1af5887af Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Thu, 2 Nov 2023 23:27:25 +0000 Subject: Made lexer more error prone so parser is less Lexer now will straight away attempt to eat up any type or later portions of an opcode rather than leaving everything but the root. This means checking for type in the parser is a direct check against the name rather than prefixed with a dot. Checks are a bit more strong to cause more tokens to go straight to symbol rather than getting checked after one routine in at on the parser side. --- asm/parser.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'asm/parser.c') diff --git a/asm/parser.c b/asm/parser.c index 44c09b4..4f76fe5 100644 --- a/asm/parser.c +++ b/asm/parser.c @@ -157,17 +157,17 @@ enum Type T_WORD, } parse_details_to_type(token_t details) { - if (details.str_size == 5 && strncmp(details.str, ".BYTE", 5) == 0) + if (details.str_size == 4 && strncmp(details.str, "BYTE", 4) == 0) return T_BYTE; - else if (details.str_size == 5 && strncmp(details.str, ".CHAR", 5) == 0) + else if (details.str_size == 4 && strncmp(details.str, "CHAR", 4) == 0) return T_CHAR; - else if (details.str_size == 6 && strncmp(details.str, ".HWORD", 6) == 0) + else if (details.str_size == 5 && strncmp(details.str, "HWORD", 5) == 0) return T_HWORD; - else if (details.str_size == 4 && strncmp(details.str, ".INT", 4) == 0) + else if (details.str_size == 3 && strncmp(details.str, "INT", 3) == 0) return T_INT; - else if (details.str_size == 5 && strncmp(details.str, ".LONG", 5) == 0) + else if (details.str_size == 4 && strncmp(details.str, "LONG", 4) == 0) return T_LONG; - else if (details.str_size == 5 && strncmp(details.str, ".WORD", 5) == 0) + else if (details.str_size == 4 && strncmp(details.str, "WORD", 4) == 0) return T_WORD; else return T_NIL; -- cgit v1.2.3-13-gbd6f