%x COMMENT %% "--" { BEGIN(COMMENT); } "\n" { ECHO; BEGIN(INITIAL); } . { ECHO; } . { } %% // https://westes.github.io/flex/manual/Start-Conditions.html #include int main(void) { yylex(); return EXIT_SUCCESS; }