Re: [Flex-devel] Bug in skeleton processing?
flex is a tool for generating scanners
Brought to you by:
wlestes
From: Joe K. <kr...@ni...> - 2008-10-01 20:17:26
|
Joe Krahn wrote: > I noticed that the skeleton conditional "%if-tables-serialization" does > not push the conditional stack. In the following section from the > skeleton source: > > %if-tables-serialization > #include <sys/types.h> > #include <netinet/in.h> > %endif > > The %endif statement here is actually popping an initial 'true' pushed > on to the conditional stack before processing started, instead of ending > the "%if-tables-serialization" section, which it seems is the actual > intention. > > Joe Krahn Looking into this further, it is definitely a bug, but I have not yet looked into how it affects the output. In addition to "%if-tables-serialization" not pushing onto the conditional stack, there is at least one other place where %if/%endif is unbalanced. Near line 860 is the following: }; /* end struct yyguts_t */ ]]) %if-c-only m4_ifdef( [[M4_YY_NOT_IN_HEADER]], [[ static int yy_init_globals M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG ); ]]) %endif c-only %if-reentrant This section begins already inside of an %if-c-only and %if-reentrant, but they are repeated here. Later on, an unbalanced %endif pops an extra condition from the stack. Every time skelout() starts, it pushes an extra TRUE onto the stack. This happens at the beginning, after each of the %% insertion sections. The only use for that pushed TRUE condition is to allow for an extra imbalanced %endif. I modified "%if-tables-serialization" to push the stack, and took out the initial sko_push at the beginning of skelout(). When the conditionals are balanced, it works as expected. I have not gone over the skeleton file to figure out the side-effects of balancing conditionals. I assume it passes all of the tests with the current bugs. Joe Krahn |