Le 26 août 09 à 12:11, Rui Maciel a écrit :
Akim Demaille wrote:
Can you show the content of this file? Can you also show where you
include it in your Bison file? Maybe you include the flex header
from
the bison and vice versa, which probably does not work as expected.
Usually you include the Bison header from the Flex scanner (to get
the
token definitions and so forth). I have no experience with the
converse.
I've sent an email with all the test project files attached (flex,
bison, makefile).
Please, keep everything public, send them here too.
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.
Reading the Flex header file, I was most amused to read the following:
#define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 5
#define YY_FLEX_SUBMINOR_VERSION 35
#if YY_FLEX_SUBMINOR_VERSION > 0
#define FLEX_BETA
#endif
Given their definitions of FLEX_BETA, I wonder if there ever existed a
true release of Flex :)
Back to the point. I do not have the problem you have: s_element is
correctly replaced as expected.
a...@montero /tmp/foo $ grep '%[sx]' msh.l
%x s_element
a...@montero /tmp/foo $ grep s_element msh.y
{ yy_push_state(s_element); }
a...@montero /tmp/foo $ cc -E msh.tab.c | grep yy_push_state
{ yy_push_state(1); }
It seems bizarre to me to play with start conditions and yy_push_state
from 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.
I agree it also seems bizarre that start conditions are defined in the
header file, but that yy_push_state is static.
_______________________________________________
help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison