%{ #include #include #include char *filename = "-"; int countall = 0; int countco = 0; int countsc = 0; int countbl = 0; int coopen = 0; %} %option noyywarp %x COMMENTED %% ^"\n" { countall++; countbl++;} ^"/*" { countall++; countco++; coopen = 1; BEGIN COMMENTED; . { if (coopen = 1){ countco++; countall++;} else { countall++; countsc;}} } .*"*/" {coopen = 0; BEGIN INITIAL;} .*"\n" {countall++; countco++; %% int main() { yylex(); printf("Statistik:\n"); printf("gesamte Zeilen:\t", countall); }