Call analyse function from compiler

This commit is contained in:
Yannick Reiß 2023-09-21 15:10:36 +02:00
parent 96a5f3cda6
commit f329bd0770
No known key found for this signature in database
GPG Key ID: 5A3AF456F0A0338C
1 changed files with 10 additions and 1 deletions

View File

@ -74,11 +74,20 @@ int main (int argc, char** argv) {
exit(EXIT_FAILURE);
}
extractTokens(buffer, tokens);
int token_count = extractTokens(buffer, tokens);
if (!token_count) {
(void)printf("WARNING: The program is empty!\n");
}
/* end of lifetime for buffer */
free( buffer );
/* Analyze the code for errors and warnings. */
int scan_result = analyze(tokens);
if (scan_result < 0) {
exit(scan_result);
}
/* Just print the tokens as example. */
for (char* index = tokens; *index; index++) {
(void)printf("%c", *index);