Exit the program if there were errors found
This commit is contained in:
parent
44beccfd06
commit
12f70b1a88
2 changed files with 9 additions and 3 deletions
|
@ -44,6 +44,7 @@ unsigned int check_token_errors(char tokens[][MAX_TOKEN_SIZE], shash_hashtable_t
|
||||||
if(label_addr == NULL)
|
if(label_addr == NULL)
|
||||||
{
|
{
|
||||||
printf("ERROR: Label %s has not been defined (Used at token %d)\n", tokens[i], i);
|
printf("ERROR: Label %s has not been defined (Used at token %d)\n", tokens[i], i);
|
||||||
|
error_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check that the next token is a ;
|
// Check that the next token is a ;
|
||||||
|
|
|
@ -163,7 +163,12 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
// Check if the EIPA Assembly contains errors with the no_label_definition_tokens array
|
// Check if the EIPA Assembly contains errors with the no_label_definition_tokens array
|
||||||
shash_hashtable_t instruction_informations = create_instruction_information_hastable();
|
shash_hashtable_t instruction_informations = create_instruction_information_hastable();
|
||||||
printf("Found %d errors\n", check_token_errors((char (*)[MAX_TOKEN_SIZE]) no_label_definition_tokens.buffer, instruction_informations, label_table));
|
unsigned int error_c = check_token_errors((char (*)[MAX_TOKEN_SIZE]) no_label_definition_tokens.buffer, instruction_informations, label_table);
|
||||||
|
printf("Found %d errors\n", error_c);
|
||||||
|
if(error_c > 0)
|
||||||
|
{
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
// Part II of processing labels
|
// Part II of processing labels
|
||||||
dynamic_buffer_t tokens;
|
dynamic_buffer_t tokens;
|
||||||
|
|
Loading…
Reference in a new issue