Added code to detect assembler directives and did some minor code clean up.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user