Skip to content
Permalink
Browse files

DIRECTOR: LINGO: Renamed union fields to avoid semantic clashes

  • Loading branch information
sev- committed Jan 14, 2020
1 parent 2db9d5b commit bd3031552b35944d07cfb1af62c2deb88ab570a9
@@ -243,8 +243,8 @@ union YYSTYPE
Common::Array<double> *arr;

struct {
Common::String *s;
int e;
Common::String *os;
int oe;
} objectfield;

#line 251 "engines/director/lingo/lingo-gr.cpp"
@@ -1702,7 +1702,7 @@ yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)

case 28: /* THEOBJECTFIELD */
#line 131 "engines/director/lingo/lingo-gr.y"
{ delete ((*yyvaluep).objectfield).s; }
{ delete ((*yyvaluep).objectfield).os; }
#line 1707 "engines/director/lingo/lingo-gr.cpp"
break;

@@ -2085,9 +2085,9 @@ yyparse (void)
#line 194 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(LC::c_objectfieldassign);
g_lingo->codeString((yyvsp[-2].objectfield).s->c_str());
g_lingo->codeInt((yyvsp[-2].objectfield).e);
delete (yyvsp[-2].objectfield).s;
g_lingo->codeString((yyvsp[-2].objectfield).os->c_str());
g_lingo->codeInt((yyvsp[-2].objectfield).oe);
delete (yyvsp[-2].objectfield).os;
(yyval.code) = (yyvsp[0].code); }
#line 2093 "engines/director/lingo/lingo-gr.cpp"
break;
@@ -2398,9 +2398,9 @@ yyparse (void)
#line 416 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(LC::c_objectfieldpush);
g_lingo->codeString((yyvsp[0].objectfield).s->c_str());
g_lingo->codeInt((yyvsp[0].objectfield).e);
delete (yyvsp[0].objectfield).s; }
g_lingo->codeString((yyvsp[0].objectfield).os->c_str());
g_lingo->codeInt((yyvsp[0].objectfield).oe);
delete (yyvsp[0].objectfield).os; }
#line 2405 "engines/director/lingo/lingo-gr.cpp"
break;

@@ -147,8 +147,8 @@ union YYSTYPE
Common::Array<double> *arr;

struct {
Common::String *s;
int e;
Common::String *os;
int oe;
} objectfield;

#line 155 "engines/director/lingo/lingo-gr.h"
@@ -93,8 +93,8 @@ void checkEnd(Common::String *token, const char *expect, bool required) {
Common::Array<double> *arr;

struct {
Common::String *s;
int e;
Common::String *os;
int oe;
} objectfield;
}

@@ -128,7 +128,7 @@ void checkEnd(Common::String *token, const char *expect, bool required) {
%right UNARY

%destructor { delete $$; } <s>
%destructor { delete $$.s; } <objectfield>
%destructor { delete $$.os; } <objectfield>

%%

@@ -193,9 +193,9 @@ asgn: tPUT expr tINTO ID {
$$ = $expr; }
| tSET THEOBJECTFIELD tTO expr {
g_lingo->code1(LC::c_objectfieldassign);
g_lingo->codeString($THEOBJECTFIELD.s->c_str());
g_lingo->codeInt($THEOBJECTFIELD.e);
delete $THEOBJECTFIELD.s;
g_lingo->codeString($THEOBJECTFIELD.os->c_str());
g_lingo->codeInt($THEOBJECTFIELD.oe);
delete $THEOBJECTFIELD.os;
$$ = $expr; }
;

@@ -415,9 +415,9 @@ expr: simpleexpr { $$ = $simpleexpr; }
g_lingo->code2(e, f); }
| THEOBJECTFIELD {
g_lingo->code1(LC::c_objectfieldpush);
g_lingo->codeString($THEOBJECTFIELD.s->c_str());
g_lingo->codeInt($THEOBJECTFIELD.e);
delete $THEOBJECTFIELD.s; }
g_lingo->codeString($THEOBJECTFIELD.os->c_str());
g_lingo->codeInt($THEOBJECTFIELD.oe);
delete $THEOBJECTFIELD.os; }
| asgn
| expr '+' expr { g_lingo->code1(LC::c_add); }
| expr '-' expr { g_lingo->code1(LC::c_sub); }
@@ -1449,8 +1449,8 @@ YY_RULE_SETUP
error("LEXER: Unhandled the field '%s' for object", field.c_str());
}

yylval.objectfield.s = new Common::String(ptr);
yylval.objectfield.e = g_lingo->_theEntityFields[field]->field;
yylval.objectfield.os = new Common::String(ptr);
yylval.objectfield.oe = g_lingo->_theEntityFields[field]->field;

return THEOBJECTFIELD;
}
@@ -245,8 +245,8 @@ whitespace [\t ]
error("LEXER: Unhandled the field '%s' for object", field.c_str());
}
yylval.objectfield.s = new Common::String(ptr);
yylval.objectfield.e = g_lingo->_theEntityFields[field]->field;
yylval.objectfield.os = new Common::String(ptr);
yylval.objectfield.oe = g_lingo->_theEntityFields[field]->field;
return THEOBJECTFIELD;
}

0 comments on commit bd30315

Please sign in to comment.
You can’t perform that action at this time.