Skip to content

Commit

Permalink
Removing last bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
jefersonla committed Nov 6, 2016
1 parent 5e2166e commit 4ee7780
Show file tree
Hide file tree
Showing 9 changed files with 370 additions and 188 deletions.
12 changes: 12 additions & 0 deletions analisador-lexico.l
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,18 @@ int main( int argc, char **argv ) {
/* Output File for Flex */
output_file = fopen(output_filename, "w");

/* Check if input file has not failed */
if(yyin == NULL){
printFatalError("CANNOT OPEN INPUT FILE!");
return EXIT_FAILURE;
}

/* Check if output file has not failed */
if(output_file == NULL){
printFatalError("CANNOT OPEN INPUT FILE!");
return EXIT_FAILURE;
}

/* While there are tokens to process */
int yylex_state;
for(yylex_state = yylex() ; (yylex_state) && (yylex_state != yyerrorfound) ; yylex_state = yylex());
Expand Down
20 changes: 10 additions & 10 deletions analisador-semantico.y
Original file line number Diff line number Diff line change
Expand Up @@ -299,13 +299,13 @@ comando_list : comando_list comando {

/* Check if there are errors with the actual node */
if($$ == NULL){
fprintf(stderr, "[ERROR] FATAL ERROR ON ACTUAL NODE!\n");
printFatalError("FATAL ERROR ON ACTUAL NODE!");
return EXIT_FAILURE;
}

/* Check if there are errors with the actual node */
if($$->child_list == NULL){
fprintf(stderr, "[ERROR] FATAL ERROR ON CHILD LIST!\n");
printFatalError("FATAL ERROR ON CHILD LIST!");
return EXIT_FAILURE;
}

Expand Down Expand Up @@ -551,13 +551,13 @@ term_elseif : term_elseif T_ELSEIF exp T_THEN bloco {

/* Check if there are errors with the actual node */
if($$ == NULL){
fprintf(stderr, "[ERROR] FATAL ERROR ON ACTUAL NODE!\n");
printFatalError("FATAL ERROR ON ACTUAL NODE!");
return EXIT_FAILURE;
}

/* Check if there are errors with the actual node */
if($$->child_list == NULL){
fprintf(stderr, "[ERROR] FATAL ERROR ON CHILD LIST!\n");
printFatalError("FATAL ERROR ON CHILD LIST!");
return EXIT_FAILURE;
}

Expand Down Expand Up @@ -902,13 +902,13 @@ listadenomes : T_NAME {

/* Check if there are errors with the actual node */
if($$ == NULL){
fprintf(stderr, "[ERROR] FATAL ERROR ON ACTUAL NODE!\n");
printFatalError("FATAL ERROR ON ACTUAL NODE!");
return EXIT_FAILURE;
}

/* Check if there are errors with the actual node */
if($$->child_list == NULL){
fprintf(stderr, "[ERROR] FATAL ERROR ON CHILD LIST!\n");
printFatalError("FATAL ERROR ON CHILD LIST!");
return EXIT_FAILURE;
}

Expand Down Expand Up @@ -940,13 +940,13 @@ listaexp : exp {

/* Check if there are errors with the actual node */
if($$ == NULL){
fprintf(stderr, "[ERROR] FATAL ERROR ON ACTUAL NODE!\n");
printFatalError("FATAL ERROR ON ACTUAL NODE!");
return EXIT_FAILURE;
}

/* Check if there are errors with the actual node */
if($$->child_list == NULL){
fprintf(stderr, "[ERROR] FATAL ERROR ON CHILD LIST!\n");
printFatalError("FATAL ERROR ON CHILD LIST!");
return EXIT_FAILURE;
}

Expand Down Expand Up @@ -1077,13 +1077,13 @@ int main(int argc, char *argv[]){

/* Check if fopen has succeed */
if(yyin == NULL){
fprintf(stderr, "[ERROR] FATAL ERROR CANNOT OPEN FILE!\n");
printFatalError("FATAL ERROR CANNOT OPEN FILE!");
return EXIT_FAILURE;
}

/* Check if we can write */
if(output_filename == NULL){
fprintf(stderr, "[ERROR] FATAL ERROR CANNOT WRITE TO FILE!\n");
printFatalError("FATAL ERROR CANNOT WRITE TO FILE!");
return EXIT_FAILURE;
}

Expand Down
Loading

0 comments on commit 4ee7780

Please sign in to comment.