mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 03:16:17 +01:00
[merged from stable]
Sat May 18 00:21:51 2002 Tim Janik <timj@gtk.org> [merged from stable] * glib/gscanner.c (g_scanner_unexp_token): fix missing cases for expected_token.
This commit is contained in:
parent
24d064ef8f
commit
d8ea5db966
@ -1,3 +1,10 @@
|
|||||||
|
Sat May 18 00:21:51 2002 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
[merged from stable]
|
||||||
|
|
||||||
|
* glib/gscanner.c (g_scanner_unexp_token): fix missing cases for
|
||||||
|
expected_token.
|
||||||
|
|
||||||
2002-05-17 Tor Lillqvist <tml@iki.fi>
|
2002-05-17 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
* config.h.win32.in: Match new additions in a configure-produced
|
* config.h.win32.in: Match new additions in a configure-produced
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
Sat May 18 00:21:51 2002 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
[merged from stable]
|
||||||
|
|
||||||
|
* glib/gscanner.c (g_scanner_unexp_token): fix missing cases for
|
||||||
|
expected_token.
|
||||||
|
|
||||||
2002-05-17 Tor Lillqvist <tml@iki.fi>
|
2002-05-17 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
* config.h.win32.in: Match new additions in a configure-produced
|
* config.h.win32.in: Match new additions in a configure-produced
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
Sat May 18 00:21:51 2002 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
[merged from stable]
|
||||||
|
|
||||||
|
* glib/gscanner.c (g_scanner_unexp_token): fix missing cases for
|
||||||
|
expected_token.
|
||||||
|
|
||||||
2002-05-17 Tor Lillqvist <tml@iki.fi>
|
2002-05-17 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
* config.h.win32.in: Match new additions in a configure-produced
|
* config.h.win32.in: Match new additions in a configure-produced
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
Sat May 18 00:21:51 2002 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
[merged from stable]
|
||||||
|
|
||||||
|
* glib/gscanner.c (g_scanner_unexp_token): fix missing cases for
|
||||||
|
expected_token.
|
||||||
|
|
||||||
2002-05-17 Tor Lillqvist <tml@iki.fi>
|
2002-05-17 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
* config.h.win32.in: Match new additions in a configure-produced
|
* config.h.win32.in: Match new additions in a configure-produced
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
Sat May 18 00:21:51 2002 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
[merged from stable]
|
||||||
|
|
||||||
|
* glib/gscanner.c (g_scanner_unexp_token): fix missing cases for
|
||||||
|
expected_token.
|
||||||
|
|
||||||
2002-05-17 Tor Lillqvist <tml@iki.fi>
|
2002-05-17 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
* config.h.win32.in: Match new additions in a configure-produced
|
* config.h.win32.in: Match new additions in a configure-produced
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
Sat May 18 00:21:51 2002 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
[merged from stable]
|
||||||
|
|
||||||
|
* glib/gscanner.c (g_scanner_unexp_token): fix missing cases for
|
||||||
|
expected_token.
|
||||||
|
|
||||||
2002-05-17 Tor Lillqvist <tml@iki.fi>
|
2002-05-17 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
* config.h.win32.in: Match new additions in a configure-produced
|
* config.h.win32.in: Match new additions in a configure-produced
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
Sat May 18 00:21:51 2002 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
[merged from stable]
|
||||||
|
|
||||||
|
* glib/gscanner.c (g_scanner_unexp_token): fix missing cases for
|
||||||
|
expected_token.
|
||||||
|
|
||||||
2002-05-17 Tor Lillqvist <tml@iki.fi>
|
2002-05-17 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
* config.h.win32.in: Match new additions in a configure-produced
|
* config.h.win32.in: Match new additions in a configure-produced
|
||||||
|
101
glib/gscanner.c
101
glib/gscanner.c
@ -177,7 +177,7 @@ g_scanner_new (const GScannerConfig *config_templ)
|
|||||||
scanner = g_new0 (GScanner, 1);
|
scanner = g_new0 (GScanner, 1);
|
||||||
|
|
||||||
scanner->user_data = NULL;
|
scanner->user_data = NULL;
|
||||||
scanner->max_parse_errors = 0;
|
scanner->max_parse_errors = 1;
|
||||||
scanner->parse_errors = 0;
|
scanner->parse_errors = 0;
|
||||||
scanner->input_name = NULL;
|
scanner->input_name = NULL;
|
||||||
g_datalist_init (&scanner->qdata);
|
g_datalist_init (&scanner->qdata);
|
||||||
@ -994,7 +994,10 @@ g_scanner_unexp_token (GScanner *scanner,
|
|||||||
switch (expected_token)
|
switch (expected_token)
|
||||||
{
|
{
|
||||||
gboolean need_valid;
|
gboolean need_valid;
|
||||||
|
gchar *tstring;
|
||||||
|
case G_TOKEN_EOF:
|
||||||
|
g_snprintf (expected_string, expected_string_len, "end of file");
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
if (expected_token >= 1 && expected_token <= 255)
|
if (expected_token >= 1 && expected_token <= 255)
|
||||||
{
|
{
|
||||||
@ -1023,39 +1026,64 @@ g_scanner_unexp_token (GScanner *scanner,
|
|||||||
symbol_spec);
|
symbol_spec);
|
||||||
/* FIXME: should we attempt to lookup the symbol_name for symbol_2_token? */
|
/* FIXME: should we attempt to lookup the symbol_name for symbol_2_token? */
|
||||||
break;
|
break;
|
||||||
|
case G_TOKEN_CHAR:
|
||||||
|
g_snprintf (expected_string, expected_string_len, "%scharacter",
|
||||||
|
scanner->token == G_TOKEN_CHAR ? "valid " : "");
|
||||||
|
break;
|
||||||
|
case G_TOKEN_BINARY:
|
||||||
|
tstring = "binary";
|
||||||
|
g_snprintf (expected_string, expected_string_len, "%snumber (%s)",
|
||||||
|
scanner->token == expected_token ? "valid " : "", tstring);
|
||||||
|
break;
|
||||||
|
case G_TOKEN_OCTAL:
|
||||||
|
tstring = "octal";
|
||||||
|
g_snprintf (expected_string, expected_string_len, "%snumber (%s)",
|
||||||
|
scanner->token == expected_token ? "valid " : "", tstring);
|
||||||
|
break;
|
||||||
case G_TOKEN_INT:
|
case G_TOKEN_INT:
|
||||||
g_snprintf (expected_string, expected_string_len, "%snumber (integer)",
|
tstring = "integer";
|
||||||
scanner->token == G_TOKEN_INT ? "valid " : "");
|
g_snprintf (expected_string, expected_string_len, "%snumber (%s)",
|
||||||
|
scanner->token == expected_token ? "valid " : "", tstring);
|
||||||
|
break;
|
||||||
|
case G_TOKEN_HEX:
|
||||||
|
tstring = "hexadecimal";
|
||||||
|
g_snprintf (expected_string, expected_string_len, "%snumber (%s)",
|
||||||
|
scanner->token == expected_token ? "valid " : "", tstring);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case G_TOKEN_FLOAT:
|
case G_TOKEN_FLOAT:
|
||||||
g_snprintf (expected_string, expected_string_len, "%snumber (float)",
|
tstring = "float";
|
||||||
scanner->token == G_TOKEN_FLOAT ? "valid " : "");
|
g_snprintf (expected_string, expected_string_len, "%snumber (%s)",
|
||||||
|
scanner->token == expected_token ? "valid " : "", tstring);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case G_TOKEN_STRING:
|
case G_TOKEN_STRING:
|
||||||
g_snprintf (expected_string,
|
g_snprintf (expected_string,
|
||||||
expected_string_len,
|
expected_string_len,
|
||||||
"%sstring constant",
|
"%sstring constant",
|
||||||
scanner->token == G_TOKEN_STRING ? "valid " : "");
|
scanner->token == G_TOKEN_STRING ? "valid " : "");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case G_TOKEN_IDENTIFIER:
|
case G_TOKEN_IDENTIFIER:
|
||||||
case G_TOKEN_IDENTIFIER_NULL:
|
case G_TOKEN_IDENTIFIER_NULL:
|
||||||
|
need_valid = (scanner->token == G_TOKEN_IDENTIFIER_NULL ||
|
||||||
|
scanner->token == G_TOKEN_IDENTIFIER);
|
||||||
g_snprintf (expected_string,
|
g_snprintf (expected_string,
|
||||||
expected_string_len,
|
expected_string_len,
|
||||||
"%s%s",
|
"%s%s",
|
||||||
(scanner->token == G_TOKEN_IDENTIFIER_NULL ||
|
need_valid ? "valid " : "",
|
||||||
scanner->token == G_TOKEN_IDENTIFIER ? "valid " : ""),
|
|
||||||
identifier_spec);
|
identifier_spec);
|
||||||
break;
|
break;
|
||||||
|
case G_TOKEN_COMMENT_SINGLE:
|
||||||
case G_TOKEN_EOF:
|
tstring = "single-line";
|
||||||
g_snprintf (expected_string, expected_string_len, "end of file");
|
g_snprintf (expected_string, expected_string_len, "%scomment (%s)",
|
||||||
|
scanner->token == expected_token ? "valid " : "", tstring);
|
||||||
|
break;
|
||||||
|
case G_TOKEN_COMMENT_MULTI:
|
||||||
|
tstring = "multi-line";
|
||||||
|
g_snprintf (expected_string, expected_string_len, "%scomment (%s)",
|
||||||
|
scanner->token == expected_token ? "valid " : "", tstring);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case G_TOKEN_NONE:
|
case G_TOKEN_NONE:
|
||||||
|
case G_TOKEN_ERROR:
|
||||||
|
/* this is handled upon printout */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1066,8 +1094,30 @@ g_scanner_unexp_token (GScanner *scanner,
|
|||||||
message_prefix = "";
|
message_prefix = "";
|
||||||
message = "";
|
message = "";
|
||||||
}
|
}
|
||||||
|
if (expected_token == G_TOKEN_ERROR)
|
||||||
if (expected_token != G_TOKEN_NONE)
|
{
|
||||||
|
msg_handler (scanner,
|
||||||
|
"failure around %s%s%s",
|
||||||
|
token_string,
|
||||||
|
message_prefix,
|
||||||
|
message);
|
||||||
|
}
|
||||||
|
else if (expected_token == G_TOKEN_NONE)
|
||||||
|
{
|
||||||
|
if (print_unexp)
|
||||||
|
msg_handler (scanner,
|
||||||
|
"unexpected %s%s%s",
|
||||||
|
token_string,
|
||||||
|
message_prefix,
|
||||||
|
message);
|
||||||
|
else
|
||||||
|
msg_handler (scanner,
|
||||||
|
"%s%s%s",
|
||||||
|
token_string,
|
||||||
|
message_prefix,
|
||||||
|
message);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
if (print_unexp)
|
if (print_unexp)
|
||||||
msg_handler (scanner,
|
msg_handler (scanner,
|
||||||
@ -1084,21 +1134,6 @@ g_scanner_unexp_token (GScanner *scanner,
|
|||||||
message_prefix,
|
message_prefix,
|
||||||
message);
|
message);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
if (print_unexp)
|
|
||||||
msg_handler (scanner,
|
|
||||||
"unexpected %s%s%s",
|
|
||||||
token_string,
|
|
||||||
message_prefix,
|
|
||||||
message);
|
|
||||||
else
|
|
||||||
msg_handler (scanner,
|
|
||||||
"%s%s%s",
|
|
||||||
token_string,
|
|
||||||
message_prefix,
|
|
||||||
message);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_free (token_string);
|
g_free (token_string);
|
||||||
g_free (expected_string);
|
g_free (expected_string);
|
||||||
|
Loading…
Reference in New Issue
Block a user