* rcparse.y: Remove newcmd rule. Move rcparse_discard_strings

call to rules that need no lookahead.  Check for no lookahead.

	* rclex.l (get_string): Correct "strings" list handling.
	* resrc.c (read_rc_file): Discard strings.
This commit is contained in:
Alan Modra 2002-05-05 23:19:32 +00:00
parent 3a036cdc8b
commit 405c98a4e3
4 changed files with 78 additions and 23 deletions

View File

@ -1,3 +1,13 @@
2002-05-06 Alan Modra <amodra@bigpond.net.au>
* rcparse.y: Remove newcmd rule. Move rcparse_discard_strings
calls to rules that need no lookahead. Check for no lookahead.
2002-05-06 Borut Razem <borut.razem@siol.net>
* rclex.l (get_string): Correct "strings" list handling.
* resrc.c (read_rc_file): Discard strings.
2002-05-04 Alan Modra <amodra@bigpond.net.au> 2002-05-04 Alan Modra <amodra@bigpond.net.au>
* ar.c (replace_members): Remove unused var. Formatting fix. * ar.c (replace_members): Remove unused var. Formatting fix.

View File

@ -452,7 +452,7 @@ get_string (len)
as->s = xmalloc (len); as->s = xmalloc (len);
as->next = strings; as->next = strings;
strings = as->next; strings = as;
return as->s; return as->s;
} }

View File

