|
From: | Akim Demaille |
Subject: | Re: set flex start conditions from bison? |
Date: | Fri, 28 Aug 2009 10:39:25 +0200 |
Le 27 août 09 à 20:52, Rui Maciel a écrit :
I don't know what Flex you use, but using 2.5.35 it does not compile: you're using push_state, which is static in the scanner.c file, from the parser.c file.Yes, that's the most recent SNAFU I stumbled on. Yet, it only goes that far if I add to the flex source file the undocumented, unexplained #define YY_HEADER_EXPORT_START_CONDITIONS, which seems like a bit of ahack and not a good way to go around things.
I'm not sure we refer to the same thing. Yet, the start conditions are exported, but push_state and the like are not. They are static in the *.c file.
It seems bizarre to me to play with start conditions and yy_push_statefrom the parser. I would rather write some wrapper function in the scanner.l file, say scan_enter_element_mode(), and use that function from my parser.Why is that a better alternative to simply calling yy_push_state() and co from within the bison code?
Encapsulation. It seems to me that start conditions are low-level details that should not escape the scanner file.
Handling yy_push_state() directly from bison appears to be a cleaner way of doing things.
Ok.
I agree it also seems bizarre that start conditions are defined in theheader file, but that yy_push_state is static.Is it possible that this is a flex bug?
I don't know, ask them.
[Prev in Thread] | Current Thread | [Next in Thread] |