Call analyse function from compiler
This commit is contained in:
parent
96a5f3cda6
commit
f329bd0770
|
@ -74,11 +74,20 @@ int main (int argc, char** argv) {
|
||||||
exit(EXIT_FAILURE);
|
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 */
|
/* end of lifetime for buffer */
|
||||||
free( 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. */
|
/* Just print the tokens as example. */
|
||||||
for (char* index = tokens; *index; index++) {
|
for (char* index = tokens; *index; index++) {
|
||||||
(void)printf("%c", *index);
|
(void)printf("%c", *index);
|
||||||
|
|
Loading…
Reference in New Issue