@ -153,28 +153,21 @@ static unsigned long class;
input: input:
/* empty */ /* empty */
| input newcmd accelerator | input accelerator
| input newcmd bitmap | input bitmap
| input newcmd cursor | input cursor
| input newcmd dialog | input dialog
| input newcmd font | input font
| input newcmd icon | input icon
| input newcmd language | input language
| input newcmd menu | input menu
| input newcmd menuex | input menuex
| input newcmd messagetable | input messagetable
| input newcmd rcdata | input rcdata
| input newcmd stringtable | input stringtable
| input newcmd user | input user
| input newcmd versioninfo | input versioninfo
| input newcmd IGNORED_TOKEN | input IGNORED_TOKEN
;
newcmd:
/* empty */
{
rcparse_discard_strings ();
}
; ;
/* Accelerator resources. */ /* Accelerator resources. */
@ -183,6 +176,9 @@ accelerator:
id ACCELERATORS suboptions BEG acc_entries END id ACCELERATORS suboptions BEG acc_entries END
{ {
define_accelerator ($1, &$3, $5); define_accelerator ($1, &$3, $5);
if (yychar != YYEMPTY)
YYERROR;
rcparse_discard_strings ();
} }
; ;
@ -309,6 +305,9 @@ bitmap:
id BITMAP memflags_move file_name id BITMAP memflags_move file_name
{ {
define_bitmap ($1, &$3, $4); define_bitmap ($1, &$3, $4);
if (yychar != YYEMPTY)
YYERROR;
rcparse_discard_strings ();
} }
; ;
@ -318,6 +317,9 @@ cursor:
id CURSOR memflags_move_discard file_name id CURSOR memflags_move_discard file_name
{ {
define_cursor ($1, &$3, $4); define_cursor ($1, &$3, $4);
if (yychar != YYEMPTY)
YYERROR;
rcparse_discard_strings ();
} }
; ;
@ -345,6 +347,9 @@ dialog:
styles BEG controls END styles BEG controls END
{ {
define_dialog ($1, &sub_res_info, &dialog); define_dialog ($1, &sub_res_info, &dialog);
if (yychar != YYEMPTY)
YYERROR;
rcparse_discard_strings ();
} }
| id DIALOGEX memflags_move exstyle posnumexpr cnumexpr cnumexpr | id DIALOGEX memflags_move exstyle posnumexpr cnumexpr cnumexpr
cnumexpr cnumexpr
@ -369,6 +374,9 @@ dialog:
styles BEG controls END styles BEG controls END
{ {
define_dialog ($1, &sub_res_info, &dialog); define_dialog ($1, &sub_res_info, &dialog);
if (yychar != YYEMPTY)
YYERROR;
rcparse_discard_strings ();
} }
| id DIALOGEX memflags_move exstyle posnumexpr cnumexpr cnumexpr | id DIALOGEX memflags_move exstyle posnumexpr cnumexpr cnumexpr
cnumexpr cnumexpr cnumexpr cnumexpr
@ -394,6 +402,9 @@ dialog:
styles BEG controls END styles BEG controls END
{ {
define_dialog ($1, &sub_res_info, &dialog); define_dialog ($1, &sub_res_info, &dialog);
if (yychar != YYEMPTY)
YYERROR;
rcparse_discard_strings ();
} }
; ;
@ -902,6 +913,9 @@ font:
id FONT memflags_move_discard file_name id FONT memflags_move_discard file_name
{ {
define_font ($1, &$3, $4); define_font ($1, &$3, $4);
if (yychar != YYEMPTY)
YYERROR;
rcparse_discard_strings ();
} }
; ;
@ -911,6 +925,9 @@ icon:
id ICON memflags_move_discard file_name id ICON memflags_move_discard file_name
{ {
define_icon ($1, &$3, $4); define_icon ($1, &$3, $4);
if (yychar != YYEMPTY)
YYERROR;
rcparse_discard_strings ();
} }
; ;
@ -930,6 +947,9 @@ menu:
id MENU suboptions BEG menuitems END id MENU suboptions BEG menuitems END
{ {
define_menu ($1, &$3, $5); define_menu ($1, &$3, $5);
if (yychar != YYEMPTY)
YYERROR;
rcparse_discard_strings ();
} }
; ;
@ -1017,6 +1037,9 @@ menuex:
id MENUEX suboptions BEG menuexitems END id MENUEX suboptions BEG menuexitems END
{ {
define_menu ($1, &$3, $5); define_menu ($1, &$3, $5);
if (yychar != YYEMPTY)
YYERROR;
rcparse_discard_strings ();
} }
; ;
@ -1083,6 +1106,9 @@ messagetable:
id MESSAGETABLE memflags_move file_name id MESSAGETABLE memflags_move file_name
{ {
define_messagetable ($1, &$3, $4); define_messagetable ($1, &$3, $4);
if (yychar != YYEMPTY)
YYERROR;
rcparse_discard_strings ();
} }
; ;
@ -1092,6 +1118,9 @@ rcdata:
id RCDATA suboptions BEG optrcdata_data END id RCDATA suboptions BEG optrcdata_data END
{ {
define_rcdata ($1, &$3, $5.first); define_rcdata ($1, &$3, $5.first);
if (yychar != YYEMPTY)
YYERROR;
rcparse_discard_strings ();
} }
; ;
@ -1171,10 +1200,16 @@ string_data:
| string_data numexpr QUOTEDSTRING | string_data numexpr QUOTEDSTRING
{ {
define_stringtable (&sub_res_info, $2, $3); define_stringtable (&sub_res_info, $2, $3);
if (yychar != YYEMPTY)
YYERROR;
rcparse_discard_strings ();
} }
| string_data numexpr ',' QUOTEDSTRING | string_data numexpr ',' QUOTEDSTRING
{ {
define_stringtable (&sub_res_info, $2, $4); define_stringtable (&sub_res_info, $2, $4);
if (yychar != YYEMPTY)
YYERROR;
rcparse_discard_strings ();
} }
; ;
@ -1185,10 +1220,16 @@ user:
id id suboptions BEG optrcdata_data END id id suboptions BEG optrcdata_data END
{ {
define_user_data ($1, $2, &$3, $5.first); define_user_data ($1, $2, &$3, $5.first);
if (yychar != YYEMPTY)
YYERROR;
rcparse_discard_strings ();
} }
| id id suboptions file_name | id id suboptions file_name
{ {
define_user_file ($1, $2, &$3, $4); define_user_file ($1, $2, &$3, $4);
if (yychar != YYEMPTY)
YYERROR;
rcparse_discard_strings ();
} }
; ;
@ -1198,6 +1239,9 @@ versioninfo:
id VERSIONINFO fixedverinfo BEG verblocks END id VERSIONINFO fixedverinfo BEG verblocks END
{ {
define_versioninfo ($1, language, $3, $5); define_versioninfo ($1, language, $3, $5);
if (yychar != YYEMPTY)
YYERROR;
rcparse_discard_strings ();
} }
; ;

View File

@ -481,6 +481,7 @@ read_rc_file (filename, preprocessor, preprocargs, language, use_temp_file)
rcparse_set_language (language); rcparse_set_language (language);
yyin = cpp_pipe; yyin = cpp_pipe;
yyparse (); yyparse ();
rcparse_discard_strings ();
close_input_stream (); close_input_stream ();