Next: , Previous: , Up: FAQ   [Contents][Index]


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

You can specify an initial action with %option user-init (though note that yyout may not be available at the time this option is interpreted). Or you can add to the beginning of your rules section:

%%
%{
    static bool did_init = false;

    if ( ! did_init ) {
        do_my_init();
        did_init = true;
    }
%}