%x COMMENT
%{
#include<stdio.h>
#include<string.h>
%}
%%
"//".* {}
"/*" {BEGIN COMMENT;}
<COMMENT>. {}
<COMMENT>"*/" {BEGIN 0;}
. {printf("%s",yytext);}
%%
int main (int argc, char **argv)
{
FILE *fp;
fp= fopen("test.txt","r");
if(fp!=NULL)
{
yyin=fp;
yylex();
fclose(fp);
}
return 0;
}
int yywrap()
{
return 1;
}
%{
#include<stdio.h>
#include<string.h>
%}
%%
"//".* {}
"/*" {BEGIN COMMENT;}
<COMMENT>. {}
<COMMENT>"*/" {BEGIN 0;}
. {printf("%s",yytext);}
%%
int main (int argc, char **argv)
{
FILE *fp;
fp= fopen("test.txt","r");
if(fp!=NULL)
{
yyin=fp;
yylex();
fclose(fp);
}
return 0;
}
int yywrap()
{
return 1;
}
