aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/director/lingo/lingo-code.cpp20
-rw-r--r--engines/director/lingo/lingo-codegen.cpp8
-rw-r--r--engines/director/lingo/lingo-gr.cpp534
-rw-r--r--engines/director/lingo/lingo-gr.h100
-rw-r--r--engines/director/lingo/lingo-gr.y3
-rw-r--r--engines/director/lingo/lingo-lex.cpp321
-rw-r--r--engines/director/lingo/lingo-lex.l1
-rw-r--r--engines/director/lingo/lingo.cpp1
-rw-r--r--engines/director/lingo/lingo.h9
9 files changed, 526 insertions, 471 deletions
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index 92cb9940e0..349b51f1ca 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -424,4 +424,24 @@ void Lingo::c_procret() {
g_lingo->_returning = true;
}
+void Lingo::c_global() {
+ Common::String name((char *)&(*g_lingo->_currentScript)[g_lingo->_pc]);
+
+ Symbol *s = g_lingo->lookupVar(name.c_str(), false);
+ if (s) {
+ if (s->global) {
+ warning("Redefinition of global variable %s", name.c_str());
+ } else {
+ warning("Local variable %s declared as global", name.c_str());
+ }
+
+ return;
+ }
+
+ s = g_lingo->lookupVar(name.c_str(), true, false);
+ s->global = true;
+
+ g_lingo->_pc += g_lingo->calcStringAlignment(name.c_str());
+}
+
}
diff --git a/engines/director/lingo/lingo-codegen.cpp b/engines/director/lingo/lingo-codegen.cpp
index 581b1c1321..8473f2e8a0 100644
--- a/engines/director/lingo/lingo-codegen.cpp
+++ b/engines/director/lingo/lingo-codegen.cpp
@@ -64,10 +64,13 @@ void Lingo::execute(int pc) {
}
}
-Symbol *Lingo::lookupVar(const char *name) {
+Symbol *Lingo::lookupVar(const char *name, bool create, bool putInLocalList) {
Symbol *sym;
if (!_vars.contains(name)) { // Create variable if it was not defined
+ if (!create)
+ return NULL;
+
sym = new Symbol;
sym->name = (char *)calloc(strlen(name) + 1, 1);
Common::strlcpy(sym->name, name, strlen(name) + 1);
@@ -79,6 +82,9 @@ Symbol *Lingo::lookupVar(const char *name) {
sym = g_lingo->_vars[name];
}
+ if (putInLocalList)
+ _localvars[name] = true;
+
return sym;
}
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 23766258c0..80229c74c3 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -79,30 +79,31 @@
tEND = 268,
tEXIT = 269,
tFRAME = 270,
- tGO = 271,
- tIF = 272,
- tINTO = 273,
- tLOOP = 274,
- tMACRO = 275,
- tMCI = 276,
- tMCIWAIT = 277,
- tMOVIE = 278,
- tNEXT = 279,
- tOF = 280,
- tPREVIOUS = 281,
- tPUT = 282,
- tREPEAT = 283,
- tSET = 284,
- tTHEN = 285,
- tTO = 286,
- tWITH = 287,
- tWHILE = 288,
- tGE = 289,
- tLE = 290,
- tGT = 291,
- tLT = 292,
- tEQ = 293,
- tNEQ = 294
+ tGLOBAL = 271,
+ tGO = 272,
+ tIF = 273,
+ tINTO = 274,
+ tLOOP = 275,
+ tMACRO = 276,
+ tMCI = 277,
+ tMCIWAIT = 278,
+ tMOVIE = 279,
+ tNEXT = 280,
+ tOF = 281,
+ tPREVIOUS = 282,
+ tPUT = 283,
+ tREPEAT = 284,
+ tSET = 285,
+ tTHEN = 286,
+ tTO = 287,
+ tWITH = 288,
+ tWHILE = 289,
+ tGE = 290,
+ tLE = 291,
+ tGT = 292,
+ tLT = 293,
+ tEQ = 294,
+ tNEQ = 295
};
#endif
/* Tokens. */
@@ -119,30 +120,31 @@
#define tEND 268
#define tEXIT 269
#define tFRAME 270
-#define tGO 271
-#define tIF 272
-#define tINTO 273
-#define tLOOP 274
-#define tMACRO 275
-#define tMCI 276
-#define tMCIWAIT 277
-#define tMOVIE 278
-#define tNEXT 279
-#define tOF 280
-#define tPREVIOUS 281
-#define tPUT 282
-#define tREPEAT 283
-#define tSET 284
-#define tTHEN 285
-#define tTO 286
-#define tWITH 287
-#define tWHILE 288
-#define tGE 289
-#define tLE 290
-#define tGT 291
-#define tLT 292
-#define tEQ 293
-#define tNEQ 294
+#define tGLOBAL 271
+#define tGO 272
+#define tIF 273
+#define tINTO 274
+#define tLOOP 275
+#define tMACRO 276
+#define tMCI 277
+#define tMCIWAIT 278
+#define tMOVIE 279
+#define tNEXT 280
+#define tOF 281
+#define tPREVIOUS 282
+#define tPUT 283
+#define tREPEAT 284
+#define tSET 285
+#define tTHEN 286
+#define tTO 287
+#define tWITH 288
+#define tWHILE 289
+#define tGE 290
+#define tLE 291
+#define tGT 292
+#define tLT 293
+#define tEQ 294
+#define tNEQ 295
@@ -194,7 +196,7 @@ typedef union YYSTYPE
int narg; /* number of arguments */
}
/* Line 193 of yacc.c. */
-#line 198 "engines/director/lingo/lingo-gr.cpp"
+#line 200 "engines/director/lingo/lingo-gr.cpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
@@ -207,7 +209,7 @@ typedef union YYSTYPE
/* Line 216 of yacc.c. */
-#line 211 "engines/director/lingo/lingo-gr.cpp"
+#line 213 "engines/director/lingo/lingo-gr.cpp"
#ifdef short
# undef short
@@ -420,22 +422,22 @@ union yyalloc
#endif
/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 53
+#define YYFINAL 55
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 257
+#define YYLAST 264
/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 52
+#define YYNTOKENS 53
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS 23
/* YYNRULES -- Number of rules. */
-#define YYNRULES 76
+#define YYNRULES 77
/* YYNRULES -- Number of states. */
-#define YYNSTATES 158
+#define YYNSTATES 160
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
-#define YYMAXUTOK 294
+#define YYMAXUTOK 295
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -444,12 +446,12 @@ union yyalloc
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 46, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 47, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 45, 2, 2,
- 47, 48, 43, 41, 51, 42, 2, 44, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 46, 2, 2,
+ 48, 49, 44, 42, 52, 43, 2, 45, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 50, 40, 49, 2, 2, 2, 2, 2, 2, 2,
+ 51, 41, 50, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -472,7 +474,7 @@ static const yytype_uint8 yytranslate[] =
5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
- 35, 36, 37, 38, 39
+ 35, 36, 37, 38, 39, 40
};
#if YYDEBUG
@@ -485,41 +487,42 @@ static const yytype_uint16 yyprhs[] =
81, 94, 96, 100, 104, 107, 111, 113, 114, 115,
116, 119, 122, 124, 126, 128, 132, 136, 140, 144,
148, 152, 156, 160, 164, 167, 170, 174, 179, 182,
- 185, 188, 190, 192, 195, 198, 201, 204, 208, 211,
- 215, 218, 221, 223, 227, 230, 234, 235, 244, 245,
- 247, 251, 256, 257, 261, 262, 264
+ 185, 188, 190, 192, 195, 198, 201, 204, 207, 211,
+ 214, 218, 221, 224, 226, 230, 233, 237, 238, 247,
+ 248, 250, 254, 259, 260, 264, 265, 267
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
- 53, 0, -1, 54, 46, 53, -1, 54, -1, -1,
- 69, -1, 65, -1, 73, -1, 55, -1, 56, -1,
- 1, -1, 27, 64, 18, 8, -1, 29, 8, 40,
- 64, -1, 29, 8, 31, 64, -1, 64, -1, 65,
- -1, 60, 57, 30, 63, 62, 13, 17, -1, 60,
- 57, 30, 63, 62, 12, 63, 62, 13, 17, -1,
- 58, 47, 57, 48, 63, 62, 13, 28, -1, 59,
- 40, 64, 62, 31, 64, 62, 63, 62, 13, 28,
- -1, 59, 40, 64, 62, 11, 31, 64, 62, 63,
- 62, 13, 28, -1, 64, -1, 64, 40, 64, -1,
- 47, 57, 48, -1, 28, 33, -1, 28, 32, 8,
- -1, 17, -1, -1, -1, -1, 63, 46, -1, 63,
- 56, -1, 6, -1, 8, -1, 55, -1, 64, 41,
- 64, -1, 64, 42, 64, -1, 64, 43, 64, -1,
- 64, 44, 64, -1, 64, 49, 64, -1, 64, 50,
- 64, -1, 64, 39, 64, -1, 64, 34, 64, -1,
- 64, 35, 64, -1, 41, 64, -1, 42, 64, -1,
- 47, 64, 48, -1, 8, 47, 74, 48, -1, 21,
- 9, -1, 22, 8, -1, 27, 64, -1, 66, -1,
- 14, -1, 16, 19, -1, 16, 24, -1, 16, 26,
- -1, 16, 67, -1, 16, 67, 68, -1, 16, 68,
- -1, 31, 15, 9, -1, 15, 9, -1, 31, 9,
- -1, 9, -1, 25, 23, 9, -1, 23, 9, -1,
- 31, 23, 9, -1, -1, 20, 8, 70, 61, 71,
- 46, 72, 63, -1, -1, 8, -1, 71, 51, 8,
- -1, 71, 46, 51, 8, -1, -1, 8, 61, 74,
- -1, -1, 64, -1, 74, 51, 64, -1
+ 54, 0, -1, 55, 47, 54, -1, 55, -1, -1,
+ 70, -1, 66, -1, 74, -1, 56, -1, 57, -1,
+ 1, -1, 28, 65, 19, 8, -1, 30, 8, 41,
+ 65, -1, 30, 8, 32, 65, -1, 65, -1, 66,
+ -1, 61, 58, 31, 64, 63, 13, 18, -1, 61,
+ 58, 31, 64, 63, 12, 64, 63, 13, 18, -1,
+ 59, 48, 58, 49, 64, 63, 13, 29, -1, 60,
+ 41, 65, 63, 32, 65, 63, 64, 63, 13, 29,
+ -1, 60, 41, 65, 63, 11, 32, 65, 63, 64,
+ 63, 13, 29, -1, 65, -1, 65, 41, 65, -1,
+ 48, 58, 49, -1, 29, 34, -1, 29, 33, 8,
+ -1, 18, -1, -1, -1, -1, 64, 47, -1, 64,
+ 57, -1, 6, -1, 8, -1, 56, -1, 65, 42,
+ 65, -1, 65, 43, 65, -1, 65, 44, 65, -1,
+ 65, 45, 65, -1, 65, 50, 65, -1, 65, 51,
+ 65, -1, 65, 40, 65, -1, 65, 35, 65, -1,
+ 65, 36, 65, -1, 42, 65, -1, 43, 65, -1,
+ 48, 65, 49, -1, 8, 48, 75, 49, -1, 22,
+ 9, -1, 23, 8, -1, 28, 65, -1, 67, -1,
+ 14, -1, 16, 8, -1, 17, 20, -1, 17, 25,
+ -1, 17, 27, -1, 17, 68, -1, 17, 68, 69,
+ -1, 17, 69, -1, 32, 15, 9, -1, 15, 9,
+ -1, 32, 9, -1, 9, -1, 26, 24, 9, -1,
+ 24, 9, -1, 32, 24, 9, -1, -1, 21, 8,
+ 71, 62, 72, 47, 73, 64, -1, -1, 8, -1,
+ 72, 52, 8, -1, 72, 47, 52, 8, -1, -1,
+ 8, 62, 75, -1, -1, 65, -1, 75, 52, 65,
+ -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
@@ -530,9 +533,9 @@ static const yytype_uint16 yyrline[] =
172, 186, 187, 188, 190, 192, 198, 200, 202, 204,
205, 206, 209, 214, 217, 218, 219, 220, 221, 222,
223, 224, 225, 226, 227, 228, 229, 232, 238, 239,
- 240, 241, 242, 253, 254, 255, 256, 261, 267, 274,
- 275, 276, 277, 280, 281, 282, 310, 310, 316, 317,
- 318, 319, 321, 324, 332, 333, 334
+ 240, 241, 242, 243, 254, 255, 256, 257, 262, 268,
+ 275, 276, 277, 278, 281, 282, 283, 311, 311, 317,
+ 318, 319, 320, 322, 325, 333, 334, 335
};
#endif
@@ -543,14 +546,14 @@ static const char *const yytname[] =
{
"$end", "error", "$undefined", "UNARY", "VOID", "VAR", "INT", "FLOAT",
"ID", "STRING", "HANDLER", "tDOWN", "tELSE", "tEND", "tEXIT", "tFRAME",
- "tGO", "tIF", "tINTO", "tLOOP", "tMACRO", "tMCI", "tMCIWAIT", "tMOVIE",
- "tNEXT", "tOF", "tPREVIOUS", "tPUT", "tREPEAT", "tSET", "tTHEN", "tTO",
- "tWITH", "tWHILE", "tGE", "tLE", "tGT", "tLT", "tEQ", "tNEQ", "'='",
- "'+'", "'-'", "'*'", "'/'", "'%'", "'\\n'", "'('", "')'", "'>'", "'<'",
- "','", "$accept", "program", "programline", "asgn", "stmt", "cond",
- "repeatwhile", "repeatwith", "if", "begin", "end", "stmtlist", "expr",
- "func", "gotofunc", "gotoframe", "gotomovie", "defn", "@1", "argdef",
- "argstore", "macro", "arglist", 0
+ "tGLOBAL", "tGO", "tIF", "tINTO", "tLOOP", "tMACRO", "tMCI", "tMCIWAIT",
+ "tMOVIE", "tNEXT", "tOF", "tPREVIOUS", "tPUT", "tREPEAT", "tSET",
+ "tTHEN", "tTO", "tWITH", "tWHILE", "tGE", "tLE", "tGT", "tLT", "tEQ",
+ "tNEQ", "'='", "'+'", "'-'", "'*'", "'/'", "'%'", "'\\n'", "'('", "')'",
+ "'>'", "'<'", "','", "$accept", "program", "programline", "asgn", "stmt",
+ "cond", "repeatwhile", "repeatwith", "if", "begin", "end", "stmtlist",
+ "expr", "func", "gotofunc", "gotoframe", "gotomovie", "defn", "@1",
+ "argdef", "argstore", "macro", "arglist", 0
};
#endif
@@ -563,22 +566,22 @@ static const yytype_uint16 yytoknum[] =
265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
- 61, 43, 45, 42, 47, 37, 10, 40, 41, 62,
- 60, 44
+ 295, 61, 43, 45, 42, 47, 37, 10, 40, 41,
+ 62, 60, 44
};
# endif
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
- 0, 52, 53, 53, 54, 54, 54, 54, 54, 54,
- 54, 55, 55, 55, 56, 56, 56, 56, 56, 56,
- 56, 57, 57, 57, 58, 59, 60, 61, 62, 63,
- 63, 63, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 65, 65, 65,
- 65, 65, 65, 66, 66, 66, 66, 66, 66, 67,
- 67, 67, 67, 68, 68, 68, 70, 69, 71, 71,
- 71, 71, 72, 73, 74, 74, 74
+ 0, 53, 54, 54, 55, 55, 55, 55, 55, 55,
+ 55, 56, 56, 56, 57, 57, 57, 57, 57, 57,
+ 57, 58, 58, 58, 59, 60, 61, 62, 63, 64,
+ 64, 64, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 66, 66, 66,
+ 66, 66, 66, 66, 67, 67, 67, 67, 67, 67,
+ 68, 68, 68, 68, 69, 69, 69, 71, 70, 72,
+ 72, 72, 72, 73, 74, 75, 75, 75
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
@@ -589,9 +592,9 @@ static const yytype_uint8 yyr2[] =
12, 1, 3, 3, 2, 3, 1, 0, 0, 0,
2, 2, 1, 1, 1, 3, 3, 3, 3, 3,
3, 3, 3, 3, 2, 2, 3, 4, 2, 2,
- 2, 1, 1, 2, 2, 2, 2, 3, 2, 3,
- 2, 2, 1, 3, 2, 3, 0, 8, 0, 1,
- 3, 4, 0, 3, 0, 1, 3
+ 2, 1, 1, 2, 2, 2, 2, 2, 3, 2,
+ 3, 2, 2, 1, 3, 2, 3, 0, 8, 0,
+ 1, 3, 4, 0, 3, 0, 1, 3
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -599,61 +602,61 @@ static const yytype_uint8 yyr2[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 0, 10, 32, 27, 52, 0, 26, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 34, 9,
- 0, 0, 0, 14, 6, 51, 5, 7, 74, 74,
- 62, 0, 53, 0, 54, 0, 55, 0, 56, 58,
- 66, 48, 49, 33, 0, 34, 50, 0, 24, 0,
- 44, 45, 0, 1, 0, 0, 0, 0, 0, 21,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 75,
- 0, 73, 60, 64, 0, 61, 0, 0, 0, 57,
- 27, 0, 0, 25, 0, 0, 46, 2, 0, 28,
- 0, 0, 29, 0, 42, 43, 41, 35, 36, 37,
- 38, 39, 40, 47, 0, 63, 59, 65, 68, 11,
- 13, 12, 29, 0, 23, 28, 22, 76, 69, 0,
- 28, 0, 0, 33, 30, 31, 0, 15, 72, 0,
- 0, 0, 28, 29, 0, 0, 29, 70, 0, 28,
- 29, 28, 16, 71, 67, 18, 29, 28, 0, 28,
- 0, 0, 0, 0, 17, 0, 19, 20
+ 0, 10, 32, 27, 52, 0, 0, 26, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 3, 34,
+ 9, 0, 0, 0, 14, 6, 51, 5, 7, 75,
+ 75, 53, 63, 0, 54, 0, 55, 0, 56, 0,
+ 57, 59, 67, 48, 49, 33, 0, 34, 50, 0,
+ 24, 0, 44, 45, 0, 1, 0, 0, 0, 0,
+ 0, 21, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 76, 0, 74, 61, 65, 0, 62, 0, 0,
+ 0, 58, 27, 0, 0, 25, 0, 0, 46, 2,
+ 0, 28, 0, 0, 29, 0, 42, 43, 41, 35,
+ 36, 37, 38, 39, 40, 47, 0, 64, 60, 66,
+ 69, 11, 13, 12, 29, 0, 23, 28, 22, 77,
+ 70, 0, 28, 0, 0, 33, 30, 31, 0, 15,
+ 73, 0, 0, 0, 28, 29, 0, 0, 29, 71,
+ 0, 28, 29, 28, 16, 72, 68, 18, 29, 28,
+ 0, 28, 0, 0, 0, 0, 17, 0, 19, 20
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int16 yydefgoto[] =
{
- -1, 16, 17, 45, 125, 58, 20, 21, 22, 29,
- 113, 115, 23, 127, 25, 38, 39, 26, 80, 119,
- 136, 27, 70
+ -1, 17, 18, 47, 127, 60, 21, 22, 23, 30,
+ 115, 117, 24, 129, 26, 40, 41, 27, 82, 121,
+ 138, 28, 72
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -107
+#define YYPACT_NINF -108
static const yytype_int16 yypact[] =
{
- 64, -107, -107, 188, -107, 13, -107, -7, 4, 17,
- 61, 44, 32, 61, 61, 61, 42, 3, 2, -107,
- 12, 23, 108, 176, -107, -107, -107, -107, 61, 61,
- -107, 57, -107, 59, -107, 48, -107, 104, -8, -107,
- -107, -107, -107, -107, 61, -107, 128, 65, -107, -20,
- 207, 207, 152, -107, 64, 108, 61, 108, 49, 164,
- 61, 61, 61, 61, 61, 61, 61, 61, 61, 176,
- -24, 31, -107, -107, 78, -107, 80, 88, 75, -107,
- -107, 128, 91, -107, 61, 61, -107, -107, 52, 176,
- 53, 140, -107, 61, 176, 176, 176, 205, 205, 207,
- 207, 176, 176, -107, 61, -107, -107, -107, 96, -107,
- 176, 176, -107, -1, -107, 101, 176, 176, -107, -30,
- 101, 89, 61, 77, -107, -107, 83, -107, 74, 118,
- 120, 61, 176, -107, 114, 126, -107, -107, 110, 176,
- -107, 101, -107, -107, 101, -107, -107, 101, 123, 101,
- 127, 122, 131, 113, -107, 117, -107, -107
+ 82, -108, -108, 196, -108, 1, 5, -108, 13, 4,
+ 25, 37, 27, 42, 37, 37, 37, 74, 31, 2,
+ -108, 38, 46, 111, 184, -108, -108, -108, -108, 37,
+ 37, -108, -108, 84, -108, 93, -108, 67, -108, 57,
+ 45, -108, -108, -108, -108, -108, 37, -108, 136, 98,
+ -108, -15, -12, -12, 160, -108, 82, 111, 37, 111,
+ 77, 172, 37, 37, 37, 37, 37, 37, 37, 37,
+ 37, 184, 40, 62, -108, -108, 100, -108, 106, 107,
+ 94, -108, -108, 136, 112, -108, 37, 37, -108, -108,
+ 72, 184, 78, 148, -108, 37, 184, 184, 184, 213,
+ 213, -12, -12, 184, 184, -108, 37, -108, -108, -108,
+ 115, -108, 184, 184, -108, -10, -108, 120, 184, 184,
+ -108, -36, 120, 99, 37, 85, -108, -108, 28, -108,
+ 80, 127, 131, 37, 184, -108, 122, 137, -108, -108,
+ 117, 184, -108, 120, -108, -108, 120, -108, -108, 120,
+ 134, 120, 138, 139, 143, 123, -108, 129, -108, -108
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
- -107, 97, -107, 6, 7, -26, -107, -107, -107, 72,
- -106, 20, -10, 8, -107, -107, 116, -107, -107, -107,
- -107, -107, 129
+ -108, 104, -108, 6, 7, 11, -108, -108, -108, 79,
+ -107, -41, -11, 8, -108, -108, 124, -108, -108, -108,
+ -108, -108, 135
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@@ -663,84 +666,86 @@ static const yytype_int16 yypgoto[] =
#define YYTABLE_NINF -34
static const yytype_int16 yytable[] =
{
- 46, 40, -8, 50, 51, 52, 18, 19, 24, 126,
- 121, 84, 59, 41, 130, 33, 128, 35, 69, 69,
- 85, 129, 30, 78, 103, 42, 140, 104, 31, 88,
- 122, 90, 32, 146, 81, 148, 33, 34, 35, 36,
- 49, 150, 53, 152, 37, 59, 89, 91, -8, 54,
- 94, 95, 96, 97, 98, 99, 100, 101, 102, 55,
- 18, 19, 24, 56, -4, 1, 72, 2, 73, 43,
- 2, 74, 3, 83, 110, 111, 47, 48, 4, 92,
- 5, 6, 104, 116, 7, 8, 9, 105, 44, 106,
- 12, 10, 11, 12, 117, 133, 134, 107, 77, 109,
- 112, 114, 13, 14, 118, 13, 14, 2, 15, 123,
- -4, 15, 132, 75, 2, 4, 43, 5, 6, 76,
- 131, 139, 8, 9, 28, 135, 137, 77, 10, 11,
- 12, 142, 120, 138, 143, 44, 151, 12, 145, 154,
- 153, 156, 13, 14, 155, 157, 82, 124, 15, 13,
- 14, 87, 108, 141, 79, 57, 144, 0, 71, 0,
- 147, 0, 60, 61, 0, 0, 149, 62, 0, 63,
- 64, 65, 66, 0, 60, 61, 0, 67, 68, 62,
- 93, 63, 64, 65, 66, 0, 60, 61, 86, 67,
- 68, 62, 0, 63, 64, 65, 66, 0, 60, 61,
- 86, 67, 68, 62, 93, 63, 64, 65, 66, 0,
- 60, 61, 0, 67, 68, 62, 0, 63, 64, 65,
- 66, 0, -33, -33, 0, 67, 68, -33, 0, 0,
- 0, -33, -33, 0, 0, 28, 0, -33, -33, 60,
- 61, 60, 61, 0, 62, 0, 62, 0, 65, 66,
- 0, 0, 0, 0, 67, 68, 67, 68
+ 48, 123, -8, 52, 53, 54, 19, 20, 25, 31,
+ 128, 130, 61, 43, 32, 132, 131, 86, 71, 71,
+ 33, 42, 124, 62, 63, 34, 87, 142, 64, 35,
+ 36, 37, 38, 44, 148, 83, 150, 39, 69, 70,
+ 135, 136, 152, 2, 154, 45, 61, 91, 93, -8,
+ 51, 96, 97, 98, 99, 100, 101, 102, 103, 104,
+ 49, 50, 19, 20, 25, 46, 77, 13, 90, 35,
+ 92, 37, 78, 122, 55, 112, 113, 80, 56, 14,
+ 15, 79, -4, 1, 118, 16, 57, 58, 2, 105,
+ 3, 76, 106, 74, 143, 119, 4, 146, 5, 6,
+ 7, 149, 75, 8, 9, 10, 85, 151, 94, 107,
+ 11, 12, 13, 134, 106, 108, 109, 2, 79, 45,
+ 111, 114, 141, 120, 14, 15, 2, 116, 125, -4,
+ 16, 133, 137, 29, 4, 139, 5, 6, 7, 46,
+ 144, 13, 9, 10, 140, 145, 147, 153, 11, 12,
+ 13, 155, 158, 14, 15, 84, 157, 156, 159, 59,
+ 89, 110, 14, 15, 81, 73, 0, 126, 16, 0,
+ 0, 62, 63, 0, 0, 0, 64, 0, 65, 66,
+ 67, 68, 0, 62, 63, 0, 69, 70, 64, 95,
+ 65, 66, 67, 68, 0, 62, 63, 88, 69, 70,
+ 64, 0, 65, 66, 67, 68, 0, 62, 63, 88,
+ 69, 70, 64, 95, 65, 66, 67, 68, 0, 62,
+ 63, 0, 69, 70, 64, 0, 65, 66, 67, 68,
+ 0, -33, -33, 0, 69, 70, -33, 0, 0, 0,
+ -33, -33, 0, 0, 29, 0, -33, -33, 62, 63,
+ 0, 0, 0, 64, 0, 0, 0, 67, 68, 0,
+ 0, 0, 0, 69, 70
};
static const yytype_int16 yycheck[] =
{
- 10, 8, 0, 13, 14, 15, 0, 0, 0, 115,
- 11, 31, 22, 9, 120, 23, 46, 25, 28, 29,
- 40, 51, 9, 31, 48, 8, 132, 51, 15, 55,
- 31, 57, 19, 139, 44, 141, 23, 24, 25, 26,
- 8, 147, 0, 149, 31, 55, 56, 57, 46, 46,
- 60, 61, 62, 63, 64, 65, 66, 67, 68, 47,
- 54, 54, 54, 40, 0, 1, 9, 6, 9, 8,
- 6, 23, 8, 8, 84, 85, 32, 33, 14, 30,
- 16, 17, 51, 93, 20, 21, 22, 9, 27, 9,
- 29, 27, 28, 29, 104, 12, 13, 9, 23, 8,
- 48, 48, 41, 42, 8, 41, 42, 6, 47, 8,
- 46, 47, 122, 9, 6, 14, 8, 16, 17, 15,
- 31, 131, 21, 22, 47, 51, 8, 23, 27, 28,
- 29, 17, 112, 13, 8, 27, 13, 29, 28, 17,
- 13, 28, 41, 42, 13, 28, 18, 46, 47, 41,
- 42, 54, 80, 133, 38, 47, 136, -1, 29, -1,
- 140, -1, 34, 35, -1, -1, 146, 39, -1, 41,
- 42, 43, 44, -1, 34, 35, -1, 49, 50, 39,
- 40, 41, 42, 43, 44, -1, 34, 35, 48, 49,
- 50, 39, -1, 41, 42, 43, 44, -1, 34, 35,
- 48, 49, 50, 39, 40, 41, 42, 43, 44, -1,
- 34, 35, -1, 49, 50, 39, -1, 41, 42, 43,
- 44, -1, 34, 35, -1, 49, 50, 39, -1, -1,
- -1, 43, 44, -1, -1, 47, -1, 49, 50, 34,
- 35, 34, 35, -1, 39, -1, 39, -1, 43, 44,
- -1, -1, -1, -1, 49, 50, 49, 50
+ 11, 11, 0, 14, 15, 16, 0, 0, 0, 8,
+ 117, 47, 23, 9, 9, 122, 52, 32, 29, 30,
+ 15, 8, 32, 35, 36, 20, 41, 134, 40, 24,
+ 25, 26, 27, 8, 141, 46, 143, 32, 50, 51,
+ 12, 13, 149, 6, 151, 8, 57, 58, 59, 47,
+ 8, 62, 63, 64, 65, 66, 67, 68, 69, 70,
+ 33, 34, 56, 56, 56, 28, 9, 30, 57, 24,
+ 59, 26, 15, 114, 0, 86, 87, 32, 47, 42,
+ 43, 24, 0, 1, 95, 48, 48, 41, 6, 49,
+ 8, 24, 52, 9, 135, 106, 14, 138, 16, 17,
+ 18, 142, 9, 21, 22, 23, 8, 148, 31, 9,
+ 28, 29, 30, 124, 52, 9, 9, 6, 24, 8,
+ 8, 49, 133, 8, 42, 43, 6, 49, 8, 47,
+ 48, 32, 52, 48, 14, 8, 16, 17, 18, 28,
+ 18, 30, 22, 23, 13, 8, 29, 13, 28, 29,
+ 30, 13, 29, 42, 43, 19, 13, 18, 29, 48,
+ 56, 82, 42, 43, 40, 30, -1, 47, 48, -1,
+ -1, 35, 36, -1, -1, -1, 40, -1, 42, 43,
+ 44, 45, -1, 35, 36, -1, 50, 51, 40, 41,
+ 42, 43, 44, 45, -1, 35, 36, 49, 50, 51,
+ 40, -1, 42, 43, 44, 45, -1, 35, 36, 49,
+ 50, 51, 40, 41, 42, 43, 44, 45, -1, 35,
+ 36, -1, 50, 51, 40, -1, 42, 43, 44, 45,
+ -1, 35, 36, -1, 50, 51, 40, -1, -1, -1,
+ 44, 45, -1, -1, 48, -1, 50, 51, 35, 36,
+ -1, -1, -1, 40, -1, -1, -1, 44, 45, -1,
+ -1, -1, -1, 50, 51
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
- 0, 1, 6, 8, 14, 16, 17, 20, 21, 22,
- 27, 28, 29, 41, 42, 47, 53, 54, 55, 56,
- 58, 59, 60, 64, 65, 66, 69, 73, 47, 61,
- 9, 15, 19, 23, 24, 25, 26, 31, 67, 68,
- 8, 9, 8, 8, 27, 55, 64, 32, 33, 8,
- 64, 64, 64, 0, 46, 47, 40, 47, 57, 64,
- 34, 35, 39, 41, 42, 43, 44, 49, 50, 64,
- 74, 74, 9, 9, 23, 9, 15, 23, 31, 68,
- 70, 64, 18, 8, 31, 40, 48, 53, 57, 64,
- 57, 64, 30, 40, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 48, 51, 9, 9, 9, 61, 8,
- 64, 64, 48, 62, 48, 63, 64, 64, 8, 71,
- 63, 11, 31, 8, 46, 56, 62, 65, 46, 51,
- 62, 31, 64, 12, 13, 51, 72, 8, 13, 64,
- 62, 63, 17, 8, 63, 28, 62, 63, 62, 63,
- 62, 13, 62, 13, 17, 13, 28, 28
+ 0, 1, 6, 8, 14, 16, 17, 18, 21, 22,
+ 23, 28, 29, 30, 42, 43, 48, 54, 55, 56,
+ 57, 59, 60, 61, 65, 66, 67, 70, 74, 48,
+ 62, 8, 9, 15, 20, 24, 25, 26, 27, 32,
+ 68, 69, 8, 9, 8, 8, 28, 56, 65, 33,
+ 34, 8, 65, 65, 65, 0, 47, 48, 41, 48,
+ 58, 65, 35, 36, 40, 42, 43, 44, 45, 50,
+ 51, 65, 75, 75, 9, 9, 24, 9, 15, 24,
+ 32, 69, 71, 65, 19, 8, 32, 41, 49, 54,
+ 58, 65, 58, 65, 31, 41, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 49, 52, 9, 9, 9,
+ 62, 8, 65, 65, 49, 63, 49, 64, 65, 65,
+ 8, 72, 64, 11, 32, 8, 47, 57, 63, 66,
+ 47, 52, 63, 32, 65, 12, 13, 52, 73, 8,
+ 13, 65, 63, 64, 18, 8, 64, 29, 63, 64,
+ 63, 64, 63, 13, 63, 13, 18, 13, 29, 29
};
#define yyerrok (yyerrstatus = 0)
@@ -1814,22 +1819,27 @@ yyreduce:
break;
case 53:
-#line 253 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_gotoloop); ;}
+#line 243 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_global); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
break;
case 54:
#line 254 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_gotonext); ;}
+ { g_lingo->code1(g_lingo->c_gotoloop); ;}
break;
case 55:
#line 255 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_gotoprevious); ;}
+ { g_lingo->code1(g_lingo->c_gotonext); ;}
break;
case 56:
#line 256 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_gotoprevious); ;}
+ break;
+
+ case 57:
+#line 257 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str());
@@ -1837,8 +1847,8 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 57:
-#line 261 "engines/director/lingo/lingo-gr.y"
+ case 58:
+#line 262 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str());
@@ -1847,8 +1857,8 @@ yyreduce:
delete (yyvsp[(3) - (3)].s); ;}
break;
- case 58:
-#line 267 "engines/director/lingo/lingo-gr.y"
+ case 59:
+#line 268 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString("");
@@ -1856,14 +1866,9 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 59:
-#line 274 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
- break;
-
case 60:
#line 275 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
+ { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 61:
@@ -1873,64 +1878,69 @@ yyreduce:
case 62:
#line 277 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(1) - (1)].s); ;}
+ { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 63:
-#line 280 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
+#line 278 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
case 64:
#line 281 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
+ { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 65:
#line 282 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
+ { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 66:
-#line 310 "engines/director/lingo/lingo-gr.y"
- { g_lingo->_indef = true; ;}
+#line 283 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 67:
#line 311 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->_indef = true; ;}
+ break;
+
+ case 68:
+#line 312 "engines/director/lingo/lingo-gr.y"
{
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; ;}
break;
- case 68:
-#line 316 "engines/director/lingo/lingo-gr.y"
- { (yyval.narg) = 0; ;}
- break;
-
case 69:
#line 317 "engines/director/lingo/lingo-gr.y"
- { g_lingo->codeArg((yyvsp[(1) - (1)].s)); (yyval.narg) = 1; ;}
+ { (yyval.narg) = 0; ;}
break;
case 70:
#line 318 "engines/director/lingo/lingo-gr.y"
- { g_lingo->codeArg((yyvsp[(3) - (3)].s)); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
+ { g_lingo->codeArg((yyvsp[(1) - (1)].s)); (yyval.narg) = 1; ;}
break;
case 71:
#line 319 "engines/director/lingo/lingo-gr.y"
- { g_lingo->codeArg((yyvsp[(4) - (4)].s)); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
+ { g_lingo->codeArg((yyvsp[(3) - (3)].s)); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
case 72:
-#line 321 "engines/director/lingo/lingo-gr.y"
- { g_lingo->codeArgStore(); ;}
+#line 320 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->codeArg((yyvsp[(4) - (4)].s)); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
break;
case 73:
-#line 324 "engines/director/lingo/lingo-gr.y"
+#line 322 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->codeArgStore(); ;}
+ break;
+
+ case 74:
+#line 325 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (3)].s)->c_str());
@@ -1939,24 +1949,24 @@ yyreduce:
g_lingo->code1(numpar); ;}
break;
- case 74:
-#line 332 "engines/director/lingo/lingo-gr.y"
- { (yyval.narg) = 0; ;}
- break;
-
case 75:
#line 333 "engines/director/lingo/lingo-gr.y"
- { (yyval.narg) = 1; ;}
+ { (yyval.narg) = 0; ;}
break;
case 76:
#line 334 "engines/director/lingo/lingo-gr.y"
+ { (yyval.narg) = 1; ;}
+ break;
+
+ case 77:
+#line 335 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
/* Line 1267 of yacc.c. */
-#line 1960 "engines/director/lingo/lingo-gr.cpp"
+#line 1970 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2170,6 +2180,6 @@ yyreturn:
}
-#line 337 "engines/director/lingo/lingo-gr.y"
+#line 338 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.h b/engines/director/lingo/lingo-gr.h
index bdef89f889..efc1e80acb 100644
--- a/engines/director/lingo/lingo-gr.h
+++ b/engines/director/lingo/lingo-gr.h
@@ -52,30 +52,31 @@
tEND = 268,
tEXIT = 269,
tFRAME = 270,
- tGO = 271,
- tIF = 272,
- tINTO = 273,
- tLOOP = 274,
- tMACRO = 275,
- tMCI = 276,
- tMCIWAIT = 277,
- tMOVIE = 278,
- tNEXT = 279,
- tOF = 280,
- tPREVIOUS = 281,
- tPUT = 282,
- tREPEAT = 283,
- tSET = 284,
- tTHEN = 285,
- tTO = 286,
- tWITH = 287,
- tWHILE = 288,
- tGE = 289,
- tLE = 290,
- tGT = 291,
- tLT = 292,
- tEQ = 293,
- tNEQ = 294
+ tGLOBAL = 271,
+ tGO = 272,
+ tIF = 273,
+ tINTO = 274,
+ tLOOP = 275,
+ tMACRO = 276,
+ tMCI = 277,
+ tMCIWAIT = 278,
+ tMOVIE = 279,
+ tNEXT = 280,
+ tOF = 281,
+ tPREVIOUS = 282,
+ tPUT = 283,
+ tREPEAT = 284,
+ tSET = 285,
+ tTHEN = 286,
+ tTO = 287,
+ tWITH = 288,
+ tWHILE = 289,
+ tGE = 290,
+ tLE = 291,
+ tGT = 292,
+ tLT = 293,
+ tEQ = 294,
+ tNEQ = 295
};
#endif
/* Tokens. */
@@ -92,30 +93,31 @@
#define tEND 268
#define tEXIT 269
#define tFRAME 270
-#define tGO 271
-#define tIF 272
-#define tINTO 273
-#define tLOOP 274
-#define tMACRO 275
-#define tMCI 276
-#define tMCIWAIT 277
-#define tMOVIE 278
-#define tNEXT 279
-#define tOF 280
-#define tPREVIOUS 281
-#define tPUT 282
-#define tREPEAT 283
-#define tSET 284
-#define tTHEN 285
-#define tTO 286
-#define tWITH 287
-#define tWHILE 288
-#define tGE 289
-#define tLE 290
-#define tGT 291
-#define tLT 292
-#define tEQ 293
-#define tNEQ 294
+#define tGLOBAL 271
+#define tGO 272
+#define tIF 273
+#define tINTO 274
+#define tLOOP 275
+#define tMACRO 276
+#define tMCI 277
+#define tMCIWAIT 278
+#define tMOVIE 279
+#define tNEXT 280
+#define tOF 281
+#define tPREVIOUS 282
+#define tPUT 283
+#define tREPEAT 284
+#define tSET 285
+#define tTHEN 286
+#define tTO 287
+#define tWITH 288
+#define tWHILE 289
+#define tGE 290
+#define tLE 291
+#define tGT 292
+#define tLT 293
+#define tEQ 294
+#define tNEQ 295
@@ -131,7 +133,7 @@ typedef union YYSTYPE
int narg; /* number of arguments */
}
/* Line 1529 of yacc.c. */
-#line 135 "engines/director/lingo/lingo-gr.hpp"
+#line 137 "engines/director/lingo/lingo-gr.hpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 3c716a5109..2084c704db 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -74,7 +74,7 @@ using namespace Director;
%token<i> INT
%token<f> FLOAT
%token<s> ID STRING HANDLER
-%token tDOWN tELSE tEND tEXIT tFRAME tGO tIF tINTO tLOOP tMACRO tMCI tMCIWAIT
+%token tDOWN tELSE tEND tEXIT tFRAME tGLOBAL tGO tIF tINTO tLOOP tMACRO tMCI tMCIWAIT
%token tMOVIE tNEXT tOF tPREVIOUS tPUT tREPEAT tSET tTHEN tTO tWITH tWHILE
%token tGE tLE tGT tLT tEQ tNEQ
@@ -240,6 +240,7 @@ func: ID '(' arglist ')' {
| tPUT expr { g_lingo->code1(g_lingo->c_printtop); }
| gotofunc
| tEXIT { g_lingo->code1(g_lingo->c_exit); }
+ | tGLOBAL ID { g_lingo->code1(g_lingo->c_global); g_lingo->codeString($2->c_str()); delete $2; }
;
// go {to} {frame} whichFrame {of movie whichMovie}
diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp
index 535daacafc..48f71527f5 100644
--- a/engines/director/lingo/lingo-lex.cpp
+++ b/engines/director/lingo/lingo-lex.cpp
@@ -364,8 +364,8 @@ static void yy_fatal_error (yyconst char msg[] );
*yy_cp = '\0'; \
(yy_c_buf_p) = yy_cp;
-#define YY_NUM_RULES 37
-#define YY_END_OF_BUFFER 38
+#define YY_NUM_RULES 38
+#define YY_END_OF_BUFFER 39
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
@@ -373,21 +373,21 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
-static yyconst flex_int16_t yy_accept[116] =
+static yyconst flex_int16_t yy_accept[121] =
{ 0,
- 0, 0, 38, 36, 3, 34, 34, 36, 36, 36,
- 33, 33, 32, 33, 33, 30, 30, 30, 30, 30,
- 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
- 2, 2, 3, 34, 0, 27, 0, 35, 1, 31,
- 32, 29, 28, 30, 30, 30, 30, 30, 30, 10,
- 5, 30, 30, 30, 30, 30, 30, 18, 30, 30,
- 30, 30, 30, 24, 30, 30, 1, 31, 30, 30,
- 7, 30, 30, 30, 30, 30, 14, 30, 30, 30,
- 20, 30, 22, 30, 30, 30, 4, 6, 8, 30,
- 11, 12, 30, 30, 30, 17, 30, 30, 23, 30,
-
- 25, 9, 13, 30, 16, 30, 30, 26, 30, 30,
- 21, 15, 30, 19, 0
+ 0, 0, 39, 37, 3, 35, 35, 37, 37, 37,
+ 34, 34, 33, 34, 34, 31, 31, 31, 31, 31,
+ 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
+ 2, 2, 3, 35, 0, 28, 0, 36, 1, 32,
+ 33, 30, 29, 31, 31, 31, 31, 31, 31, 31,
+ 11, 5, 31, 31, 31, 31, 31, 31, 19, 31,
+ 31, 31, 31, 31, 25, 31, 31, 1, 32, 31,
+ 31, 7, 31, 31, 31, 31, 31, 31, 15, 31,
+ 31, 31, 21, 31, 23, 31, 31, 31, 4, 6,
+ 8, 31, 31, 12, 13, 31, 31, 31, 18, 31,
+
+ 31, 24, 31, 26, 9, 31, 14, 31, 17, 31,
+ 31, 27, 10, 31, 31, 22, 16, 31, 20, 0
} ;
static yyconst flex_int32_t yy_ec[256] =
@@ -399,13 +399,13 @@ static yyconst flex_int32_t yy_ec[256] =
8, 8, 8, 8, 9, 10, 8, 11, 11, 11,
11, 11, 11, 11, 11, 11, 11, 8, 1, 12,
13, 14, 1, 1, 15, 16, 17, 18, 19, 20,
- 21, 22, 23, 16, 16, 24, 25, 26, 27, 28,
- 16, 29, 30, 31, 32, 33, 34, 35, 16, 16,
- 1, 1, 1, 8, 16, 1, 36, 16, 37, 38,
+ 21, 22, 23, 24, 24, 25, 26, 27, 28, 29,
+ 24, 30, 31, 32, 33, 34, 35, 36, 24, 24,
+ 1, 1, 1, 8, 24, 1, 37, 38, 39, 40,
- 39, 40, 41, 42, 43, 16, 16, 44, 45, 46,
- 47, 48, 16, 49, 50, 51, 52, 53, 54, 55,
- 16, 16, 1, 1, 1, 1, 1, 1, 1, 1,
+ 41, 42, 43, 44, 45, 24, 24, 46, 47, 48,
+ 49, 50, 24, 51, 52, 53, 54, 55, 56, 57,
+ 24, 24, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -422,124 +422,130 @@ static yyconst flex_int32_t yy_ec[256] =
1, 1, 1, 1, 1
} ;
-static yyconst flex_int32_t yy_meta[56] =
+static yyconst flex_int32_t yy_meta[58] =
{ 0,
1, 1, 2, 3, 1, 1, 1, 1, 1, 1,
4, 1, 1, 1, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4
+ 4, 4, 4, 4, 4, 4, 4
} ;
-static yyconst flex_int16_t yy_base[119] =
+static yyconst flex_int16_t yy_base[124] =
{ 0,
- 0, 54, 232, 255, 58, 54, 61, 64, 217, 222,
- 255, 219, 60, 214, 185, 0, 45, 49, 45, 49,
- 57, 51, 64, 63, 65, 57, 68, 69, 88, 90,
- 114, 118, 122, 125, 134, 255, 138, 255, 0, 88,
- 130, 255, 255, 0, 80, 101, 124, 120, 129, 0,
- 0, 115, 120, 131, 126, 117, 117, 0, 134, 123,
- 127, 125, 138, 0, 135, 128, 0, 79, 134, 142,
- 0, 133, 146, 155, 155, 156, 152, 164, 157, 156,
- 0, 171, 0, 166, 169, 172, 0, 0, 0, 176,
- 0, 0, 169, 182, 180, 0, 177, 186, 0, 185,
-
- 0, 0, 0, 188, 0, 190, 190, 0, 192, 193,
- 0, 0, 196, 0, 255, 246, 76, 250
+ 0, 56, 244, 270, 60, 56, 63, 66, 230, 235,
+ 270, 232, 62, 155, 145, 0, 46, 50, 46, 53,
+ 62, 51, 75, 64, 64, 78, 68, 72, 93, 94,
+ 123, 131, 141, 90, 145, 270, 116, 270, 0, 111,
+ 108, 270, 270, 0, 45, 89, 112, 108, 125, 123,
+ 0, 0, 122, 127, 139, 134, 125, 124, 0, 142,
+ 131, 135, 133, 147, 0, 144, 137, 0, 77, 143,
+ 152, 0, 141, 148, 161, 154, 158, 162, 161, 174,
+ 168, 167, 0, 179, 0, 175, 179, 183, 0, 0,
+ 0, 187, 192, 0, 0, 181, 195, 192, 0, 189,
+
+ 199, 0, 196, 0, 0, 193, 0, 193, 0, 196,
+ 194, 0, 0, 199, 202, 0, 0, 209, 0, 270,
+ 261, 81, 265
} ;
-static yyconst flex_int16_t yy_def[119] =
+static yyconst flex_int16_t yy_def[124] =
{ 0,
- 115, 1, 115, 115, 115, 115, 115, 115, 115, 116,
- 115, 115, 115, 115, 115, 117, 117, 117, 117, 117,
- 117, 117, 117, 117, 117, 117, 117, 117, 117, 117,
- 115, 115, 115, 115, 115, 115, 116, 115, 118, 115,
- 115, 115, 115, 117, 117, 117, 117, 117, 117, 117,
- 117, 117, 117, 117, 117, 117, 117, 117, 117, 117,
- 117, 117, 117, 117, 117, 117, 118, 115, 117, 117,
- 117, 117, 117, 117, 117, 117, 117, 117, 117, 117,
- 117, 117, 117, 117, 117, 117, 117, 117, 117, 117,
- 117, 117, 117, 117, 117, 117, 117, 117, 117, 117,
-
- 117, 117, 117, 117, 117, 117, 117, 117, 117, 117,
- 117, 117, 117, 117, 0, 115, 115, 115
+ 120, 1, 120, 120, 120, 120, 120, 120, 120, 121,
+ 120, 120, 120, 120, 120, 122, 122, 122, 122, 122,
+ 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
+ 120, 120, 120, 120, 120, 120, 121, 120, 123, 120,
+ 120, 120, 120, 122, 122, 122, 122, 122, 122, 122,
+ 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
+ 122, 122, 122, 122, 122, 122, 122, 123, 120, 122,
+ 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
+ 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
+ 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
+
+ 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
+ 122, 122, 122, 122, 122, 122, 122, 122, 122, 0,
+ 120, 120, 120
} ;
-static yyconst flex_int16_t yy_nxt[311] =
+static yyconst flex_int16_t yy_nxt[328] =
{ 0,
4, 5, 6, 7, 8, 9, 10, 11, 12, 4,
13, 14, 11, 15, 16, 16, 16, 17, 18, 19,
- 20, 16, 21, 22, 23, 24, 25, 26, 27, 28,
- 29, 16, 16, 30, 16, 16, 16, 17, 18, 19,
- 20, 16, 21, 22, 23, 24, 25, 26, 27, 28,
- 29, 16, 16, 30, 16, 31, 34, 34, 32, 33,
- 34, 34, 35, 34, 34, 35, 34, 34, 35, 40,
- 41, 45, 46, 49, 47, 50, 51, 53, 54, 44,
- 55, 57, 52, 48, 58, 59, 61, 62, 60, 68,
- 56, 45, 46, 49, 47, 50, 51, 53, 68, 54,
-
- 55, 57, 52, 48, 58, 59, 61, 62, 60, 63,
- 56, 65, 66, 69, 64, 33, 34, 34, 35, 35,
- 34, 34, 35, 33, 34, 34, 35, 34, 34, 63,
- 70, 65, 66, 69, 64, 35, 34, 34, 35, 40,
- 41, 71, 72, 73, 38, 74, 75, 76, 77, 78,
- 70, 79, 80, 81, 82, 83, 84, 85, 86, 87,
- 88, 71, 72, 89, 73, 74, 75, 76, 77, 78,
- 90, 79, 80, 81, 82, 83, 84, 85, 86, 87,
- 88, 91, 92, 89, 93, 94, 95, 96, 97, 98,
- 90, 99, 100, 101, 102, 103, 104, 43, 105, 106,
-
- 107, 91, 92, 108, 93, 94, 95, 96, 97, 98,
- 109, 99, 100, 101, 102, 103, 110, 104, 105, 106,
- 111, 107, 112, 108, 113, 114, 42, 39, 38, 36,
- 109, 115, 115, 115, 115, 115, 110, 115, 115, 115,
- 111, 115, 112, 115, 113, 114, 37, 115, 37, 37,
- 67, 115, 115, 67, 3, 115, 115, 115, 115, 115,
- 115, 115, 115, 115, 115, 115, 115, 115, 115, 115,
- 115, 115, 115, 115, 115, 115, 115, 115, 115, 115,
- 115, 115, 115, 115, 115, 115, 115, 115, 115, 115,
- 115, 115, 115, 115, 115, 115, 115, 115, 115, 115,
-
- 115, 115, 115, 115, 115, 115, 115, 115, 115, 115
+ 20, 16, 21, 16, 22, 23, 24, 25, 26, 27,
+ 28, 29, 16, 16, 30, 16, 16, 16, 16, 17,
+ 18, 19, 20, 16, 21, 22, 23, 24, 25, 26,
+ 27, 28, 29, 16, 16, 30, 16, 31, 34, 34,
+ 32, 33, 34, 34, 35, 34, 34, 35, 34, 34,
+ 35, 40, 41, 45, 46, 49, 47, 50, 54, 70,
+ 51, 52, 58, 59, 44, 48, 62, 69, 53, 55,
+ 63, 56, 34, 34, 45, 46, 49, 47, 50, 54,
+
+ 70, 51, 57, 52, 58, 59, 48, 60, 62, 53,
+ 61, 55, 63, 56, 64, 66, 67, 40, 41, 71,
+ 65, 69, 38, 57, 33, 34, 34, 35, 60, 72,
+ 73, 61, 35, 34, 34, 35, 64, 66, 67, 74,
+ 71, 65, 33, 34, 34, 35, 35, 34, 34, 35,
+ 75, 72, 73, 76, 77, 78, 79, 43, 80, 81,
+ 82, 74, 83, 84, 85, 86, 87, 42, 88, 89,
+ 90, 75, 91, 92, 76, 77, 93, 78, 79, 80,
+ 81, 94, 82, 83, 84, 85, 95, 86, 87, 88,
+ 89, 96, 90, 91, 92, 97, 98, 101, 93, 99,
+
+ 100, 102, 94, 103, 104, 105, 106, 95, 107, 108,
+ 109, 110, 96, 111, 112, 114, 97, 113, 98, 101,
+ 99, 100, 102, 115, 103, 116, 104, 105, 106, 107,
+ 117, 108, 109, 110, 118, 111, 112, 114, 113, 119,
+ 39, 38, 36, 120, 115, 120, 116, 120, 120, 120,
+ 120, 117, 120, 120, 120, 118, 120, 120, 120, 120,
+ 119, 37, 120, 37, 37, 68, 120, 120, 68, 3,
+ 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
+ 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
+ 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
+
+ 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
+ 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
+ 120, 120, 120, 120, 120, 120, 120
} ;
-static yyconst flex_int16_t yy_chk[311] =
+static yyconst flex_int16_t yy_chk[328] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 2, 6, 6, 2, 5,
- 5, 5, 5, 7, 7, 8, 8, 8, 8, 13,
- 13, 17, 18, 19, 18, 20, 21, 22, 23, 117,
- 23, 24, 21, 18, 25, 26, 27, 28, 26, 68,
- 23, 17, 18, 19, 18, 20, 21, 22, 40, 23,
-
- 23, 24, 21, 18, 25, 26, 27, 28, 26, 29,
- 23, 30, 30, 45, 29, 31, 31, 31, 31, 32,
- 32, 32, 32, 33, 33, 33, 33, 34, 34, 29,
- 46, 30, 30, 45, 29, 35, 35, 35, 35, 41,
- 41, 47, 48, 49, 37, 52, 53, 54, 55, 56,
- 46, 57, 59, 60, 61, 62, 63, 65, 66, 69,
- 70, 47, 48, 72, 49, 52, 53, 54, 55, 56,
- 73, 57, 59, 60, 61, 62, 63, 65, 66, 69,
- 70, 74, 75, 72, 76, 77, 78, 79, 80, 82,
- 73, 84, 85, 86, 90, 93, 94, 15, 95, 97,
-
- 98, 74, 75, 100, 76, 77, 78, 79, 80, 82,
- 104, 84, 85, 86, 90, 93, 106, 94, 95, 97,
- 107, 98, 109, 100, 110, 113, 14, 12, 10, 9,
- 104, 3, 0, 0, 0, 0, 106, 0, 0, 0,
- 107, 0, 109, 0, 110, 113, 116, 0, 116, 116,
- 118, 0, 0, 118, 115, 115, 115, 115, 115, 115,
- 115, 115, 115, 115, 115, 115, 115, 115, 115, 115,
- 115, 115, 115, 115, 115, 115, 115, 115, 115, 115,
- 115, 115, 115, 115, 115, 115, 115, 115, 115, 115,
- 115, 115, 115, 115, 115, 115, 115, 115, 115, 115,
-
- 115, 115, 115, 115, 115, 115, 115, 115, 115, 115
+ 1, 1, 1, 1, 1, 1, 1, 2, 6, 6,
+ 2, 5, 5, 5, 5, 7, 7, 8, 8, 8,
+ 8, 13, 13, 17, 18, 19, 18, 20, 22, 45,
+ 20, 21, 24, 25, 122, 18, 27, 69, 21, 23,
+ 28, 23, 34, 34, 17, 18, 19, 18, 20, 22,
+
+ 45, 20, 23, 21, 24, 25, 18, 26, 27, 21,
+ 26, 23, 28, 23, 29, 30, 30, 41, 41, 46,
+ 29, 40, 37, 23, 31, 31, 31, 31, 26, 47,
+ 48, 26, 32, 32, 32, 32, 29, 30, 30, 49,
+ 46, 29, 33, 33, 33, 33, 35, 35, 35, 35,
+ 50, 47, 48, 53, 54, 55, 56, 15, 57, 58,
+ 60, 49, 61, 62, 63, 64, 66, 14, 67, 70,
+ 71, 50, 73, 74, 53, 54, 75, 55, 56, 57,
+ 58, 76, 60, 61, 62, 63, 77, 64, 66, 67,
+ 70, 78, 71, 73, 74, 79, 80, 84, 75, 81,
+
+ 82, 86, 76, 87, 88, 92, 93, 77, 96, 97,
+ 98, 100, 78, 101, 103, 108, 79, 106, 80, 84,
+ 81, 82, 86, 110, 87, 111, 88, 92, 93, 96,
+ 114, 97, 98, 100, 115, 101, 103, 108, 106, 118,
+ 12, 10, 9, 3, 110, 0, 111, 0, 0, 0,
+ 0, 114, 0, 0, 0, 115, 0, 0, 0, 0,
+ 118, 121, 0, 121, 121, 123, 0, 0, 123, 120,
+ 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
+ 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
+ 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
+
+ 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
+ 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
+ 120, 120, 120, 120, 120, 120, 120
} ;
static yy_state_type yy_last_accepting_state;
@@ -589,7 +595,7 @@ char *yytext;
int yyparse();
-#line 593 "engines/director/lingo/lingo-lex.cpp"
+#line 599 "engines/director/lingo/lingo-lex.cpp"
#define INITIAL 0
@@ -777,7 +783,7 @@ YY_DECL
#line 45 "engines/director/lingo/lingo-lex.l"
-#line 781 "engines/director/lingo/lingo-lex.cpp"
+#line 787 "engines/director/lingo/lingo-lex.cpp"
if ( !(yy_init) )
{
@@ -831,13 +837,13 @@ yy_match:
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 116 )
+ if ( yy_current_state >= 121 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
++yy_cp;
}
- while ( yy_base[yy_current_state] != 255 );
+ while ( yy_base[yy_current_state] != 270 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
@@ -909,145 +915,150 @@ YY_RULE_SETUP
case 10:
YY_RULE_SETUP
#line 57 "engines/director/lingo/lingo-lex.l"
-{ return tGO; }
+{ return tGLOBAL; }
YY_BREAK
case 11:
YY_RULE_SETUP
#line 58 "engines/director/lingo/lingo-lex.l"
-{ return tINTO; }
+{ return tGO; }
YY_BREAK
case 12:
YY_RULE_SETUP
#line 59 "engines/director/lingo/lingo-lex.l"
-{ return tLOOP; }
+{ return tINTO; }
YY_BREAK
case 13:
YY_RULE_SETUP
#line 60 "engines/director/lingo/lingo-lex.l"
-{ return tMACRO; }
+{ return tLOOP; }
YY_BREAK
case 14:
YY_RULE_SETUP
#line 61 "engines/director/lingo/lingo-lex.l"
-{ return tMCI; }
+{ return tMACRO; }
YY_BREAK
case 15:
YY_RULE_SETUP
#line 62 "engines/director/lingo/lingo-lex.l"
-{ return tMCIWAIT; }
+{ return tMCI; }
YY_BREAK
case 16:
YY_RULE_SETUP
#line 63 "engines/director/lingo/lingo-lex.l"
-{ return tMOVIE; }
+{ return tMCIWAIT; }
YY_BREAK
case 17:
YY_RULE_SETUP
#line 64 "engines/director/lingo/lingo-lex.l"
-{ return tNEXT; }
+{ return tMOVIE; }
YY_BREAK
case 18:
YY_RULE_SETUP
#line 65 "engines/director/lingo/lingo-lex.l"
-{ return tOF; }
+{ return tNEXT; }
YY_BREAK
case 19:
YY_RULE_SETUP
#line 66 "engines/director/lingo/lingo-lex.l"
-{ return tPREVIOUS; }
+{ return tOF; }
YY_BREAK
case 20:
YY_RULE_SETUP
#line 67 "engines/director/lingo/lingo-lex.l"
-{ return tPUT; }
+{ return tPREVIOUS; }
YY_BREAK
case 21:
YY_RULE_SETUP
#line 68 "engines/director/lingo/lingo-lex.l"
-{ return tREPEAT; }
+{ return tPUT; }
YY_BREAK
case 22:
YY_RULE_SETUP
#line 69 "engines/director/lingo/lingo-lex.l"
-{ return tSET; }
+{ return tREPEAT; }
YY_BREAK
case 23:
YY_RULE_SETUP
#line 70 "engines/director/lingo/lingo-lex.l"
-{ return tTHEN; }
+{ return tSET; }
YY_BREAK
case 24:
YY_RULE_SETUP
#line 71 "engines/director/lingo/lingo-lex.l"
-{ return tTO; }
+{ return tTHEN; }
YY_BREAK
case 25:
YY_RULE_SETUP
#line 72 "engines/director/lingo/lingo-lex.l"
-{ return tWITH; }
+{ return tTO; }
YY_BREAK
case 26:
YY_RULE_SETUP
#line 73 "engines/director/lingo/lingo-lex.l"
-{ return tWHILE; }
+{ return tWITH; }
YY_BREAK
case 27:
YY_RULE_SETUP
-#line 75 "engines/director/lingo/lingo-lex.l"
-{ return tNEQ; }
+#line 74 "engines/director/lingo/lingo-lex.l"
+{ return tWHILE; }
YY_BREAK
case 28:
YY_RULE_SETUP
#line 76 "engines/director/lingo/lingo-lex.l"
-{ return tGE; }
+{ return tNEQ; }
YY_BREAK
case 29:
YY_RULE_SETUP
#line 77 "engines/director/lingo/lingo-lex.l"
-{ return tLE; }
+{ return tGE; }
YY_BREAK
case 30:
YY_RULE_SETUP
-#line 79 "engines/director/lingo/lingo-lex.l"
-{ yylval.s = new Common::String(yytext); return ID; }
+#line 78 "engines/director/lingo/lingo-lex.l"
+{ return tLE; }
YY_BREAK
case 31:
YY_RULE_SETUP
#line 80 "engines/director/lingo/lingo-lex.l"
-{ yylval.f = atof(yytext); return FLOAT; }
+{ yylval.s = new Common::String(yytext); return ID; }
YY_BREAK
case 32:
YY_RULE_SETUP
#line 81 "engines/director/lingo/lingo-lex.l"
-{ yylval.i = strtol(yytext, NULL, 10); return INT; }
+{ yylval.f = atof(yytext); return FLOAT; }
YY_BREAK
case 33:
YY_RULE_SETUP
#line 82 "engines/director/lingo/lingo-lex.l"
-{ return *yytext; }
+{ yylval.i = strtol(yytext, NULL, 10); return INT; }
YY_BREAK
case 34:
-/* rule 34 can match eol */
YY_RULE_SETUP
#line 83 "engines/director/lingo/lingo-lex.l"
-{ return '\n'; }
+{ return *yytext; }
YY_BREAK
case 35:
+/* rule 35 can match eol */
YY_RULE_SETUP
#line 84 "engines/director/lingo/lingo-lex.l"
-{ yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
+{ return '\n'; }
YY_BREAK
case 36:
YY_RULE_SETUP
#line 85 "engines/director/lingo/lingo-lex.l"
-
+{ yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
YY_BREAK
case 37:
YY_RULE_SETUP
-#line 87 "engines/director/lingo/lingo-lex.l"
+#line 86 "engines/director/lingo/lingo-lex.l"
+
+ YY_BREAK
+case 38:
+YY_RULE_SETUP
+#line 88 "engines/director/lingo/lingo-lex.l"
ECHO;
YY_BREAK
-#line 1051 "engines/director/lingo/lingo-lex.cpp"
+#line 1062 "engines/director/lingo/lingo-lex.cpp"
case YY_STATE_EOF(INITIAL):
yyterminate();
@@ -1340,7 +1351,7 @@ static int yy_get_next_buffer (void)
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 116 )
+ if ( yy_current_state >= 121 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1368,11 +1379,11 @@ static int yy_get_next_buffer (void)
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 116 )
+ if ( yy_current_state >= 121 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
- yy_is_jam = (yy_current_state == 115);
+ yy_is_jam = (yy_current_state == 120);
return yy_is_jam ? 0 : yy_current_state;
}
@@ -2047,7 +2058,7 @@ void yyfree (void * ptr )
#define YYTABLES_NAME "yytables"
-#line 87 "engines/director/lingo/lingo-lex.l"
+#line 88 "engines/director/lingo/lingo-lex.l"
diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l
index 3d92963adc..2e42471daa 100644
--- a/engines/director/lingo/lingo-lex.l
+++ b/engines/director/lingo/lingo-lex.l
@@ -54,6 +54,7 @@ whitespace [\t ]
(?i:end) { return tEND; }
(?i:exit) { return tEXIT; }
(?i:frame) { return tFRAME; }
+(?i:global) { return tGLOBAL; }
(?i:go) { return tGO; }
(?i:into) { return tINTO; }
(?i:loop) { return tLOOP; }
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index 37bf53a36d..cbf0d9ba6c 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -72,6 +72,7 @@ Symbol::Symbol() {
type = VOID;
u.str = NULL;
nargs = 0;
+ global = false;
}
Lingo::Lingo(DirectorEngine *vm) : _vm(vm) {
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index e40aa634e4..137b8f7c5b 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -77,8 +77,8 @@ typedef void (*inst)(void);
typedef Common::Array<inst> ScriptData;
typedef struct Symbol { /* symbol table entry */
- char *name;
- int type;
+ char *name;
+ int type;
union {
int val; /* VAR */
float fval; /* FLOAT */
@@ -86,6 +86,7 @@ typedef struct Symbol { /* symbol table entry */
char *str; /* STRING */
} u;
int nargs;
+ bool global;
Symbol();
} Symbol;
@@ -134,7 +135,7 @@ public:
public:
void execute(int pc);
- Symbol *lookupVar(const char *name);
+ Symbol *lookupVar(const char *name, bool create = true, bool putInLocalList = true);
void define(Common::String &s, int start, int nargs);
void codeArg(Common::String *s);
void codeArgStore();
@@ -172,6 +173,7 @@ public:
static void c_gotoloop();
static void c_gotonext();
static void c_gotoprevious();
+ static void c_global();
void func_mci(Common::String &s);
void func_mciwait(Common::String &s);
@@ -200,6 +202,7 @@ private:
ScriptHash _scripts[kMaxScriptType + 1];
SymbolHash _vars;
+ Common::HashMap<Common::String, bool, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> _localvars;
SymbolHash _handlers;
int _pc;