Re: Problem with GScanner



Dnia 26-07-2005, wto o godzinie 10:42 +0200, Uzytkownik napisaÅ(a):
I use GScanner to parse same file.

I test the first function of setting page size.
In file it's represent by: PAGE A4; or PAGE "A4"; etc.

This is parse loop:
static void parse_head(WocPagerParser *parser, GError **error) {
      GTokenType token; //1
      g_debug("head"); //1
      while(1) {

Here g_scanner_eof is never FALSE.
Before is done on scanner this functions:

#define TEST(name, cau) g_print(#name "...\t%s\n", (cau) ? "OK" :
"Fail")

gchar text[] = "PAGE A4;";

(...)
        TEST(Init, parser = g_object_new(WOC_PAGER_PARSER_TYPE, NULL));
        
        g_signal_connect(G_OBJECT(parser), "head-page",
(GCallback)head_page,
NULL);
        woc_pager_parser_set_text(parser, text);
        //g_scanner_parser_input_text(self->scanner, text,
        //strlen(text));
        woc_pager_parser_parse(parser, &error);
        //Call this loop

              switch(token =
g_scanner_peek_next_token(parser->scanner)) {
                      case SYMBOL_PAGE:
                              parse_page(parser, error);
                              break;
                      default:
                              g_debug("default: %d, %d", token,
SYMBOL_PAGE); //1
                              /*
                               * Probably end of head.
                               * If error it'll be handled by body
                               */
                               return;
              }
              if(*error)
                      return;
      }
}

[1] Lines added only to debug

Always token == 134517480(it's not depends of
parser->scanner->config->symbol_2_token).
Debug lines:
** (process:9275): DEBUG: head
** (process:9275): DEBUG: default: 134517480, 271

What mean 134517480 and what's wrong?

Regards
-- 
Linux user: #376500 (see http://counter.li.org/)

Regards.
-- 
Linux user: #376500 (see http://counter.li.org/)


-- 
Wïochy i Paryï - przewodniki turystyczne do wyboru. Tylko z lipcowym numerem miesiïcznika Auto+. 
http://www.a-plus.pl



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