From f329bd0770dc1181503b99f8e86019359d5cf640 Mon Sep 17 00:00:00 2001 From: yannickreiss Date: Thu, 21 Sep 2023 15:10:36 +0200 Subject: [PATCH] Call analyse function from compiler --- bfpcompiler/src/compilefuck.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/bfpcompiler/src/compilefuck.c b/bfpcompiler/src/compilefuck.c index bdb41db..ff74300 100644 --- a/bfpcompiler/src/compilefuck.c +++ b/bfpcompiler/src/compilefuck.c @@ -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);