glib, flex and bison



hi there,

currently, my code is kind of ugly because i need to convert back and
forth between standard and glib data types.  i'm using flex/bison to
handle user input (i'm a flex/bison newbie).  basically, yytext is put
into a union depending on the data type:

   %union
   {
      int  number;
      char *string;
      char character;
   }
   
   %token <number>    NUMBER
   %token <character> LETTER
   %token <string>    WORD
   %%
   commands:
      | commands command
      ;
   command:
      TOK_SAVE WORD TOK_END      { SaveState($2); }


it would be sweet beyond belief if i could somehow get bison/yacc to
pass a GString rather than a char *.  this would save me alot of
"conversion code".

has anyone done this?  it seems like it can't be done, but there are
some pretty crafty people out there.

pete

-- 
PGP Fingerprint: B9F1 6CF3 47C4 7CD8 D33E  70A9 A3B9 1945 67EA 951D
PGP Public Key:  finger p dirac org



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