Merge pull request #20 from UB-CSE443/Sprint2-PrintOutErrorTokenPositions-NoTask

added code to print out positions of incorrect tokens
This commit is contained in:
Moroseui
2025-02-21 15:27:43 -05:00
committed by GitHub
2 changed files with 6 additions and 1 deletions

View File

@ -81,6 +81,8 @@ SCHAR \\n|\\t|\\\"|[^\"\n\\]
{ID} {if(DEBUG) {printf( "ID: %s (%d)\n", yytext, ID);} else {return ID;}}
\n {line_number++; column_number = 1;}
. {column_number++;}
\t {column_number++;}
" " {column_number++;}
. {column_number++; return 1999;}
%%

View File

@ -80,6 +80,9 @@ int run(FILE *alpha) {
}
continue;
}
if(token == 1999){
printf("On line number %d and column number %d we have an invalid character:%s\n",line_number,column_number,yytext);
}
column_number += yyleng;
}