Why are multi-line comments in flex/bison so evasive?
问题 I'm trying to parse C-style multi-line comments in my flex (.l) file: %s ML_COMMENT %% ... <INITIAL>"/*" BEGIN(ML_COMMENT); <ML_COMMENT>"*/" BEGIN(INITIAL); <ML_COMMENT>[.\n]+ { } I'm not returning any token and my grammar (.y) doesn't address comments in any way. When I run my executable, I get a parse error: $ ./a.out /* abc def Parse error: parse error $ echo "/* foo */" | ./a.out Parse error: parse error (My yyerror function does a printf("Parse error: %s\n"), which is where the first