Skip to content

Commit

Permalink
Scanner does not exit the program after reading invalid tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
RolandMarchand committed Jul 15, 2022
1 parent 0b630f2 commit 68f0942
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions src/scanner/scanner.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ struct scanner {
char *start;
/* pointer to current character of the source code */
char *current;
/* determines if the source file contains valid tokens */
char valid_input;
/* line counter */
int line;
};
Expand All @@ -57,7 +55,6 @@ static struct scanner scanner = (struct scanner){
.start = 0,
.current = 0,
.line = 0,
.valid_input = 1
};

/* fill up `ta` with the tokens from the source file
Expand Down Expand Up @@ -91,8 +88,6 @@ struct scan *scan_init(const char *filename)

scan_tokens(ta);

ASSERT(scanner.valid_input, "Input has errors. Exiting.\n");

struct scan *s = malloc(sizeof(struct scan));

ASSERT(s != NULL, "Failed to allocate %zu bytes in scan_init.",
Expand Down Expand Up @@ -214,7 +209,6 @@ static struct token get_token()
scanner.current[0], scanner.line);

/* invalid */
scanner.valid_input = 0;
advance();
return GET_TOKEN(TOKEN_INVALID);
}
Expand Down

0 comments on commit 68f0942

Please sign in to comment.