[C++][flex++] What's wrong to get first string?
Dear all,
My rule is:
---------------------------
white ([ \t]+)
%%
{white} ;
[^ \t\n]+ {printf("Got string = %s\n",YYText());}
. ECHO;
\n ;
%%
--------------------------
My input is a file, for example test.txt
test.txt:
--------------------------
abcd123 1000
.
.
.
--------------------------
I can get first string is "abcd123".
But if test.txt's first lines are blanked (only '\n'),
for example the first 2 lines are just '\n'.
I got first string is "\n\nabcd123".
What's wrong?
How should I fix it?
Thanks for your help.
Best Reards,
cylin.
|