help-bison
[Top][All Lists]
Advanced

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

Re: Why was YYLEX_PARAM "deprecated"?


From: wim delvaux
Subject: Re: Why was YYLEX_PARAM "deprecated"?
Date: Thu, 24 Apr 2003 15:57:51 +0200
User-agent: KMail/1.5.1

OK yes I notice it in the tab.c file

However I just mailed to the flex guys about bison / flex integration.  (There 
were some 'generation issues'.  Some of those issues also have to do with 
bison.

So this is what I sent them ...

Some more remarks.

The integration between bison and flex is hairy (reentrant version)

1. Bison needs undocumented option parse-param and lex-param
2. lex needs to generate .h file for functions
3. bison needs to include that h file but also its own tab.h because YYSTYPE 
is needed by yylex. (which is needed by gcc as a forward declaration of yylex

I wonder if this include mess IS necessary.  
I did the following 

struct LexParser_S {
        int             init; /* Initial 1 */
        FILE *          infile;    /* Initial 0 */
        FILE *          outfile;   /* Initial 0 */
        char            hold_char; /* Default N/A */
        int             n_chars;/* Default N/A */
        char *          text; /* Default 0 -> initialized in init */
        char *          text_ptr; /* default N/A only used when array mode */
        int             start;
        int             leng;
        char *          c_buf_p;
        int             did_buffer_switch_on_eof; /* Default 0 */
        void *          current_buffer; /* Default 0 */
        int             start_stack_ptr; /* Default 0 */
        int             start_stack_depth; /* Default 0 */
        int *           start_stack;  /* Default 0 */
        int             debug; /* Default 0 */
        int             lineno; /* Default 1 */
        void *          rock; /* Application data -> shared with syntax */
};

typedef struct LexParser_S LexParser_t;

#define Flex_Setyyin(x,newYYin)         ((LexParser_t *)(x))->infile = newYYin
#define Flex_Setyyout(x,newYYout)       ((LexParser_t *)(x))->outfile = 
newYYout
#define Flex_SetDebug(x,y)              ((LexParser_t *)(x))->debug=y
#define Flex_SetRock(x,R)               ((LexParser_t *)(x))->rock=R
#define Flex_GetRock(x)                 ((LexParser_t *)(x))->rock
#define Flex_LineNo(x)                  ((LexParser_t *)(x))->lineno
#define Flex_CurrentToken(x)            ((LexParser_t *)(x))->text
#define Flex_CurrentTokenLength(x)      ((LexParser_t *)(x))->leng

LexParser_t == yyscan_t

However this does not work since yyscan_t is void *

Still it is messy..

Comments ?

W




reply via email to

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