aboutsummaryrefslogtreecommitdiff
path: root/asm/parser.c
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2023-11-02 23:27:25 +0000
committerAryadev Chavali <aryadev@aryadevchavali.com>2023-11-02 23:29:07 +0000
commitbd39c2b2835974c4ad9313f49a273df1af5887af (patch)
tree927c192628547b8f876b08ad477cce4434e2faca /asm/parser.c
parentc74c36333b33452a27f5da428c1087a547c2170b (diff)
downloadovm-bd39c2b2835974c4ad9313f49a273df1af5887af.tar.gz
ovm-bd39c2b2835974c4ad9313f49a273df1af5887af.tar.bz2
ovm-bd39c2b2835974c4ad9313f49a273df1af5887af.zip
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.
Diffstat (limited to 'asm/parser.c')
-rw-r--r--asm/parser.c12
1 files changed, 6 insertions, 6 deletions
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;