Re: g_scanner funtions what for?



On Wed, 17 Mar 1999, Andreas Tille wrote:

> On Wed, 17 Mar 1999, Tim Janik wrote:
> 
> > #ifdef _I_WANT_IN_DEAD_A_SEMIKOLON_
> ... I wanted this to be a meta comment because this strange string is not
> defined
> >   /* make sure the next token is a ';' */
> >   if (g_scanner_peek_next_token (scanner) != ';')
> >     {
> >       /* not so, eat up the non-semicolon and error out */
> >       g_scanner_get_next_token (scanner);
> >       return ';';
> >     }
> > #endif
>  
> > without an extra check, because i *know* this is the ';', i checked that in
> > advance. so you need to also
> > 
> >   switch ()
> >   {
> >    .......
> >   }
> > #ifdef _I_WANT_IN_DEAD_A_SEMIKOLON_
> >   g_scanner_get_next_token (scanner);
> > #endif
> > 
> > after the switch.
> I really do the g_scanner_get_next_token (scanner) after the switch, but
> if you try the appended program it doesn't work.  Could you send me a
> patch which would work?

g_scanner_get_next_token (scanner); has been after the switch, what you
need to do is to place the 
#ifdef _I_WANT_IN_DEAD_A_SEMIKOLON_
#endif

around it, so we don't eat some token that we are not supposed to handle.

> 
> Kind regards
> 
>        Andreas.
> 
> 

---
ciaoTJ



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