aboutsummaryrefslogtreecommitdiff
path: root/engines/director/lingo/lingo-gr.y
diff options
context:
space:
mode:
authorEugene Sandulenko2016-07-10 16:43:53 +0200
committerEugene Sandulenko2016-08-03 23:40:36 +0200
commitdff575bea4451113a8268709d2b0c4c8004f61a6 (patch)
tree8379202e2a2755c327fab3af453ab24ff8e4917b /engines/director/lingo/lingo-gr.y
parentaa45e48355e670b2d8807515fa3158c0a130fcfb (diff)
downloadscummvm-rg350-dff575bea4451113a8268709d2b0c4c8004f61a6.tar.gz
scummvm-rg350-dff575bea4451113a8268709d2b0c4c8004f61a6.tar.bz2
scummvm-rg350-dff575bea4451113a8268709d2b0c4c8004f61a6.zip
DIRECTOR: Lingo: Further work on if() statement
Diffstat (limited to 'engines/director/lingo/lingo-gr.y')
-rw-r--r--engines/director/lingo/lingo-gr.y21
1 files changed, 11 insertions, 10 deletions
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 4e1778fb7b..f88e36db51 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -75,7 +75,7 @@ void yyerror(char *s) { g_lingo->_hadError = true; warning("%s at line %d col %d
%token<i> INT
%token<f> FLOAT
%token<s> BLTIN ID STRING HANDLER
-%token tDOWN tELSE tNLELSIF tENDIF tENDREPEAT tEXIT tFRAME tGLOBAL tGO tIF tINTO tLOOP tMACRO
+%token tDOWN tELSE tNLELSIF tEND tEXIT tFRAME tGLOBAL tGO tIF tINTO tLOOP tMACRO
%token tMCI tMCIWAIT tMOVIE tNEXT tOF tPREVIOUS tPUT tREPEAT tSET tTHEN tTO
%token tWITH tWHILE tNLELSE
%token tGE tLE tGT tLT tEQ tNEQ tAND tOR tNOT
@@ -138,7 +138,7 @@ stmt: stmtoneliner
// statements
// end repeat
//
- | repeatwhile '(' cond ')' stmtlist end tENDREPEAT {
+ | repeatwhile '(' cond ')' stmtlist end tEND tREPEAT {
inst body = 0, end = 0;
WRITE_UINT32(&body, $5);
WRITE_UINT32(&end, $6);
@@ -149,7 +149,7 @@ stmt: stmtoneliner
// statements
// end repeat
//
- | repeatwith '=' expr end tTO expr end stmtlist end tENDREPEAT {
+ | repeatwith '=' expr end tTO expr end stmtlist end tEND tREPEAT {
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
WRITE_UINT32(&init, $3);
WRITE_UINT32(&finish, $6);
@@ -165,7 +165,7 @@ stmt: stmtoneliner
// statements
// end repeat
//
- | repeatwith '=' expr end tDOWN tTO expr end stmtlist end tENDREPEAT {
+ | repeatwith '=' expr end tDOWN tTO expr end stmtlist end tEND tREPEAT {
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
WRITE_UINT32(&init, $3);
WRITE_UINT32(&finish, $7);
@@ -179,14 +179,14 @@ stmt: stmtoneliner
(*g_lingo->_currentScript)[$1 + 5] = end; } /* end, if cond fails */
;
-ifstmt: if cond tTHEN nl stmtlist end tENDIF {
+ifstmt: if cond tTHEN nl stmtlist end tEND tIF {
inst then = 0, end = 0;
WRITE_UINT32(&then, $5);
WRITE_UINT32(&end, $6);
(*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
(*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
g_lingo->processIf(0, 0); }
- | if cond tTHEN nl stmtlist end tNLELSE stmtlist end nl tENDIF {
+ | if cond tTHEN nl stmtlist end tNLELSE stmtlist end nl tEND tIF {
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, $5);
WRITE_UINT32(&else1, $8);
@@ -195,7 +195,7 @@ ifstmt: if cond tTHEN nl stmtlist end tENDIF {
(*g_lingo->_currentScript)[$1 + 2] = else1; /* elsepart */
(*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
g_lingo->processIf(0, 0); }
- | if cond tTHEN nl stmtlist end begin elseifstmt end nl tENDIF {
+ | if cond tTHEN nl stmtlist end begin elseifstmt end nl tEND tIF {
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, $5);
WRITE_UINT32(&else1, $7);
@@ -293,8 +293,9 @@ begin: /* nothing */ { $$ = g_lingo->_currentScript->size(); }
;
end: /* nothing */ { g_lingo->code1(STOP); $$ = g_lingo->_currentScript->size(); }
;
-stmtlist: stmtlist nl stmt
- | stmt
+stmtlist: /* nothing */
+ | stmtlist nl
+ | stmtlist stmt
;
expr: INT {
@@ -426,7 +427,7 @@ gotomovie: tOF tMOVIE STRING { $$ = $3; }
// See also:
// on keyword
defn: tMACRO ID { g_lingo->_indef = true; }
- begin argdef nl argstore stmtlist nl {
+ begin argdef nl argstore stmtlist {
g_lingo->code2(g_lingo->c_constpush, (inst)0); // Push fake value on stack
g_lingo->code1(g_lingo->c_procret);
g_lingo->define(*$2, $4, $5);