updated comment count

This commit is contained in:
Partho Bhattacharya
2025-02-13 20:02:42 -05:00
parent 3c6d3be9b4
commit 52a7c69dae
14 changed files with 123 additions and 110 deletions

View File

@ -26,6 +26,17 @@ int main(int argc, char *argv[]) {
if (arg == TOK_ARG) {
fprintf(output, "%d %d %3d \"%s\"\n", line_number, column_number, token, yytext);
}
if(token == COMMENT){
for (int i = 0; i < yyleng; i++) {
if(yytext[i] == '\n'){
line_number++;
column_number = 0;
}
column_number++;
}
continue;
}
column_number += yyleng;
}
if (yyin != NULL) {