Commit c5a46ba9 authored by Bertho Stultiens's avatar Bertho Stultiens Committed by Alexandre Julliard

Fixed a LALR(2) problem while scanning usertype resources which had

identifiers for both name and type.
parent 9e0ae86d
......@@ -6,3 +6,8 @@ ppy.tab.h
wrc
y.tab.c
y.tab.h
ppy.tab.c
ppy.tab.h
y.output
ppy.output
lex.backup
---------------------------------------------------------------------------
Version 1.1.8 (24-Aug-2000)
Bertho Stultiens <bertho@akhphd.au.dk>
- Fixed a LALR(2) problem while scanning usertype resources which
had identifiers for both name and type.
---------------------------------------------------------------------------
Version 1.1.7 (24-Jul-2000)
Bertho Stultiens <bertho@akhphd.au.dk>
......
Release 1.1.7 of wrc (24-Jul-2000), the wine resource compiler.
Release 1.1.8 of wrc (24-Aug-2000), the wine resource compiler.
See the file CHANGES for differences between the version and what has been
corrected in the current version.
......@@ -113,7 +113,7 @@ __DATE__ | "May 1 2000" | Datestring of compilation
__WRC__  1 | Wrc's major version
__WRC_MINOR__ | 1 | Wrc's minor version
__WRC_MICRO__ | 7 | Wrc's minor version
__WRC_PATCH__ | 7 | Alias of __WRC_MICRO__
__WRC_PATCH__ | 8 | Alias of __WRC_MICRO__
Include-files are not read twice if they are protected with this scheme:
#ifndef SOME_DEFINE
......
......@@ -435,7 +435,7 @@ cjunk : tTYPEDEF { 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(); }
/* | tIDENT tIDENT '(' { strip_til_parenthesis(); } See comments in 'resource' below */
/* | tIDENT '(' { strip_til_parenthesis(); } */
| tIDENT '*' { strip_til_semicolon(); }
| tNL /*
......@@ -467,21 +467,49 @@ cjunk : tTYPEDEF { strip_til_semicolon(); }
/* Parse top level resource definitions etc. */
resource
: nameid usrcvt resource_definition {
: expr usrcvt resource_definition {
$$ = $3;
if($$)
{
$$->name = $1;
if($1->type == name_ord)
{
chat("Got %s (%d)",get_typename($3),$1->name.i_name);
if($1 > 65535 || $1 < -32768)
yyerror("Resource's ID out of range (%d)", $1);
$$->name = new_name_id();
$$->name->type = name_ord;
$$->name->name.i_name = $1;
chat("Got %s (%d)", get_typename($3), $$->name->name.i_name);
}
else if($1->type == name_str)
{
chat("Got %s (%s)",get_typename($3),$1->name.s_name->str.cstr);
}
}
}
| tIDENT usrcvt resource_definition {
$$ = $3;
if($$)
{
$$->name = new_name_id();
$$->name->type = name_str;
$$->name->name.s_name = $1;
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
......
......@@ -16,8 +16,8 @@
#define WRC_MAJOR_VERSION 1
#define WRC_MINOR_VERSION 1
#define WRC_MICRO_VERSION 7
#define WRC_RELEASEDATE "(24-Jul-2000)"
#define WRC_MICRO_VERSION 8
#define WRC_RELEASEDATE "(24-Aug-2000)"
#define WRC_STRINGIZE(a) #a
#define WRC_EXP_STRINGIZE(a) WRC_STRINGIZE(a)
......
.TH WRC 1 "July 24, 2000" "Version 1.1.7" "Wine Resource Compiler"
.TH WRC 1 "August 24, 2000" "Version 1.1.8" "Wine Resource Compiler"
.SH NAME
wrc \- Wine Resource Compiler
.SH SYNOPSIS
......
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