aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/director/lingo/lingo-gr.cpp16
-rw-r--r--engines/director/lingo/lingo-gr.y18
-rw-r--r--engines/director/lingo/lingo.cpp2
-rw-r--r--engines/director/lingo/lingo.h8
4 files changed, 25 insertions, 19 deletions
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 489efbe762..19c25948f1 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -2775,7 +2775,7 @@ yyreduce:
case 133:
#line 526 "engines/director/lingo/lingo-gr.y"
- { g_lingo->_indef = true; g_lingo->_currentFactory.clear(); ;}
+ { g_lingo->_indef = kStateInArgs; g_lingo->_currentFactory.clear(); ;}
break;
case 134:
@@ -2783,7 +2783,7 @@ yyreduce:
{
g_lingo->code1(g_lingo->c_procret);
g_lingo->define(*(yyvsp[(2) - (8)].s), (yyvsp[(4) - (8)].code), (yyvsp[(5) - (8)].narg));
- g_lingo->_indef = false; ;}
+ g_lingo->_indef = kStateNone; ;}
break;
case 135:
@@ -2793,7 +2793,7 @@ yyreduce:
case 136:
#line 532 "engines/director/lingo/lingo-gr.y"
- { g_lingo->_indef = true; ;}
+ { g_lingo->_indef = kStateInArgs; ;}
break;
case 137:
@@ -2801,7 +2801,7 @@ yyreduce:
{
g_lingo->code1(g_lingo->c_procret);
g_lingo->define(*(yyvsp[(1) - (7)].s), (yyvsp[(3) - (7)].code), (yyvsp[(4) - (7)].narg) + 1, &g_lingo->_currentFactory);
- g_lingo->_indef = false; ;}
+ g_lingo->_indef = kStateNone; ;}
break;
case 138:
@@ -2809,7 +2809,7 @@ yyreduce:
{ // D3
g_lingo->code1(g_lingo->c_procret);
g_lingo->define(*(yyvsp[(1) - (8)].s), (yyvsp[(2) - (8)].code), (yyvsp[(3) - (8)].narg));
- g_lingo->_indef = false;
+ g_lingo->_indef = kStateNone;
g_lingo->_ignoreMe = false;
checkEnd((yyvsp[(7) - (8)].s), (yyvsp[(1) - (8)].s)->c_str(), false); ;}
@@ -2820,13 +2820,13 @@ yyreduce:
{ // D4. No 'end' clause
g_lingo->code1(g_lingo->c_procret);
g_lingo->define(*(yyvsp[(1) - (6)].s), (yyvsp[(2) - (6)].code), (yyvsp[(3) - (6)].narg));
- g_lingo->_indef = false;
+ g_lingo->_indef = kStateNone;
g_lingo->_ignoreMe = false; ;}
break;
case 140:
#line 550 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(2) - (2)].s); g_lingo->_indef = true; g_lingo->_currentFactory.clear(); g_lingo->_ignoreMe = true; ;}
+ { (yyval.s) = (yyvsp[(2) - (2)].s); g_lingo->_indef = kStateInArgs; g_lingo->_currentFactory.clear(); g_lingo->_ignoreMe = true; ;}
break;
case 141:
@@ -2851,7 +2851,7 @@ yyreduce:
case 148:
#line 563 "engines/director/lingo/lingo-gr.y"
- { g_lingo->codeArgStore(); ;}
+ { g_lingo->codeArgStore(); g_lingo->_indef = kStateInDef; ;}
break;
case 149:
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 025555287c..5d6fc0f6da 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -523,36 +523,36 @@ playfunc: tPLAY tDONE { g_lingo->code1(g_lingo->c_playdone); }
//
// See also:
// on keyword
-defn: tMACRO ID { g_lingo->_indef = true; g_lingo->_currentFactory.clear(); }
+defn: tMACRO ID { g_lingo->_indef = kStateInArgs; g_lingo->_currentFactory.clear(); }
begin argdef '\n' argstore stmtlist {
g_lingo->code1(g_lingo->c_procret);
g_lingo->define(*$2, $4, $5);
- g_lingo->_indef = false; }
+ g_lingo->_indef = kStateNone; }
| tFACTORY ID { g_lingo->codeFactory(*$2); }
- | tMETHOD { g_lingo->_indef = true; }
+ | tMETHOD { g_lingo->_indef = kStateInArgs; }
begin argdef '\n' argstore stmtlist {
g_lingo->code1(g_lingo->c_procret);
g_lingo->define(*$1, $3, $4 + 1, &g_lingo->_currentFactory);
- g_lingo->_indef = false; }
+ g_lingo->_indef = kStateNone; }
| on begin argdef '\n' argstore stmtlist ENDCLAUSE endargdef { // D3
g_lingo->code1(g_lingo->c_procret);
g_lingo->define(*$1, $2, $3);
- g_lingo->_indef = false;
+ g_lingo->_indef = kStateNone;
g_lingo->_ignoreMe = false;
checkEnd($7, $1->c_str(), false); }
| on begin argdef '\n' argstore stmtlist { // D4. No 'end' clause
g_lingo->code1(g_lingo->c_procret);
g_lingo->define(*$1, $2, $3);
- g_lingo->_indef = false;
+ g_lingo->_indef = kStateNone;
g_lingo->_ignoreMe = false; }
-on: tON ID { $$ = $2; g_lingo->_indef = true; g_lingo->_currentFactory.clear(); g_lingo->_ignoreMe = true; }
+on: tON ID { $$ = $2; g_lingo->_indef = kStateInArgs; g_lingo->_currentFactory.clear(); g_lingo->_ignoreMe = true; }
argdef: /* nothing */ { $$ = 0; }
| ID { g_lingo->codeArg($1); $$ = 1; }
| argdef ',' ID { g_lingo->codeArg($3); $$ = $1 + 1; }
- | argdef '\n' ',' ID { g_lingo->codeArg($4); $$ = $1 + 1; }
+ | argdef '\n' ',' ID { g_lingo->codeArg($4); $$ = $1 + 1; }
;
endargdef: /* nothing */
@@ -560,7 +560,7 @@ endargdef: /* nothing */
| endargdef ',' ID
;
-argstore: /* nothing */ { g_lingo->codeArgStore(); }
+argstore: /* nothing */ { g_lingo->codeArgStore(); g_lingo->_indef = kStateInDef; }
;
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index 54f8243705..cf6bd69016 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -50,7 +50,7 @@ Lingo::Lingo(DirectorEngine *vm) : _vm(vm) {
_currentEntityId = 0;
_pc = 0;
_returning = false;
- _indef = false;
+ _indef = kStateNone;
_ignoreMe = false;
_immediateMode = false;
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index f3a8edf35b..1f0ffd27c0 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -74,6 +74,12 @@ enum LEvent {
kEventStart
};
+enum LexerDefineState {
+ kStateNone,
+ kStateInDef,
+ kStateInArgs
+};
+
typedef void (*inst)(void);
#define STOP (inst)0
#define ENTITY_INDEX(t,id) ((t) * 100000 + (id))
@@ -560,7 +566,7 @@ public:
uint16 _currentScriptFunction;
ScriptData *_currentScript;
bool _returning;
- bool _indef;
+ LexerDefineState _indef;
bool _ignoreMe;
bool _immediateMode;