(flex.info)How do I execute code only during initialization (only before the first scan)?


Next: How do I execute code at termination? Prev: How do I abandon a file in the middle of a scan and switch to a new file? Up: FAQ
Enter node , (file) or (file)node

How do I execute code only during initialization (only before the first scan)?
==============================================================================

You can specify an initial action by defining the macro 'YY_USER_INIT'
(though note that 'yyout' may not be available at the time this macro is
executed).  Or you can add to the beginning of your rules section:

     %%
         /* Must be indented! */
         static int did_init = 0;
     
         if ( ! did_init ){
     do_my_init();
             did_init = 1;
         }


automatically generated by info2www version 1.2.2.9