YY_FLUSH_BUFFER

"Vinu V Das" <[email protected]> Sat, 17 Jun 2006 14:08:47 +0530
Newsgroups gmane.comp.lex.flex.general
Message-ID <[email protected]>
--===============0573639010==
Content-Type: multipart/alternative; 
	boundary="----=_Part_132554_30644271.1150533527652"

------=_Part_132554_30644271.1150533527652
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Dear Reders,

Please clear my following doubts regarding the YY_FLUSH_BUFFER. The program
and its output is given below..........

Generally YY_FLUSH_BUFFER flushes out all the content of yytext. But from
the following program I understood that it flushes only first two letters
from the first token.............

If you can spare some time clear this doubts it would be very helpful for
me.....................

Thanks

truly
Vinu V Das,
Lecturer, Dept of Computer,
MES College of Engg.
Kerala, India.

-------------------------------------------------


%%



[a-z]+ { printf("\nThe lower case token is = ");

         ECHO;

         YY_FLUSH_BUFFER;

         printf("\nThe token after flush = ");ECHO;

        }

[a-zA-Z]+ { printf("\nThe mixed token is = ");

            ECHO;

        }



%%



main()

{

        yylex();

}



--------- output -----------------------



[root@vinu yytextTest]# ./a.out

good morning



The lower case token is = good

The token after flush = od



[1]+  Stopped                 ./a.out

[root@vinu yytextTest]#

------=_Part_132554_30644271.1150533527652
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

<div id="mb_0"><div><div>Dear Reders,</div>
<div>&nbsp;</div>
<div>Please clear my following doubts regarding the <font face="Times New Roman">YY_FLUSH_BUFFER. The program and its output is given below..........</font></div>
<div>&nbsp;</div>
<div><font face="Times New Roman">Generally <font face="Times New Roman">YY_FLUSH_BUFFER
flushes out all the content of yytext. But from the&nbsp;following program I
understood that it flushes only first two letters from the first
token.............
</font></font></div>
<div>&nbsp;</div>
<div><font face="Times New Roman">If you can spare some time clear this doubts it would be very helpful for me.....................</font></div>
<div>&nbsp;</div>
<div><font face="Times New Roman">Thanks</font></div>
<div>&nbsp;</div>
<div><font face="Times New Roman">truly</font></div>
<div><font face="Times New Roman">Vinu V Das,</font></div>
<div><font face="Times New Roman">Lecturer, Dept of Computer,</font></div>
<div><font face="Times New Roman">MES College of Engg.</font></div>
<div><font face="Times New Roman">Kerala, India.</font></div>
<div>&nbsp;</div>
<div>-------------------------------------------------</div>
<div>&nbsp;</div>
<div>
<p style="margin: 0in 0in 0pt;"><font face="Times New Roman">%%</font></p>
<p style="margin: 0in 0in 0pt;"><font face="Times New Roman">&nbsp;</font></p>
<p style="margin: 0in 0in 0pt;"><font face="Times New Roman">[a-z]+ { printf(&quot;\nThe lower case token is = &quot;);</font></p>
<p style="margin: 0in 0in 0pt;"><font face="Times New Roman"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>ECHO;</font></p>
<p style="margin: 0in 0in 0pt;"><font face="Times New Roman"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>YY_FLUSH_BUFFER;</font></p>
<p style="margin: 0in 0in 0pt;"><font face="Times New Roman"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>printf(&quot;\nThe token after flush = &quot;);ECHO;</font></p>
<p style="margin: 0in 0in 0pt;"><font face="Times New Roman"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>}</font></p>
<p style="margin: 0in 0in 0pt;"><font face="Times New Roman">[a-zA-Z]+ { printf(&quot;\nThe mixed token is = &quot;);</font></p>
<p style="margin: 0in 0in 0pt;"><font face="Times New Roman"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>ECHO;</font></p>
<p style="margin: 0in 0in 0pt;"><font face="Times New Roman"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>}</font></p>
<p style="margin: 0in 0in 0pt;"><font face="Times New Roman">&nbsp;</font></p>
<p style="margin: 0in 0in 0pt;"><font face="Times New Roman">%%</font></p>
<p style="margin: 0in 0in 0pt;"><font face="Times New Roman">&nbsp;</font></p>
<p style="margin: 0in 0in 0pt;"><font face="Times New Roman">main()</font></p>
<p style="margin: 0in 0in 0pt;"><font face="Times New Roman">{</font></p>
<p style="margin: 0in 0in 0pt;"><font face="Times New Roman"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>yylex();</font></p>
<p style="margin: 0in 0in 0pt;"><font face="Times New Roman">}</font></p>
<p style="margin: 0in 0in 0pt;"><font face="Times New Roman">&nbsp;</font></p>
<p style="margin: 0in 0in 0pt;"><font face="Times New Roman">--------- output -----------------------</font></p>
<p style="margin: 0in 0in 0pt;"><font face="Times New Roman">&nbsp;</font></p>
<p style="margin: 0in 0in 0pt;"><font face="Times New Roman">[root@vinu yytextTest]# ./a.out</font></p>
<p style="margin: 0in 0in 0pt;"><font face="Times New Roman">good morning</font></p>
<p style="margin: 0in 0in 0pt;"><font face="Times New Roman">&nbsp;</font></p>
<p style="margin: 0in 0in 0pt;"><font face="Times New Roman">The lower case token is = good</font></p>
<p style="margin: 0in 0in 0pt;"><font face="Times New Roman">The token after flush = od</font></p>
<p style="margin: 0in 0in 0pt;"><font face="Times New Roman">&nbsp;</font></p>
<p style="margin: 0in 0in 0pt;"><font face="Times New Roman">[1]+<span>&nbsp; </span>Stopped<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>./a.out</font></p>
<p style="margin: 0in 0in 0pt;"><font face="Times New Roman">[root@vinu yytextTest]#</font></p></div>

</div></div>

------=_Part_132554_30644271.1150533527652--



--===============0573639010==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
help-flex mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-flex

--===============0573639010==--