aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2016-07-04 00:10:47 +0200
committerEugene Sandulenko2016-08-03 23:40:36 +0200
commitf4325f30effa36d14bfa97312c25a58ac1ebe4cd (patch)
treeeefd241679fb4280d737676ed36d33678cd11716
parentb62089ed9554fd04c42fc3cc1fe69e58cc58828e (diff)
downloadscummvm-rg350-f4325f30effa36d14bfa97312c25a58ac1ebe4cd.tar.gz
scummvm-rg350-f4325f30effa36d14bfa97312c25a58ac1ebe4cd.tar.bz2
scummvm-rg350-f4325f30effa36d14bfa97312c25a58ac1ebe4cd.zip
DIRECTOR: Lingo: Started 'else if' implementation
-rw-r--r--engines/director/director.cpp14
-rw-r--r--engines/director/lingo/lingo-gr.cpp703
-rw-r--r--engines/director/lingo/lingo-gr.y53
3 files changed, 418 insertions, 352 deletions
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index fa16502ec0..afc65b2cb6 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -94,6 +94,20 @@ Common::Error DirectorEngine::run() {
#if 0
_lingo->addCode("--\n\
+ if y = 5 then\n\
+ set x = 5\n\
+ else if y = 6 then\n\
+ set x = 6\n\
+ else\n\
+ set x = 7\n\
+ endif\n\
+", kMovieScript, 2);
+
+_lingo->executeScript(kMovieScript, 2);
+
+return Common::kNoError;
+
+ _lingo->addCode("--\n\
macro SHIPX\n\
global x, y\n\
set x = Random(5)\n\
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index f079879a08..61b989a1e4 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -426,18 +426,18 @@ union yyalloc
#endif
/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 60
+#define YYFINAL 61
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 340
+#define YYLAST 339
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 55
/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 25
+#define YYNNTS 28
/* YYNRULES -- Number of rules. */
-#define YYNRULES 83
+#define YYNRULES 88
/* YYNRULES -- Number of states. */
-#define YYNSTATES 174
+#define YYNSTATES 189
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
@@ -487,63 +487,65 @@ static const yytype_uint8 yytranslate[] =
static const yytype_uint16 yyprhs[] =
{
0, 0, 3, 7, 9, 10, 12, 14, 16, 18,
- 20, 22, 24, 29, 34, 39, 41, 43, 51, 62,
- 71, 83, 96, 103, 105, 109, 113, 116, 120, 122,
- 123, 124, 125, 128, 131, 133, 135, 140, 145, 147,
- 149, 153, 157, 161, 165, 169, 173, 177, 181, 185,
- 188, 191, 195, 198, 201, 204, 206, 208, 211, 213,
- 217, 220, 223, 226, 229, 233, 236, 240, 243, 246,
- 248, 252, 255, 259, 260, 269, 270, 272, 276, 281,
- 282, 286, 287, 289
+ 20, 22, 24, 29, 34, 39, 41, 43, 45, 54,
+ 66, 79, 86, 94, 105, 116, 118, 122, 129, 131,
+ 135, 139, 142, 146, 148, 149, 150, 151, 154, 157,
+ 159, 161, 166, 171, 173, 175, 179, 183, 187, 191,
+ 195, 199, 203, 207, 211, 214, 217, 221, 224, 227,
+ 230, 232, 234, 237, 239, 243, 246, 249, 252, 255,
+ 259, 262, 266, 269, 272, 274, 278, 281, 285, 286,
+ 295, 296, 298, 302, 307, 308, 312, 313, 315
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
56, 0, -1, 57, 49, 56, -1, 57, -1, -1,
- 74, -1, 69, -1, 78, -1, 58, -1, 60, -1,
- 59, -1, 1, -1, 30, 68, 21, 10, -1, 32,
- 10, 43, 68, -1, 32, 10, 34, 68, -1, 68,
- -1, 69, -1, 64, 61, 33, 67, 66, 15, 20,
- -1, 64, 61, 33, 67, 66, 14, 67, 66, 15,
- 20, -1, 62, 50, 61, 51, 67, 66, 15, 31,
- -1, 63, 43, 68, 66, 34, 68, 66, 67, 66,
- 15, 31, -1, 63, 43, 68, 66, 13, 34, 68,
- 66, 67, 66, 15, 31, -1, 64, 61, 33, 65,
- 59, 66, -1, 68, -1, 68, 43, 68, -1, 50,
- 61, 51, -1, 31, 36, -1, 31, 35, 10, -1,
- 20, -1, -1, -1, -1, 67, 49, -1, 67, 59,
- -1, 7, -1, 8, -1, 9, 50, 79, 51, -1,
- 10, 50, 79, 51, -1, 10, -1, 58, -1, 68,
- 44, 68, -1, 68, 45, 68, -1, 68, 46, 68,
- -1, 68, 47, 68, -1, 68, 52, 68, -1, 68,
- 53, 68, -1, 68, 42, 68, -1, 68, 37, 68,
- -1, 68, 38, 68, -1, 44, 68, -1, 45, 68,
- -1, 50, 68, 51, -1, 24, 11, -1, 25, 10,
- -1, 30, 68, -1, 71, -1, 16, -1, 18, 70,
- -1, 10, -1, 70, 54, 10, -1, 19, 22, -1,
- 19, 27, -1, 19, 29, -1, 19, 72, -1, 19,
- 72, 73, -1, 19, 73, -1, 34, 17, 11, -1,
- 17, 11, -1, 34, 11, -1, 11, -1, 28, 26,
- 11, -1, 26, 11, -1, 34, 26, 11, -1, -1,
- 23, 10, 75, 65, 76, 49, 77, 67, -1, -1,
- 10, -1, 76, 54, 10, -1, 76, 49, 54, 10,
- -1, -1, 10, 65, 79, -1, -1, 68, -1, 79,
- 54, 68, -1
+ 77, -1, 72, -1, 81, -1, 58, -1, 60, -1,
+ 59, -1, 1, -1, 30, 71, 21, 10, -1, 32,
+ 10, 43, 71, -1, 32, 10, 34, 71, -1, 71,
+ -1, 72, -1, 61, -1, 65, 50, 64, 51, 70,
+ 69, 15, 31, -1, 66, 43, 71, 69, 34, 71,
+ 69, 70, 69, 15, 31, -1, 66, 43, 71, 69,
+ 13, 34, 71, 69, 70, 69, 15, 31, -1, 67,
+ 64, 33, 68, 59, 69, -1, 67, 64, 33, 70,
+ 69, 15, 20, -1, 67, 64, 33, 70, 69, 14,
+ 70, 69, 15, 20, -1, 67, 64, 33, 70, 69,
+ 68, 62, 69, 15, 20, -1, 63, -1, 63, 49,
+ 62, -1, 14, 67, 64, 33, 70, 69, -1, 71,
+ -1, 71, 43, 71, -1, 50, 64, 51, -1, 31,
+ 36, -1, 31, 35, 10, -1, 20, -1, -1, -1,
+ -1, 70, 49, -1, 70, 59, -1, 7, -1, 8,
+ -1, 9, 50, 82, 51, -1, 10, 50, 82, 51,
+ -1, 10, -1, 58, -1, 71, 44, 71, -1, 71,
+ 45, 71, -1, 71, 46, 71, -1, 71, 47, 71,
+ -1, 71, 52, 71, -1, 71, 53, 71, -1, 71,
+ 42, 71, -1, 71, 37, 71, -1, 71, 38, 71,
+ -1, 44, 71, -1, 45, 71, -1, 50, 71, 51,
+ -1, 24, 11, -1, 25, 10, -1, 30, 71, -1,
+ 74, -1, 16, -1, 18, 73, -1, 10, -1, 73,
+ 54, 10, -1, 19, 22, -1, 19, 27, -1, 19,
+ 29, -1, 19, 75, -1, 19, 75, 76, -1, 19,
+ 76, -1, 34, 17, 11, -1, 17, 11, -1, 34,
+ 11, -1, 11, -1, 28, 26, 11, -1, 26, 11,
+ -1, 34, 26, 11, -1, -1, 23, 10, 78, 68,
+ 79, 49, 80, 70, -1, -1, 10, -1, 79, 54,
+ 10, -1, 79, 49, 54, 10, -1, -1, 10, 68,
+ 82, -1, -1, 71, -1, 82, 54, 71, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
0, 92, 92, 93, 96, 97, 98, 99, 100, 101,
- 102, 103, 106, 112, 118, 126, 127, 128, 134, 146,
- 157, 173, 187, 195, 196, 197, 199, 201, 207, 209,
- 211, 213, 214, 215, 218, 223, 226, 232, 240, 243,
- 244, 245, 246, 247, 248, 249, 250, 251, 252, 253,
- 254, 255, 258, 259, 260, 261, 262, 264, 267, 268,
- 279, 280, 281, 282, 287, 293, 300, 301, 302, 303,
- 306, 307, 308, 336, 336, 343, 344, 345, 346, 348,
- 351, 359, 360, 361
+ 102, 103, 106, 112, 118, 126, 127, 128, 133, 144,
+ 160, 174, 182, 188, 196, 206, 207, 210, 220, 221,
+ 222, 224, 226, 232, 234, 236, 238, 239, 240, 243,
+ 248, 251, 257, 265, 268, 269, 270, 271, 272, 273,
+ 274, 275, 276, 277, 278, 279, 280, 283, 284, 285,
+ 286, 287, 289, 292, 293, 304, 305, 306, 307, 312,
+ 318, 325, 326, 327, 328, 331, 332, 333, 361, 361,
+ 368, 369, 370, 371, 373, 376, 384, 385, 386
};
#endif
@@ -559,10 +561,10 @@ static const char *const yytname[] =
"tREPEAT", "tSET", "tTHEN", "tTO", "tWITH", "tWHILE", "tGE", "tLE",
"tGT", "tLT", "tEQ", "tNEQ", "'='", "'+'", "'-'", "'*'", "'/'", "'%'",
"'\\n'", "'('", "')'", "'>'", "'<'", "','", "$accept", "program",
- "programline", "asgn", "stmt", "stmtoneliner", "cond", "repeatwhile",
- "repeatwith", "if", "begin", "end", "stmtlist", "expr", "func",
- "globallist", "gotofunc", "gotoframe", "gotomovie", "defn", "@1",
- "argdef", "argstore", "macro", "arglist", 0
+ "programline", "asgn", "stmt", "stmtoneliner", "ifstmt", "elseif",
+ "elseif1", "cond", "repeatwhile", "repeatwith", "if", "begin", "end",
+ "stmtlist", "expr", "func", "globallist", "gotofunc", "gotoframe",
+ "gotomovie", "defn", "@1", "argdef", "argstore", "macro", "arglist", 0
};
#endif
@@ -585,27 +587,27 @@ static const yytype_uint8 yyr1[] =
{
0, 55, 56, 56, 57, 57, 57, 57, 57, 57,
57, 57, 58, 58, 58, 59, 59, 59, 59, 59,
- 59, 59, 60, 61, 61, 61, 62, 63, 64, 65,
- 66, 67, 67, 67, 68, 68, 68, 68, 68, 68,
- 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
- 68, 68, 69, 69, 69, 69, 69, 69, 70, 70,
- 71, 71, 71, 71, 71, 71, 72, 72, 72, 72,
- 73, 73, 73, 75, 74, 76, 76, 76, 76, 77,
- 78, 79, 79, 79
+ 59, 60, 61, 61, 61, 62, 62, 63, 64, 64,
+ 64, 65, 66, 67, 68, 69, 70, 70, 70, 71,
+ 71, 71, 71, 71, 71, 71, 71, 71, 71, 71,
+ 71, 71, 71, 71, 71, 71, 71, 72, 72, 72,
+ 72, 72, 72, 73, 73, 74, 74, 74, 74, 74,
+ 74, 75, 75, 75, 75, 76, 76, 76, 78, 77,
+ 79, 79, 79, 79, 80, 81, 82, 82, 82
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
static const yytype_uint8 yyr2[] =
{
0, 2, 3, 1, 0, 1, 1, 1, 1, 1,
- 1, 1, 4, 4, 4, 1, 1, 7, 10, 8,
- 11, 12, 6, 1, 3, 3, 2, 3, 1, 0,
- 0, 0, 2, 2, 1, 1, 4, 4, 1, 1,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 2,
- 2, 3, 2, 2, 2, 1, 1, 2, 1, 3,
- 2, 2, 2, 2, 3, 2, 3, 2, 2, 1,
- 3, 2, 3, 0, 8, 0, 1, 3, 4, 0,
- 3, 0, 1, 3
+ 1, 1, 4, 4, 4, 1, 1, 1, 8, 11,
+ 12, 6, 7, 10, 10, 1, 3, 6, 1, 3,
+ 3, 2, 3, 1, 0, 0, 0, 2, 2, 1,
+ 1, 4, 4, 1, 1, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 2, 2, 3, 2, 2, 2,
+ 1, 1, 2, 1, 3, 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
@@ -613,148 +615,148 @@ static const yytype_uint8 yyr2[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 0, 11, 34, 35, 0, 29, 56, 0, 0, 28,
+ 0, 11, 39, 40, 0, 34, 61, 0, 0, 33,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 3, 39, 10, 9, 0, 0, 0, 15, 6, 55,
- 5, 7, 81, 81, 81, 58, 57, 69, 0, 60,
- 0, 61, 0, 62, 0, 63, 65, 73, 52, 53,
- 38, 0, 39, 54, 0, 26, 0, 49, 50, 0,
- 1, 0, 0, 0, 0, 0, 23, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 82, 0, 0, 80,
- 0, 67, 71, 0, 68, 0, 0, 0, 64, 29,
- 0, 0, 27, 0, 0, 51, 2, 0, 30, 0,
- 0, 29, 0, 47, 48, 46, 40, 41, 42, 43,
- 44, 45, 36, 0, 37, 59, 70, 66, 72, 75,
- 12, 14, 13, 31, 0, 25, 0, 30, 24, 83,
- 76, 0, 30, 0, 0, 30, 0, 16, 32, 33,
- 0, 79, 0, 0, 0, 30, 22, 0, 31, 0,
- 0, 31, 77, 0, 30, 31, 31, 30, 17, 78,
- 74, 19, 31, 30, 0, 30, 0, 0, 0, 0,
- 18, 0, 20, 21
+ 3, 44, 10, 9, 17, 0, 0, 0, 15, 6,
+ 60, 5, 7, 86, 86, 86, 63, 62, 74, 0,
+ 65, 0, 66, 0, 67, 0, 68, 70, 78, 57,
+ 58, 43, 0, 44, 59, 0, 31, 0, 54, 55,
+ 0, 1, 0, 0, 0, 0, 0, 28, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 87, 0, 0,
+ 85, 0, 72, 76, 0, 73, 0, 0, 0, 69,
+ 34, 0, 0, 32, 0, 0, 56, 2, 0, 35,
+ 0, 0, 34, 0, 52, 53, 51, 45, 46, 47,
+ 48, 49, 50, 41, 0, 42, 64, 75, 71, 77,
+ 80, 12, 14, 13, 36, 0, 30, 0, 35, 29,
+ 88, 81, 0, 35, 0, 0, 35, 0, 16, 37,
+ 38, 0, 84, 0, 0, 0, 35, 21, 0, 36,
+ 0, 0, 0, 36, 82, 0, 35, 36, 36, 35,
+ 22, 0, 35, 25, 83, 79, 18, 36, 35, 0,
+ 0, 0, 0, 35, 0, 0, 0, 0, 26, 0,
+ 0, 23, 36, 24, 0, 19, 35, 20, 27
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int16 yydefgoto[] =
{
- -1, 19, 20, 52, 139, 23, 65, 24, 25, 136,
- 34, 124, 127, 27, 137, 36, 29, 45, 46, 30,
- 89, 131, 151, 31, 77
+ -1, 19, 20, 53, 140, 23, 24, 162, 163, 66,
+ 25, 26, 137, 35, 125, 128, 28, 138, 37, 30,
+ 46, 47, 31, 90, 132, 153, 32, 78
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -123
+#define YYPACT_NINF -87
static const yytype_int16 yypact[] =
{
- 85, -123, -123, -123, -33, 287, -123, 42, 246, -123,
- 59, 65, 69, 156, -12, 73, 156, 156, 156, 90,
- 47, 15, -123, -123, 34, 48, 200, 275, -123, -123,
- -123, -123, 156, 156, 156, -123, 43, -123, 87, -123,
- 88, -123, 76, -123, 5, 13, -123, -123, -123, -123,
- 56, 156, -123, 214, 97, -123, -9, 35, 35, 251,
- -123, 85, 200, 156, 200, 78, 263, 156, 156, 156,
- 156, 156, 156, 156, 156, 156, 275, 20, 24, 58,
- 103, -123, -123, 107, -123, 108, 109, 96, -123, -123,
- 214, 104, -123, 156, 156, -123, -123, 74, 275, 75,
- 239, -3, 156, 275, 275, 275, -10, -10, 35, 35,
- 275, 275, -123, 156, -123, -123, -123, -123, -123, 114,
- -123, 275, 275, -123, 1, -123, 173, 129, 275, 275,
- -123, -1, 129, 93, 156, -123, 200, -123, -123, -123,
- 30, 79, 122, 125, 156, 275, -123, 110, -123, 121,
- 132, -123, -123, 113, 275, -123, -123, 129, -123, -123,
- 129, -123, -123, 129, 131, 129, 135, 136, 137, 120,
- -123, 124, -123, -123
+ 126, -87, -87, -87, -43, 286, -87, -1, 88, -87,
+ 16, 13, 51, 197, 17, 64, 197, 197, 197, 80,
+ 33, 2, -87, -87, -87, 36, 45, 241, 274, -87,
+ -87, -87, -87, 197, 197, 197, -87, 38, -87, 82,
+ -87, 83, -87, 69, -87, 20, -7, -87, -87, -87,
+ -87, 46, 197, -87, -3, 90, -87, -11, 130, 130,
+ 250, -87, 126, 241, 197, 241, 70, 262, 197, 197,
+ 197, 197, 197, 197, 197, 197, 197, 274, -18, -6,
+ 48, 96, -87, -87, 100, -87, 108, 109, 95, -87,
+ -87, -3, 113, -87, 197, 197, -87, -87, 73, 274,
+ 74, 223, -9, 197, 274, 274, 274, 101, 101, 130,
+ 130, 274, 274, -87, 197, -87, -87, -87, -87, -87,
+ 118, -87, 274, 274, -87, 4, -87, 214, 170, 274,
+ 274, -87, -29, 170, 107, 197, -87, 241, -87, -87,
+ -87, 42, 75, 142, 140, 197, 274, -87, 127, -87,
+ 139, 148, 153, -87, -87, 133, 274, -87, -87, 170,
+ -87, 146, -87, 120, -87, 170, -87, -87, 170, 158,
+ 241, 159, 148, 170, 166, 164, 152, 167, -87, 176,
+ 161, -87, -87, -87, 162, -87, 170, -87, -87
};
/* YYPGOTO[NTERM-NUM]. */
-static const yytype_int8 yypgoto[] =
+static const yytype_int16 yypgoto[] =
{
- -123, 101, -123, 6, 2, -123, -54, -123, -123, 7,
- -71, 84, -122, -13, 9, -123, -123, -123, 112, -123,
- -123, -123, -123, -123, 32
+ -87, 134, -87, 14, 10, -87, -87, 25, -87, -62,
+ -87, -87, 0, -86, -55, -70, -5, 15, -87, -87,
+ -87, 157, -87, -87, -87, -87, -87, 50
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
positive, shift that token. If negative, reduce the rule which
number is the opposite. If zero, do what YYDEFACT says.
If YYTABLE_NINF, syntax error. */
-#define YYTABLE_NINF -39
+#define YYTABLE_NINF -44
static const yytype_int16 yytable[] =
{
- 53, 132, 22, 57, 58, 59, 21, 26, 97, 28,
- 99, -31, -31, 66, 133, -8, 84, 32, 119, 76,
- 76, 76, 85, 54, 55, 93, 157, 67, 68, 160,
- 126, 86, 69, 163, 94, 134, 72, 73, 90, 40,
- 165, 42, 74, 75, 148, 149, -31, 87, 141, 66,
- 98, 100, 35, 142, 103, 104, 105, 106, 107, 108,
- 109, 110, 111, 22, -8, 78, 79, 21, 26, 47,
- 28, 112, 67, 68, 113, 114, 48, 69, 113, 49,
- 121, 122, 147, 56, 62, -4, 1, 74, 75, 128,
- 60, 63, 2, 3, 4, 5, 61, 80, 81, 82,
- 129, 6, 83, 7, 8, 9, 33, 92, 10, 11,
- 12, 101, 113, 115, 120, 13, 14, 15, 116, 117,
- 118, 145, 86, 66, 130, 123, 125, 144, 135, 16,
- 17, 154, 152, 150, -4, 18, 2, 3, 4, 50,
- 153, 158, 159, 156, 161, 6, 167, 7, 8, 9,
- 169, 172, 171, 11, 12, 173, 170, 88, 0, 13,
- 14, 15, 96, 2, 3, 4, 50, 0, 0, 0,
- 0, 0, 0, 16, 17, 0, 0, 0, 138, 18,
- 2, 3, 4, 50, 0, 0, 51, 0, 15, 6,
- 0, 7, 8, 9, 0, 0, 0, 11, 12, 0,
- 16, 17, 0, 13, 14, 15, 18, 2, 3, 4,
- 50, 140, 0, 0, 0, 0, 143, 16, 17, 146,
- 0, 0, 0, 18, 0, 0, 0, 0, 0, 155,
- 51, 0, 15, 0, 0, 91, 0, 0, 162, 0,
- 0, 164, 0, 0, 16, 17, 0, 166, 0, 168,
- 64, 67, 68, 0, 0, 0, 69, 37, 70, 71,
- 72, 73, 0, 38, 0, 0, 74, 75, 39, 0,
- 0, 0, 40, 41, 42, 43, 67, 68, 0, 0,
- 44, 69, 102, 70, 71, 72, 73, 0, 67, 68,
- 95, 74, 75, 69, 0, 70, 71, 72, 73, 0,
- 67, 68, 95, 74, 75, 69, 102, 70, 71, 72,
- 73, 0, 67, 68, 0, 74, 75, 69, 0, 70,
- 71, 72, 73, 0, -38, -38, 0, 74, 75, -38,
- 0, 0, 0, -38, -38, 0, 0, 33, 0, -38,
- -38
+ 27, 98, -8, 100, 120, -36, -36, 33, 54, 36,
+ 22, 58, 59, 60, 21, 29, 127, 134, 92, 41,
+ 142, 43, 67, 94, 49, 143, 48, 88, 77, 77,
+ 77, 85, 95, 113, 68, 69, 114, 86, 135, 70,
+ -36, 71, 72, 73, 74, 115, 87, 91, 114, 75,
+ 76, -8, 55, 56, 133, 151, 149, 150, 67, 99,
+ 101, 50, 27, 104, 105, 106, 107, 108, 109, 110,
+ 111, 112, 22, 141, 57, 148, 21, 29, 144, 159,
+ 61, 147, 62, 165, 79, 80, 63, 168, 64, 122,
+ 123, 157, 81, 82, 83, 84, 34, 173, 129, 38,
+ 93, 167, 114, 102, 169, 39, 116, 171, 176, 130,
+ 40, 117, 186, 174, 41, 42, 43, 44, 179, 118,
+ 119, 87, 45, 121, 124, 126, -4, 1, 131, 152,
+ 146, 188, 67, 2, 3, 4, 5, 136, 68, 69,
+ 156, 145, 6, 70, 7, 8, 9, 73, 74, 10,
+ 11, 12, 154, 75, 76, 155, 13, 14, 15, 160,
+ 158, 170, 161, 164, 166, 67, 9, 68, 69, 172,
+ 16, 17, 70, 175, 177, -4, 18, 2, 3, 4,
+ 51, 180, 75, 76, 181, 182, 6, 183, 7, 8,
+ 9, 184, 185, 187, 11, 12, 97, 178, 0, 0,
+ 13, 14, 15, 89, 2, 3, 4, 51, 0, 0,
+ 0, 0, 0, 0, 16, 17, 0, 0, 0, 139,
+ 18, 2, 3, 4, 51, 0, 0, 52, 0, 15,
+ 6, 0, 7, 8, 9, 0, 0, 0, 11, 12,
+ 0, 16, 17, 0, 13, 14, 15, 18, 2, 3,
+ 4, 51, 0, 0, 0, 0, 0, 0, 16, 17,
+ 68, 69, 0, 0, 18, 70, 103, 71, 72, 73,
+ 74, 52, 0, 15, 96, 75, 76, 0, 0, 0,
+ 0, 0, 0, 0, 0, 16, 17, 68, 69, 0,
+ 0, 65, 70, 0, 71, 72, 73, 74, 0, 68,
+ 69, 96, 75, 76, 70, 103, 71, 72, 73, 74,
+ 0, 68, 69, 0, 75, 76, 70, 0, 71, 72,
+ 73, 74, 0, -43, -43, 0, 75, 76, -43, 0,
+ 0, 0, -43, -43, 0, 0, 34, 0, -43, -43
};
static const yytype_int16 yycheck[] =
{
- 13, 123, 0, 16, 17, 18, 0, 0, 62, 0,
- 64, 14, 15, 26, 13, 0, 11, 50, 89, 32,
- 33, 34, 17, 35, 36, 34, 148, 37, 38, 151,
- 101, 26, 42, 155, 43, 34, 46, 47, 51, 26,
- 162, 28, 52, 53, 14, 15, 49, 34, 49, 62,
- 63, 64, 10, 54, 67, 68, 69, 70, 71, 72,
- 73, 74, 75, 61, 49, 33, 34, 61, 61, 10,
- 61, 51, 37, 38, 54, 51, 11, 42, 54, 10,
- 93, 94, 136, 10, 50, 0, 1, 52, 53, 102,
- 0, 43, 7, 8, 9, 10, 49, 54, 11, 11,
- 113, 16, 26, 18, 19, 20, 50, 10, 23, 24,
- 25, 33, 54, 10, 10, 30, 31, 32, 11, 11,
- 11, 134, 26, 136, 10, 51, 51, 34, 126, 44,
- 45, 144, 10, 54, 49, 50, 7, 8, 9, 10,
- 15, 20, 10, 33, 31, 16, 15, 18, 19, 20,
- 15, 31, 15, 24, 25, 31, 20, 45, -1, 30,
- 31, 32, 61, 7, 8, 9, 10, -1, -1, -1,
- -1, -1, -1, 44, 45, -1, -1, -1, 49, 50,
- 7, 8, 9, 10, -1, -1, 30, -1, 32, 16,
- -1, 18, 19, 20, -1, -1, -1, 24, 25, -1,
- 44, 45, -1, 30, 31, 32, 50, 7, 8, 9,
- 10, 127, -1, -1, -1, -1, 132, 44, 45, 135,
- -1, -1, -1, 50, -1, -1, -1, -1, -1, 145,
- 30, -1, 32, -1, -1, 21, -1, -1, 154, -1,
- -1, 157, -1, -1, 44, 45, -1, 163, -1, 165,
- 50, 37, 38, -1, -1, -1, 42, 11, 44, 45,
- 46, 47, -1, 17, -1, -1, 52, 53, 22, -1,
- -1, -1, 26, 27, 28, 29, 37, 38, -1, -1,
- 34, 42, 43, 44, 45, 46, 47, -1, 37, 38,
- 51, 52, 53, 42, -1, 44, 45, 46, 47, -1,
- 37, 38, 51, 52, 53, 42, 43, 44, 45, 46,
- 47, -1, 37, 38, -1, 52, 53, 42, -1, 44,
- 45, 46, 47, -1, 37, 38, -1, 52, 53, 42,
- -1, -1, -1, 46, 47, -1, -1, 50, -1, 52,
- 53
+ 0, 63, 0, 65, 90, 14, 15, 50, 13, 10,
+ 0, 16, 17, 18, 0, 0, 102, 13, 21, 26,
+ 49, 28, 27, 34, 11, 54, 10, 34, 33, 34,
+ 35, 11, 43, 51, 37, 38, 54, 17, 34, 42,
+ 49, 44, 45, 46, 47, 51, 26, 52, 54, 52,
+ 53, 49, 35, 36, 124, 141, 14, 15, 63, 64,
+ 65, 10, 62, 68, 69, 70, 71, 72, 73, 74,
+ 75, 76, 62, 128, 10, 137, 62, 62, 133, 149,
+ 0, 136, 49, 153, 34, 35, 50, 157, 43, 94,
+ 95, 146, 54, 11, 11, 26, 50, 167, 103, 11,
+ 10, 156, 54, 33, 159, 17, 10, 162, 170, 114,
+ 22, 11, 182, 168, 26, 27, 28, 29, 173, 11,
+ 11, 26, 34, 10, 51, 51, 0, 1, 10, 54,
+ 135, 186, 137, 7, 8, 9, 10, 127, 37, 38,
+ 145, 34, 16, 42, 18, 19, 20, 46, 47, 23,
+ 24, 25, 10, 52, 53, 15, 30, 31, 32, 20,
+ 33, 161, 14, 10, 31, 170, 20, 37, 38, 49,
+ 44, 45, 42, 15, 15, 49, 50, 7, 8, 9,
+ 10, 15, 52, 53, 20, 33, 16, 20, 18, 19,
+ 20, 15, 31, 31, 24, 25, 62, 172, -1, -1,
+ 30, 31, 32, 46, 7, 8, 9, 10, -1, -1,
+ -1, -1, -1, -1, 44, 45, -1, -1, -1, 49,
+ 50, 7, 8, 9, 10, -1, -1, 30, -1, 32,
+ 16, -1, 18, 19, 20, -1, -1, -1, 24, 25,
+ -1, 44, 45, -1, 30, 31, 32, 50, 7, 8,
+ 9, 10, -1, -1, -1, -1, -1, -1, 44, 45,
+ 37, 38, -1, -1, 50, 42, 43, 44, 45, 46,
+ 47, 30, -1, 32, 51, 52, 53, -1, -1, -1,
+ -1, -1, -1, -1, -1, 44, 45, 37, 38, -1,
+ -1, 50, 42, -1, 44, 45, 46, 47, -1, 37,
+ 38, 51, 52, 53, 42, 43, 44, 45, 46, 47,
+ -1, 37, 38, -1, 52, 53, 42, -1, 44, 45,
+ 46, 47, -1, 37, 38, -1, 52, 53, 42, -1,
+ -1, -1, 46, 47, -1, -1, 50, -1, 52, 53
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
@@ -763,22 +765,23 @@ static const yytype_uint8 yystos[] =
{
0, 1, 7, 8, 9, 10, 16, 18, 19, 20,
23, 24, 25, 30, 31, 32, 44, 45, 50, 56,
- 57, 58, 59, 60, 62, 63, 64, 68, 69, 71,
- 74, 78, 50, 50, 65, 10, 70, 11, 17, 22,
- 26, 27, 28, 29, 34, 72, 73, 10, 11, 10,
- 10, 30, 58, 68, 35, 36, 10, 68, 68, 68,
- 0, 49, 50, 43, 50, 61, 68, 37, 38, 42,
- 44, 45, 46, 47, 52, 53, 68, 79, 79, 79,
- 54, 11, 11, 26, 11, 17, 26, 34, 73, 75,
- 68, 21, 10, 34, 43, 51, 56, 61, 68, 61,
- 68, 33, 43, 68, 68, 68, 68, 68, 68, 68,
- 68, 68, 51, 54, 51, 10, 11, 11, 11, 65,
- 10, 68, 68, 51, 66, 51, 65, 67, 68, 68,
- 10, 76, 67, 13, 34, 59, 64, 69, 49, 59,
- 66, 49, 54, 66, 34, 68, 66, 61, 14, 15,
- 54, 77, 10, 15, 68, 66, 33, 67, 20, 10,
- 67, 31, 66, 67, 66, 67, 66, 15, 66, 15,
- 20, 15, 31, 31
+ 57, 58, 59, 60, 61, 65, 66, 67, 71, 72,
+ 74, 77, 81, 50, 50, 68, 10, 73, 11, 17,
+ 22, 26, 27, 28, 29, 34, 75, 76, 10, 11,
+ 10, 10, 30, 58, 71, 35, 36, 10, 71, 71,
+ 71, 0, 49, 50, 43, 50, 64, 71, 37, 38,
+ 42, 44, 45, 46, 47, 52, 53, 71, 82, 82,
+ 82, 54, 11, 11, 26, 11, 17, 26, 34, 76,
+ 78, 71, 21, 10, 34, 43, 51, 56, 64, 71,
+ 64, 71, 33, 43, 71, 71, 71, 71, 71, 71,
+ 71, 71, 71, 51, 54, 51, 10, 11, 11, 11,
+ 68, 10, 71, 71, 51, 69, 51, 68, 70, 71,
+ 71, 10, 79, 70, 13, 34, 59, 67, 72, 49,
+ 59, 69, 49, 54, 69, 34, 71, 69, 64, 14,
+ 15, 68, 54, 80, 10, 15, 71, 69, 33, 70,
+ 20, 14, 62, 63, 10, 70, 31, 69, 70, 69,
+ 67, 69, 49, 70, 69, 15, 64, 15, 62, 69,
+ 15, 20, 33, 20, 15, 31, 70, 31, 69
};
#define yyerrok (yyerrstatus = 0)
@@ -1637,30 +1640,8 @@ yyreduce:
{ g_lingo->code1(g_lingo->c_xpop); ;}
break;
- case 17:
-#line 128 "engines/director/lingo/lingo-gr.y"
- {
- inst then = 0, end = 0;
- WRITE_UINT32(&then, (yyvsp[(4) - (7)].code));
- WRITE_UINT32(&end, (yyvsp[(5) - (7)].code));
- (*g_lingo->_currentScript)[(yyvsp[(1) - (7)].code) + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (7)].code) + 3] = end; ;}
- break;
-
case 18:
-#line 134 "engines/director/lingo/lingo-gr.y"
- {
- inst then = 0, else1 = 0, end = 0;
- WRITE_UINT32(&then, (yyvsp[(4) - (10)].code));
- WRITE_UINT32(&else1, (yyvsp[(7) - (10)].code));
- WRITE_UINT32(&end, (yyvsp[(8) - (10)].code));
- (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 2] = else1; /* elsepart */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 3] = end; ;}
- break;
-
- case 19:
-#line 146 "engines/director/lingo/lingo-gr.y"
+#line 133 "engines/director/lingo/lingo-gr.y"
{
inst body = 0, end = 0;
WRITE_UINT32(&body, (yyvsp[(5) - (8)].code));
@@ -1669,8 +1650,8 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(1) - (8)].code) + 2] = end; ;}
break;
- case 20:
-#line 157 "engines/director/lingo/lingo-gr.y"
+ case 19:
+#line 144 "engines/director/lingo/lingo-gr.y"
{
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
WRITE_UINT32(&init, (yyvsp[(3) - (11)].code));
@@ -1685,8 +1666,8 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 5] = end; ;}
break;
- case 21:
-#line 173 "engines/director/lingo/lingo-gr.y"
+ case 20:
+#line 160 "engines/director/lingo/lingo-gr.y"
{
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
WRITE_UINT32(&init, (yyvsp[(3) - (12)].code));
@@ -1701,8 +1682,8 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 5] = end; ;}
break;
- case 22:
-#line 187 "engines/director/lingo/lingo-gr.y"
+ case 21:
+#line 174 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (6)].code));
@@ -1711,23 +1692,69 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(1) - (6)].code) + 3] = end; ;}
break;
+ case 22:
+#line 182 "engines/director/lingo/lingo-gr.y"
+ {
+ inst then = 0, end = 0;
+ WRITE_UINT32(&then, (yyvsp[(4) - (7)].code));
+ WRITE_UINT32(&end, (yyvsp[(5) - (7)].code));
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (7)].code) + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (7)].code) + 3] = end; ;}
+ break;
+
case 23:
-#line 195 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(STOP); ;}
+#line 188 "engines/director/lingo/lingo-gr.y"
+ {
+ inst then = 0, else1 = 0, end = 0;
+ WRITE_UINT32(&then, (yyvsp[(4) - (10)].code));
+ WRITE_UINT32(&else1, (yyvsp[(7) - (10)].code));
+ WRITE_UINT32(&end, (yyvsp[(8) - (10)].code));
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 2] = else1; /* elsepart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 3] = end; ;}
break;
case 24:
#line 196 "engines/director/lingo/lingo-gr.y"
+ {
+ inst then = 0, else1 = 0, end = 0;
+ WRITE_UINT32(&then, (yyvsp[(4) - (10)].code));
+ WRITE_UINT32(&else1, (yyvsp[(6) - (10)].code));
+ WRITE_UINT32(&end, (yyvsp[(8) - (10)].code));
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 2] = else1; /* elsepart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 3] = end; ;}
+ break;
+
+ case 27:
+#line 210 "engines/director/lingo/lingo-gr.y"
+ {
+ inst then = 0, else1 = 0, end = 0;
+ WRITE_UINT32(&then, (yyvsp[(5) - (6)].code));
+ WRITE_UINT32(&else1, (yyvsp[(6) - (6)].code));
+ WRITE_UINT32(&end, 0);
+ (*g_lingo->_currentScript)[(yyvsp[(2) - (6)].code) + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[(yyvsp[(2) - (6)].code) + 2] = else1; /* elsepart */
+ (*g_lingo->_currentScript)[(yyvsp[(2) - (6)].code) + 3] = end; ;}
+ break;
+
+ case 28:
+#line 220 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(STOP); ;}
+ break;
+
+ case 29:
+#line 221 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code2(g_lingo->c_eq, STOP); ;}
break;
- case 26:
-#line 199 "engines/director/lingo/lingo-gr.y"
+ case 31:
+#line 224 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->code3(g_lingo->c_repeatwhilecode, STOP, STOP); ;}
break;
- case 27:
-#line 201 "engines/director/lingo/lingo-gr.y"
+ case 32:
+#line 226 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code3(g_lingo->c_repeatwithcode, STOP, STOP);
g_lingo->code3(STOP, STOP, STOP);
@@ -1735,28 +1762,28 @@ yyreduce:
delete (yyvsp[(3) - (3)].s); ;}
break;
- case 28:
-#line 207 "engines/director/lingo/lingo-gr.y"
+ case 33:
+#line 232 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->code1(g_lingo->c_ifcode); g_lingo->code3(STOP, STOP, STOP); ;}
break;
- case 29:
-#line 209 "engines/director/lingo/lingo-gr.y"
+ case 34:
+#line 234 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 30:
-#line 211 "engines/director/lingo/lingo-gr.y"
+ case 35:
+#line 236 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(STOP); (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 31:
-#line 213 "engines/director/lingo/lingo-gr.y"
+ case 36:
+#line 238 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 34:
-#line 218 "engines/director/lingo/lingo-gr.y"
+ case 39:
+#line 243 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_constpush);
inst i = 0;
@@ -1764,15 +1791,15 @@ yyreduce:
g_lingo->code1(i); ;}
break;
- case 35:
-#line 223 "engines/director/lingo/lingo-gr.y"
+ case 40:
+#line 248 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_fconstpush);
g_lingo->codeFloat((yyvsp[(1) - (1)].f)); ;}
break;
- case 36:
-#line 226 "engines/director/lingo/lingo-gr.y"
+ case 41:
+#line 251 "engines/director/lingo/lingo-gr.y"
{
if ((yyvsp[(3) - (4)].narg) != g_lingo->_builtins[*(yyvsp[(1) - (4)].s)]->nargs)
error("Built-in function %s expects %d arguments but got %d", (yyvsp[(1) - (4)].s)->c_str(), g_lingo->_builtins[*(yyvsp[(1) - (4)].s)]->nargs, (yyvsp[(3) - (4)].narg));
@@ -1781,8 +1808,8 @@ yyreduce:
delete (yyvsp[(1) - (4)].s); ;}
break;
- case 37:
-#line 232 "engines/director/lingo/lingo-gr.y"
+ case 42:
+#line 257 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (4)].s)->c_str());
@@ -1793,121 +1820,121 @@ yyreduce:
delete (yyvsp[(1) - (4)].s); ;}
break;
- case 38:
-#line 240 "engines/director/lingo/lingo-gr.y"
+ case 43:
+#line 265 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->codeId(*(yyvsp[(1) - (1)].s));
delete (yyvsp[(1) - (1)].s); ;}
break;
- case 40:
-#line 244 "engines/director/lingo/lingo-gr.y"
+ case 45:
+#line 269 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_add); ;}
break;
- case 41:
-#line 245 "engines/director/lingo/lingo-gr.y"
+ case 46:
+#line 270 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_sub); ;}
break;
- case 42:
-#line 246 "engines/director/lingo/lingo-gr.y"
+ case 47:
+#line 271 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_mul); ;}
break;
- case 43:
-#line 247 "engines/director/lingo/lingo-gr.y"
+ case 48:
+#line 272 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_div); ;}
break;
- case 44:
-#line 248 "engines/director/lingo/lingo-gr.y"
+ case 49:
+#line 273 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gt); ;}
break;
- case 45:
-#line 249 "engines/director/lingo/lingo-gr.y"
+ case 50:
+#line 274 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_lt); ;}
break;
- case 46:
-#line 250 "engines/director/lingo/lingo-gr.y"
+ case 51:
+#line 275 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_neq); ;}
break;
- case 47:
-#line 251 "engines/director/lingo/lingo-gr.y"
+ case 52:
+#line 276 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_ge); ;}
break;
- case 48:
-#line 252 "engines/director/lingo/lingo-gr.y"
+ case 53:
+#line 277 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_le); ;}
break;
- case 49:
-#line 253 "engines/director/lingo/lingo-gr.y"
+ case 54:
+#line 278 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
- case 50:
-#line 254 "engines/director/lingo/lingo-gr.y"
+ case 55:
+#line 279 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
break;
- case 51:
-#line 255 "engines/director/lingo/lingo-gr.y"
+ case 56:
+#line 280 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
- case 52:
-#line 258 "engines/director/lingo/lingo-gr.y"
+ case 57:
+#line 283 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_mci); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
break;
- case 53:
-#line 259 "engines/director/lingo/lingo-gr.y"
+ case 58:
+#line 284 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_mciwait); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
break;
- case 54:
-#line 260 "engines/director/lingo/lingo-gr.y"
+ case 59:
+#line 285 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_printtop); ;}
break;
- case 56:
-#line 262 "engines/director/lingo/lingo-gr.y"
+ case 61:
+#line 287 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code2(g_lingo->c_constpush, (inst)0); // Push fake value on stack
g_lingo->code1(g_lingo->c_procret); ;}
break;
- case 58:
-#line 267 "engines/director/lingo/lingo-gr.y"
+ case 63:
+#line 292 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_global); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); delete (yyvsp[(1) - (1)].s); ;}
break;
- case 59:
-#line 268 "engines/director/lingo/lingo-gr.y"
+ case 64:
+#line 293 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_global); g_lingo->codeString((yyvsp[(3) - (3)].s)->c_str()); delete (yyvsp[(3) - (3)].s); ;}
break;
- case 60:
-#line 279 "engines/director/lingo/lingo-gr.y"
+ case 65:
+#line 304 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoloop); ;}
break;
- case 61:
-#line 280 "engines/director/lingo/lingo-gr.y"
+ case 66:
+#line 305 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotonext); ;}
break;
- case 62:
-#line 281 "engines/director/lingo/lingo-gr.y"
+ case 67:
+#line 306 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoprevious); ;}
break;
- case 63:
-#line 282 "engines/director/lingo/lingo-gr.y"
+ case 68:
+#line 307 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str());
@@ -1915,8 +1942,8 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 64:
-#line 287 "engines/director/lingo/lingo-gr.y"
+ case 69:
+#line 312 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str());
@@ -1925,8 +1952,8 @@ yyreduce:
delete (yyvsp[(3) - (3)].s); ;}
break;
- case 65:
-#line 293 "engines/director/lingo/lingo-gr.y"
+ case 70:
+#line 318 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString("");
@@ -1934,48 +1961,48 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 66:
-#line 300 "engines/director/lingo/lingo-gr.y"
+ case 71:
+#line 325 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 67:
-#line 301 "engines/director/lingo/lingo-gr.y"
+ case 72:
+#line 326 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 68:
-#line 302 "engines/director/lingo/lingo-gr.y"
+ case 73:
+#line 327 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 69:
-#line 303 "engines/director/lingo/lingo-gr.y"
+ case 74:
+#line 328 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
- case 70:
-#line 306 "engines/director/lingo/lingo-gr.y"
+ case 75:
+#line 331 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 71:
-#line 307 "engines/director/lingo/lingo-gr.y"
+ case 76:
+#line 332 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 72:
-#line 308 "engines/director/lingo/lingo-gr.y"
+ case 77:
+#line 333 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 73:
-#line 336 "engines/director/lingo/lingo-gr.y"
+ case 78:
+#line 361 "engines/director/lingo/lingo-gr.y"
{ g_lingo->_indef = true; ;}
break;
- case 74:
-#line 337 "engines/director/lingo/lingo-gr.y"
+ case 79:
+#line 362 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code2(g_lingo->c_constpush, (inst)0); // Push fake value on stack
g_lingo->code1(g_lingo->c_procret);
@@ -1983,33 +2010,33 @@ yyreduce:
g_lingo->_indef = false; ;}
break;
- case 75:
-#line 343 "engines/director/lingo/lingo-gr.y"
+ case 80:
+#line 368 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
- case 76:
-#line 344 "engines/director/lingo/lingo-gr.y"
+ case 81:
+#line 369 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(1) - (1)].s)); (yyval.narg) = 1; ;}
break;
- case 77:
-#line 345 "engines/director/lingo/lingo-gr.y"
+ case 82:
+#line 370 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(3) - (3)].s)); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
- case 78:
-#line 346 "engines/director/lingo/lingo-gr.y"
+ case 83:
+#line 371 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(4) - (4)].s)); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
break;
- case 79:
-#line 348 "engines/director/lingo/lingo-gr.y"
+ case 84:
+#line 373 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArgStore(); ;}
break;
- case 80:
-#line 351 "engines/director/lingo/lingo-gr.y"
+ case 85:
+#line 376 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (3)].s)->c_str());
@@ -2018,24 +2045,24 @@ yyreduce:
g_lingo->code1(numpar); ;}
break;
- case 81:
-#line 359 "engines/director/lingo/lingo-gr.y"
+ case 86:
+#line 384 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
- case 82:
-#line 360 "engines/director/lingo/lingo-gr.y"
+ case 87:
+#line 385 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 1; ;}
break;
- case 83:
-#line 361 "engines/director/lingo/lingo-gr.y"
+ case 88:
+#line 386 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
/* Line 1267 of yacc.c. */
-#line 2039 "engines/director/lingo/lingo-gr.cpp"
+#line 2066 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2249,6 +2276,6 @@ yyreturn:
}
-#line 364 "engines/director/lingo/lingo-gr.y"
+#line 389 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 191bccfc0c..de153b9bdc 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -125,20 +125,7 @@ asgn: tPUT expr tINTO ID {
stmt: expr { g_lingo->code1(g_lingo->c_xpop); }
| func
- | if cond tTHEN stmtlist end tEND tIF {
- inst then = 0, end = 0;
- WRITE_UINT32(&then, $4);
- WRITE_UINT32(&end, $5);
- (*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[$1 + 3] = end; } /* end, if cond fails */
- | if cond tTHEN stmtlist end tELSE stmtlist end tEND tIF {
- inst then = 0, else1 = 0, end = 0;
- WRITE_UINT32(&then, $4);
- WRITE_UINT32(&else1, $7);
- WRITE_UINT32(&end, $8);
- (*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[$1 + 2] = else1; /* elsepart */
- (*g_lingo->_currentScript)[$1 + 3] = end; } /* end, if cond fails */
+ | ifstmt
// repeat while (expression = TRUE)
// statements
// end repeat
@@ -192,6 +179,44 @@ stmtoneliner: if cond tTHEN begin stmt end {
(*g_lingo->_currentScript)[$1 + 3] = end; } /* end, if cond fails */
;
+ifstmt: if cond tTHEN stmtlist end tEND tIF {
+ inst then = 0, end = 0;
+ WRITE_UINT32(&then, $4);
+ WRITE_UINT32(&end, $5);
+ (*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[$1 + 3] = end; } /* end, if cond fails */
+ | if cond tTHEN stmtlist end tELSE stmtlist end tEND tIF {
+ inst then = 0, else1 = 0, end = 0;
+ WRITE_UINT32(&then, $4);
+ WRITE_UINT32(&else1, $7);
+ WRITE_UINT32(&end, $8);
+ (*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[$1 + 2] = else1; /* elsepart */
+ (*g_lingo->_currentScript)[$1 + 3] = end; } /* end, if cond fails */
+ | if cond tTHEN stmtlist end begin elseif end tEND tIF {
+ inst then = 0, else1 = 0, end = 0;
+ WRITE_UINT32(&then, $4);
+ WRITE_UINT32(&else1, $6);
+ WRITE_UINT32(&end, $8);
+ (*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[$1 + 2] = else1; /* elsepart */
+ (*g_lingo->_currentScript)[$1 + 3] = end; } /* end, if cond fails */
+ ;
+
+elseif: elseif1
+ | elseif1 '\n' elseif
+ ;
+
+elseif1: tELSE if cond tTHEN stmtlist end {
+ inst then = 0, else1 = 0, end = 0;
+ WRITE_UINT32(&then, $5);
+ WRITE_UINT32(&else1, $6);
+ WRITE_UINT32(&end, 0);
+ (*g_lingo->_currentScript)[$2 + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[$2 + 2] = else1; /* elsepart */
+ (*g_lingo->_currentScript)[$2 + 3] = end; } /* end, if cond fails */
+ ;
+
cond: expr { g_lingo->code1(STOP); }
| expr '=' expr { g_lingo->code2(g_lingo->c_eq, STOP); }
| '(' cond ')'