[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: set flex start conditions from bison?

From: Akim Demaille
Subject: Re: set flex start conditions from bison?
Date: Wed, 26 Aug 2009 14:58:02 +0200

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

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 FLEX_BETA

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.

address@hidden /tmp/foo $ grep '%[sx]' msh.l
%x s_element
address@hidden /tmp/foo $ grep s_element msh.y
        { yy_push_state(s_element); }
address@hidden /tmp/foo $ cc -E | 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.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]