(flex.info.gz) How can I match C-style comments?
Info Catalog
(flex.info.gz) Why doesn't yyrestart() set the start state back to INITIAL?
(flex.info.gz) FAQ
(flex.info.gz) The period isn't working the way I expected
How can I match C-style comments?
=================================
You might be tempted to try something like this:
"/*".*"*/" // WRONG!
or, worse, this:
"/*"(.|\n)"*/" // WRONG!
The above rules will eat too much input, and blow up on things like:
/* a comment */ do_my_thing( "oops */" );
Here is one way which allows you to track line information:
<INITIAL>{
"/*" BEGIN(IN_COMMENT);
}
<IN_COMMENT>{
"*/" BEGIN(INITIAL);
[^*\n]+ // eat comment in chunks
"*" // eat the lone star
\n yylineno++;
}
Info Catalog
(flex.info.gz) Why doesn't yyrestart() set the start state back to INITIAL?
(flex.info.gz) FAQ
(flex.info.gz) The period isn't working the way I expected
automatically generated byinfo2html