Commit f0c20b2d authored by Francois Gouget's avatar Francois Gouget Committed by Alexandre Julliard

Wrc no longer needs to parse C code. Remove c-junk handling code.

parent ee6ea51c
......@@ -20,9 +20,6 @@ extern char *yytext;
extern int yy_flex_debug;
int yylex(void);
void set_pp_ignore(int state);
void strip_til_semicolon(void);
void strip_til_parenthesis(void);
#endif
......@@ -173,9 +173,7 @@ static struct keyword keywords[] = {
{ "DLGINIT", tDLGINIT, 0, 0, 0},
{ "EDITTEXT", tEDITTEXT, 0, 0, 0},
{ "END", tEND, 0, 0, 0},
{ "enum", tENUM, 0, 1, 1},
{ "EXSTYLE", tEXSTYLE, 0, 0, 0},
{ "extern", tEXTERN, 0, 1, 1},
{ "FILEFLAGS", tFILEFLAGS, 0, 0, 0},
{ "FILEFLAGSMASK", tFILEFLAGSMASK, 0, 0, 0},
{ "FILEOS", tFILEOS, 0, 0, 0},
......@@ -191,7 +189,6 @@ static struct keyword keywords[] = {
{ "ICON", tICON, 0, 0, 0},
{ "IMPURE", tIMPURE, 0, 0, 0},
{ "INACTIVE", tINACTIVE, 0, 0, 0},
{ "inline", tINLINE, 0, 1, 1},
{ "LANGUAGE", tLANGUAGE, 1, 0, 1},
{ "LISTBOX", tLISTBOX, 0, 0, 0},
{ "LOADONCALL", tLOADONCALL, 0, 0, 0},
......@@ -217,13 +214,10 @@ static struct keyword keywords[] = {
{ "SEPARATOR", tSEPARATOR, 0, 0, 0},
{ "SHIFT", tSHIFT, 0, 0, 0},
{ "STATE3", tSTATE3, 1, 0, 0},
{ "static", tSTATIC, 0, 1, 1},
{ "STRING", tSTRING, 0, 0, 0},
{ "STRINGTABLE", tSTRINGTABLE, 0, 0, 1},
{ "struct", tSTRUCT, 0, 1, 1},
{ "STYLE", tSTYLE, 0, 0, 0},
{ "TOOLBAR", tTOOLBAR, 1, 0, 0},
{ "typedef", tTYPEDEF, 0, 1, 1},
{ "VALUE", tVALUE, 0, 0, 0},
{ "VERSION", tVERSION, 1, 0, 0},
{ "VERSIONINFO", tVERSIONINFO, 0, 0, 0},
......@@ -380,9 +374,7 @@ static struct keyword *iskeyword(char *kw)
if(tok)
{
if(tok->token == tCLASS && !strcmp(yytext, "class"))
return tCPPCLASS;
else if(wanted_id && !tok->alwayskw)
if(wanted_id && !tok->alwayskw)
{
yylval.str = make_string(yytext);
return tIDENT;
......@@ -427,7 +419,7 @@ L\" {
}
<yylstr>\\x[0-9a-fA-F]{1,3} { yyerror("Invalid hex escape sequence '%s'", yytext); }
<yylstr>\\[0-9]+ yyerror("Bad escape secuence");
<yylstr>\\[0-9]+ yyerror("Bad escape sequence");
<yylstr>\\a addwchar('\a');
<yylstr>\\b addwchar('\b');
<yylstr>\\f addwchar('\f');
......@@ -644,24 +636,3 @@ static string_t *make_string(char *s)
memcpy(str->str.cstr, s, str->size+1);
return str;
}
/* Called from the parser to kill c-junk */
void strip_extern(void)
{
cjunk_tagline = line_number;
yy_push_state(pp_stripe);
}
void strip_til_semicolon(void)
{
cjunk_tagline = line_number;
yy_push_state(pp_strips);
}
void strip_til_parenthesis(void)
{
cjunk_tagline = line_number;
stripplevel = 1; /* One scanned already */
yy_push_state(pp_stripp);
}
......@@ -19,7 +19,7 @@
* 14-Jan-2000 BS - Redid the usertype resources so that they
* are compatible.
* 02-Jan-2000 BS - Removed the preprocessor from the grammar
* expect for the # command (line numbers).
* except for the # command (line numbers).
*
* 06-Nov-1999 JS - see CHANGES
*
......@@ -264,7 +264,7 @@ static int rsrcid_to_token(int lookahead);
ani_any_t *ani;
}
%token tTYPEDEF tEXTERN tSTRUCT tENUM tCPPCLASS tINLINE tSTATIC tNL
%token tNL
%token <num> tNUMBER tLNUMBER
%token <str> tSTRING tIDENT tFILENAME
%token <raw> tRAWDATA
......@@ -423,49 +423,9 @@ resources
want_id = 1;
dont_want_id = 0;
}
| resources cjunk { $$ = $1; want_id = 1; }
;
/* C ignore stuff */
cjunk : tTYPEDEF { strip_til_semicolon(); }
| tSTRUCT { strip_til_semicolon(); }
| tEXTERN { strip_til_semicolon(); }
| tENUM { strip_til_semicolon(); }
| tCPPCLASS { strip_til_semicolon(); }
| tSTATIC { strip_til_semicolon(); }
| tINLINE { internal_error(__FILE__, __LINE__, "Don't yet know how to strip inline functions\n"); }
/* | tIDENT tIDENT { strip_til_semicolon(); } */
/* | tIDENT tIDENT '(' { strip_til_parenthesis(); } See comments in 'resource' below */
/* | tIDENT '(' { strip_til_parenthesis(); } */
| tIDENT '*' { strip_til_semicolon(); }
| tNL /*
* This newline rule will never get reduced because we never
* get the tNL token, unless we explicitely set the 'want_nl'
* flag, which we don't.
* The *ONLY* reason for this to be here is because Berkeley
* yacc (byacc), at least version 1.9, has a bug.
* (identified in the generated parser on the second
* line with:
* static char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
* )
* This extra rule fixes it.
* The problem is that the expression handling rule "expr: xpr"
* is not reduced on non-terminal tokens, defined above in the
* %token declarations. Token tNL is the only non-terminal that
* can occur. The error becomes visible in the language parsing
* rule below, which looks at the look-ahead token and tests it
* for tNL. However, byacc already generates an error upon reading
* the token instead of keeping it as a lookahead. The reason
* lies in the lack of a $default transition in the "expr : xpr . "
* state (currently state 25). It is probably ommitted because tNL
* is a non-terminal and the state contains 2 s/r conflicts. The
* state enumerates all possible transitions instead of using a
* $default transition.
* All in all, it is a bug in byacc. (period)
*/
;
/* Parse top level resource definitions etc. */
resource
: expr usrcvt resource_definition {
......@@ -490,27 +450,6 @@ resource
chat("Got %s (%s)", get_typename($3), $$->name->name.s_name->str.cstr);
}
}
| tIDENT usrcvt tIDENT '(' { /* cjunk */ strip_til_parenthesis(); $$ = NULL; }
/* The above rule is inserted here with explicit tIDENT
* references to avoid a nasty LALR(2) problem when
* considering the 'cjunk' rules with respect to the usertype
* resources.
* A usertype resource can have two leading identifiers before
* it qualifies as shift into usertype rules. However, the
* cjunk scanner also has a rule of two leading identifiers.
* The problem occurs because the second identifier is at the
* second lookahead (hence LALR(2)) seen from the recursion
* rule 'resources'.
* Thus, the scanner will pick *one* of the rules in preference
* of the other (in this case it was 'cjunk') and generates a
* syntax error if the trailing context wasn't seen. The
* correct action would have been to rollback the stack and
* decent into the 'userres' rule, but this cannot be done
* because yacc only parses LALR(1).
* The problem is prevented from happening by making the decent
* into the cjunk-scanning obsolete and explicitly force the
* scanner to require no more than 1 lookahead.
*/
| stringtable {
/* Don't do anything, stringtables are converted to
* resource_t structures when we are finished parsing and
......@@ -869,7 +808,6 @@ dlg_attributes
| dlg_attributes tCAPTION tSTRING { $$=dialog_caption($3,$1); }
| dlg_attributes opt_font { $$=dialog_font($2,$1); }
| dlg_attributes tCLASS nameid_s { $$=dialog_class($3,$1); }
| dlg_attributes tCPPCLASS nameid_s { $$=dialog_class($3,$1); }
| dlg_attributes tMENU nameid { $$=dialog_menu($3,$1); }
| dlg_attributes opt_language { $$=dialog_language($2,$1); }
| dlg_attributes opt_characts { $$=dialog_characteristics($2,$1); }
......@@ -1082,7 +1020,6 @@ dlgex_attribs
| dlgex_attribs opt_font { $$=dialogex_font($2,$1); }
| dlgex_attribs opt_exfont { $$=dialogex_font($2,$1); }
| dlgex_attribs tCLASS nameid_s { $$=dialogex_class($3,$1); }
| dlgex_attribs tCPPCLASS nameid_s { $$=dialogex_class($3,$1); }
| dlgex_attribs tMENU nameid { $$=dialogex_menu($3,$1); }
| dlgex_attribs opt_language { $$=dialogex_language($2,$1); }
| dlgex_attribs opt_characts { $$=dialogex_characteristics($2,$1); }
......
......@@ -15,8 +15,6 @@
#include "preproc.h"
extern void set_pp_ignore(int); /* From parser.l */
#define HASHKEY 2039
static pp_entry_t *pp_defines[HASHKEY];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment