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

Re: About GScanner



I'll admit I don't know the first thing about GScanner, but your life
might be made easier simply by using lex and yacc (both of which I believe
there are gnu versions) which are very well-documented and fairly
straightforward to use.

HTH,
Dan

On Wed, 16 Jun 1999, Fred Jolly wrote:

> I'm trying to use a GScanner to parse a configuration file but there is
> not a lot of help...
> So I've read gtkrc.c and tried to make the same things.
> 
> So when I parse my configuration file if finds a G_TOKEN_SYMBOL if there
> is a symbol that I've added in the GScanner (and a G_TOKEN_IDENTIFIER if
> I've not added it) but it doesn't find my token !
> 
> Here is my code :
> 
> 
> typedef enum {
>    TOKEN_FOO,
> } token_bar;   <--- what I have to write here ??
> 
> static const struct  
> {  
>   gchar *name;
>   guint token;
> } symbols[] = {
>   { "foo", TOKEN_FOO },
> };
> 
> GScanner *scanner=g_scanner_new(NULL);
> g_scanner_input_file(scanner,file_descriptor);
> g_scanner_scope_add_symbol(scanner,scanner->scope_id,symbol[0].name,symbol[0].token);
> 
> then g_scanner_get_next_token(scanner) always returns G_TOKEN_SYMBOL if
> I have foo in my configuration file, and never TOKEN_FOO.
> 
> What's wrong ?
> 
> Thanks.
> 
> Fred.
> 
> 
> -- 
>          To unsubscribe: mail gtk-app-devel-list-request@redhat.com with 
>                        "unsubscribe" as the Subject.
> 
> 	Mailing list concerns should be mailed to <listmaster@redhat.com>
> 
> 



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