是不是符合标准请看标准文档
%{
%}
%option caseless outfile="1.l.c" stack noyy_top_state nostdinit
%x MCOMM LCOMM STRLT
AC .|{NL}
NL \r\n|\r|\n
MCOMM_BEGIN \/\*|\/\\{NL}\*
MCOMM_END "*/"|\*\\{NL}\/
LCOMM_BEGIN \/\/|"/"\\{NL}"/"
DBL_CHAR [^\"\\\n\r]|\\{AC}
SIG_CHAR [^\'\\\n\r]|\\{AC}
STR_LIT \"{DBL_CHAR}*\"|\'{SIG_CHAR}*\'
%%
<INITIAL>{
{MCOMM_BEGIN} { BEGIN(MCOMM); }
{LCOMM_BEGIN} { BEGIN(LCOMM); }
{STR_LIT} { ECHO; }
{AC} { ECHO; }
}
<MCOMM>{
{MCOMM_END} { BEGIN(INITIAL); }
{AC}
}
<LCOMM>{
{NL} { BEGIN(INITIAL); }
\\{NL}
.
}
%%
int yywrap() { return 1; }
int main()
{
return yylex();
}