aboutsummaryrefslogtreecommitdiff
path: root/engines/director/lingo/lingo-gr.y
diff options
context:
space:
mode:
authorEugene Sandulenko2016-07-12 12:30:08 +0200
committerEugene Sandulenko2016-08-03 23:40:36 +0200
commit9763b62a78ba51b328fe336926a40fa0ffdde0be (patch)
tree94f75ba2be787530934b6ed9fece5f8339429d84 /engines/director/lingo/lingo-gr.y
parente15915b6a30d56a77c99eb9b3871cc75b4034b9c (diff)
downloadscummvm-rg350-9763b62a78ba51b328fe336926a40fa0ffdde0be.tar.gz
scummvm-rg350-9763b62a78ba51b328fe336926a40fa0ffdde0be.tar.bz2
scummvm-rg350-9763b62a78ba51b328fe336926a40fa0ffdde0be.zip
DIRECTOR: Lingo: Implement getting the entity fields
Diffstat (limited to 'engines/director/lingo/lingo-gr.y')
-rw-r--r--engines/director/lingo/lingo-gr.y35
1 files changed, 22 insertions, 13 deletions
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index f830505713..cc0d1fdfb7 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -70,12 +70,14 @@ void yyerror(char *s) {
Common::String *s;
int i;
double f;
+ int e[2]; // Entity + field
int code;
int narg; /* number of arguments */
}
%token CASTREF UNARY VOID VAR
-%token<i> INT THEENTITY THEENTITYWITHID THEFIELD
+%token<i> INT
+%token<e> THEENTITY THEENTITYWITHID
%token<f> FLOAT
%token<s> BLTIN ID STRING HANDLER
%token tDOWN tELSE tNLELSIF tEND tEXIT tFRAME tGLOBAL tGO tIF tINTO tLOOP tMACRO
@@ -126,12 +128,12 @@ asgn: tPUT expr tINTO ID {
$$ = $4;
delete $2; }
| tSET THEENTITY '=' expr {
+ g_lingo->code2(g_lingo->c_constpush, 0); // Put dummy id
g_lingo->code1(g_lingo->c_theentityassign);
- inst e = 0, f = 0, i = 0;
- WRITE_UINT32(&e, $2);
- WRITE_UINT32(&f, 0);
- WRITE_UINT32(&i, 0);
- g_lingo->code3(e, f, i);
+ inst e = 0, f = 0;
+ WRITE_UINT32(&e, $2[0]);
+ WRITE_UINT32(&f, $2[1]);
+ g_lingo->code2(e, f);
$$ = $4; }
| tSET ID tTO expr {
g_lingo->code1(g_lingo->c_varpush);
@@ -140,10 +142,11 @@ asgn: tPUT expr tINTO ID {
$$ = $4;
delete $2; }
| tSET THEENTITY tTO expr {
+ g_lingo->code2(g_lingo->c_constpush, 0); // Put dummy id
g_lingo->code1(g_lingo->c_theentityassign);
inst e = 0, f = 0;
- WRITE_UINT32(&e, $2);
- WRITE_UINT32(&f, 0);
+ WRITE_UINT32(&e, $2[0]);
+ WRITE_UINT32(&f, $2[1]);
g_lingo->code2(e, f);
$$ = $4; }
;
@@ -345,12 +348,18 @@ expr: INT {
$$ = g_lingo->codeId(*$1);
delete $1; }
| THEENTITY {
+ $$ = g_lingo->code2(g_lingo->c_constpush, 0); // Put dummy id
+ g_lingo->code1(g_lingo->c_theentitypush);
+ inst e = 0, f = 0;
+ WRITE_UINT32(&e, $1[0]);
+ WRITE_UINT32(&f, $1[1]);
+ g_lingo->code2(e, f); }
+ | THEENTITYWITHID expr {
$$ = g_lingo->code1(g_lingo->c_theentitypush);
- inst e = 0, f = 0, i = 0;
- WRITE_UINT32(&e, $1);
- WRITE_UINT32(&f, 0);
- WRITE_UINT32(&i, 0);
- g_lingo->code3(e, f, i); }
+ inst e = 0, f = 0;
+ WRITE_UINT32(&e, $1[0]);
+ WRITE_UINT32(&f, $1[1]);
+ g_lingo->code2(e, f); }
| asgn
| expr '+' expr { g_lingo->code1(g_lingo->c_add); }
| expr '-' expr { g_lingo->code1(g_lingo->c_sub); }