I need to match EOF in flex
this is the main error part of my code lex.l
%{
%}
%%
<<EOF>> {printf("match EOF\n");}
%%
int main(){
yylex();
}
i use
flex lex.l ; gcc lex.yy.c -o lex.exe -lfl ; lex.exe < text
to execute
and this is my text file just one line
abc(no \n or \r at the end of file)
but when I execute lex.exe it goes into endless loop and output infinite line of "match EOF\n"
How to solve the problem?
yyterminate()
– Numeration