#127 Support context switching from outside world

Sir Zooro

I have to switch lexer context from parser. In order to do this I added set or #define's for each context defined using %s/%x, and function which calls BEGIN() with appropriate value. This is a bit inconvenient - I would like to use defines generated by flex itself, or provide my defines. The simplest solutions would be to protect context defines generated by flex with #ifdef SOME_MACRO - this will let me to redefine them in some header file. More complex solution would be to generate header file with these defines. You can also take a look how such feature is implemented in bison.


  • I'm sorry, I have a hard time following you. What is it that exactly you want to achieve and how can flex be more helpful to that? If possible, please provide a small grammar sniplet that shows the current impediments.

  • I'm closing this bug for now. If you have more information, please re-open it.

    • status: open --> closed-invalid