[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: yy_current_state, stuff
From: |
Jordan DeLong |
Subject: |
Re: yy_current_state, stuff |
Date: |
Thu, 15 Mar 2001 11:52:58 +0000 |
User-agent: |
Mutt/1.2.5i |
start conditions are a bit different than states. I want to be able to
interrupt the
scanner in the middle of scanning and be able to resume without problems. Such
as this:
the scanner has read the letters 'i' and then 'n' while in the INITIAL start
condition, and
then is interrupted, when it comes back to the scanner, in order for it to know
that the
't' char it reads next makes it complete the rule for <INITIAL>"int" it needs
to have the
yy_current_state variable (declared in the yylex func) restored (in addition to
the start
condition vars, etc.)
-Jordan
On Thu, Mar 15, 2001 at 01:12:40PM -0500, Kingpin wrote:
> This is how you normally start the scanner in a certain state (see
> page 172 of the O'Reilly book). How is your case different?
>
> %s MY_STATE
> %{
> static int first_time = 1;
> %}
> %%
> %{
> if (first_time) { BEGIN MY_STATE; first_time = 0; }
> %}
> <MY_STATE>pattern ...
>
> --
> - - Martin "Kingpin" Thurn address@hidden
> Research Software Engineer (703) 793-3700 x2651
> The Information Refinery http://tir.tasc.com
> TASC, Inc. http://www.tasc.com
>
> That wizard's just a crazy old man. -- Owen, Star Wars