Added code to detect assembler directives and did some minor code clean up.

This commit is contained in:
2022-02-01 22:07:00 -06:00
parent ebc1d30c1c
commit 7a88d6e34d
5 changed files with 17 additions and 127 deletions
+5
View File
@@ -45,6 +45,9 @@ List* GenerateTokensFromFile(const char* file_path) {
else if(token->type == TK_Label) {
printf("Label: '%s'\n", token->value);
}
else if (token->type == TK_Directive) {
printf("Directive '%s'\n", token->value);
}
else {
printf("Found text: '%s'\n", token->value);
}
@@ -70,6 +73,8 @@ Token* GetNextToken(char *string) {
int base = 0;
while (strlen(string_token) != 0) {
if (string_token[0] == '.') return CreateToken(TK_Directive, string_token);
if (TokenIsNumeric(string_token, &base)) {
if (base == 10) return CreateToken(TK_Number, string_token);