diff options
author | Eugene Sandulenko | 2016-07-11 15:02:43 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2016-08-03 23:40:36 +0200 |
commit | 52fa9646b0639d5fcb19e841bd5bdbcbf470596a (patch) | |
tree | a62aa0db6994daa0aa9c661a5036f813a7de6e11 | |
parent | d72670e29decf23c8fa7af692615ff85bc97673c (diff) | |
download | scummvm-rg350-52fa9646b0639d5fcb19e841bd5bdbcbf470596a.tar.gz scummvm-rg350-52fa9646b0639d5fcb19e841bd5bdbcbf470596a.tar.bz2 scummvm-rg350-52fa9646b0639d5fcb19e841bd5bdbcbf470596a.zip |
DIRECTOR: Lingo: Improved support for multiple 'else if' statements
-rw-r--r-- | engines/director/lingo/lingo-gr.cpp | 577 | ||||
-rw-r--r-- | engines/director/lingo/lingo-gr.h | 2 | ||||
-rw-r--r-- | engines/director/lingo/lingo-gr.y | 7 | ||||
-rw-r--r-- | engines/director/lingo/tests/if.lingo | 15 |
4 files changed, 309 insertions, 292 deletions
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp index b0312e3305..577afc1f9a 100644 --- a/engines/director/lingo/lingo-gr.cpp +++ b/engines/director/lingo/lingo-gr.cpp @@ -183,7 +183,10 @@ extern int yylex(); extern int yyparse(); using namespace Director; -void yyerror(char *s) { g_lingo->_hadError = true; warning("%s at line %d col %d", s, Director::g_lingo->_linenumber, Director::g_lingo->_colnumber); } +void yyerror(char *s) { + g_lingo->_hadError = true; + warning("%s at line %d col %d", s, g_lingo->_linenumber, g_lingo->_colnumber); +} @@ -208,7 +211,7 @@ void yyerror(char *s) { g_lingo->_hadError = true; warning("%s at line %d col %d #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 66 "engines/director/lingo/lingo-gr.y" +#line 69 "engines/director/lingo/lingo-gr.y" { Common::String *s; int i; @@ -217,7 +220,7 @@ typedef union YYSTYPE int narg; /* number of arguments */ } /* Line 193 of yacc.c. */ -#line 221 "engines/director/lingo/lingo-gr.cpp" +#line 224 "engines/director/lingo/lingo-gr.cpp" YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 @@ -230,7 +233,7 @@ typedef union YYSTYPE /* Line 216 of yacc.c. */ -#line 234 "engines/director/lingo/lingo-gr.cpp" +#line 237 "engines/director/lingo/lingo-gr.cpp" #ifdef short # undef short @@ -445,7 +448,7 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 65 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 555 +#define YYLAST 573 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 64 @@ -454,7 +457,7 @@ union yyalloc /* YYNRULES -- Number of rules. */ #define YYNRULES 106 /* YYNRULES -- Number of states. */ -#define YYNSTATES 224 +#define YYNSTATES 223 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 @@ -506,15 +509,15 @@ static const yytype_uint16 yyprhs[] = { 0, 0, 3, 7, 9, 12, 14, 15, 17, 19, 21, 23, 25, 30, 35, 40, 42, 44, 46, 48, - 57, 69, 82, 91, 103, 116, 123, 134, 145, 146, - 150, 153, 155, 158, 160, 167, 169, 175, 177, 181, - 185, 188, 192, 194, 196, 197, 198, 199, 202, 205, - 207, 209, 211, 216, 221, 223, 225, 229, 233, 237, - 241, 245, 249, 253, 257, 261, 265, 269, 272, 276, - 280, 284, 288, 291, 294, 298, 301, 304, 307, 309, - 311, 314, 316, 320, 323, 326, 329, 332, 336, 339, - 343, 346, 349, 351, 355, 358, 362, 363, 372, 373, - 375, 379, 384, 385, 389, 390, 392 + 57, 69, 82, 91, 103, 115, 122, 133, 144, 145, + 149, 152, 154, 157, 159, 166, 168, 174, 176, 180, + 184, 187, 191, 193, 195, 196, 197, 198, 201, 204, + 206, 208, 210, 215, 220, 222, 224, 228, 232, 236, + 240, 244, 248, 252, 256, 260, 264, 268, 271, 275, + 279, 283, 287, 290, 293, 297, 300, 303, 306, 308, + 310, 313, 315, 319, 322, 325, 328, 331, 335, 338, + 342, 345, 348, 350, 354, 357, 361, 362, 371, 372, + 374, 378, 383, 384, 388, 389, 391 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ @@ -531,51 +534,51 @@ static const yytype_int8 yyrhs[] = 32, -1, 80, 77, 34, 66, 84, 83, 16, 21, -1, 80, 77, 34, 66, 84, 83, 38, 84, 83, 16, 21, -1, 80, 77, 34, 66, 84, 83, 82, - 73, 83, 66, 16, 21, -1, 80, 77, 34, 82, - 69, 83, -1, 80, 77, 34, 82, 69, 83, 38, - 82, 69, 83, -1, 80, 77, 34, 82, 69, 83, - 74, 83, 72, 83, -1, -1, 38, 82, 69, -1, - 73, 76, -1, 76, -1, 74, 75, -1, 75, -1, - 81, 77, 34, 82, 70, 83, -1, 74, -1, 81, - 77, 34, 84, 83, -1, 85, -1, 85, 51, 85, - -1, 58, 77, 59, -1, 32, 37, -1, 32, 36, - 10, -1, 21, -1, 15, -1, -1, -1, -1, 84, - 66, -1, 84, 70, -1, 7, -1, 8, -1, 11, - -1, 9, 58, 96, 59, -1, 10, 58, 96, 59, - -1, 10, -1, 68, -1, 85, 52, 85, -1, 85, - 53, 85, -1, 85, 54, 85, -1, 85, 55, 85, - -1, 85, 60, 85, -1, 85, 61, 85, -1, 85, - 44, 85, -1, 85, 39, 85, -1, 85, 40, 85, - -1, 85, 45, 85, -1, 85, 46, 85, -1, 47, - 85, -1, 85, 62, 85, -1, 85, 48, 85, -1, - 85, 49, 85, -1, 85, 50, 85, -1, 52, 85, - -1, 53, 85, -1, 58, 85, 59, -1, 25, 11, - -1, 26, 10, -1, 31, 85, -1, 88, -1, 17, - -1, 19, 87, -1, 10, -1, 87, 63, 10, -1, - 20, 23, -1, 20, 28, -1, 20, 30, -1, 20, - 89, -1, 20, 89, 90, -1, 20, 90, -1, 35, - 18, 11, -1, 18, 11, -1, 35, 11, -1, 11, - -1, 29, 27, 11, -1, 27, 11, -1, 35, 27, - 11, -1, -1, 24, 10, 92, 82, 93, 66, 94, - 84, -1, -1, 10, -1, 93, 63, 10, -1, 93, - 66, 63, 10, -1, -1, 10, 82, 96, -1, -1, - 85, -1, 96, 63, 85, -1 + 73, 83, 16, 21, -1, 80, 77, 34, 82, 69, + 83, -1, 80, 77, 34, 82, 69, 83, 38, 82, + 69, 83, -1, 80, 77, 34, 82, 69, 83, 74, + 83, 72, 83, -1, -1, 38, 82, 69, -1, 73, + 76, -1, 76, -1, 74, 75, -1, 75, -1, 81, + 77, 34, 82, 70, 83, -1, 74, -1, 81, 77, + 34, 84, 83, -1, 85, -1, 85, 51, 85, -1, + 58, 77, 59, -1, 32, 37, -1, 32, 36, 10, + -1, 21, -1, 15, -1, -1, -1, -1, 84, 66, + -1, 84, 70, -1, 7, -1, 8, -1, 11, -1, + 9, 58, 96, 59, -1, 10, 58, 96, 59, -1, + 10, -1, 68, -1, 85, 52, 85, -1, 85, 53, + 85, -1, 85, 54, 85, -1, 85, 55, 85, -1, + 85, 60, 85, -1, 85, 61, 85, -1, 85, 44, + 85, -1, 85, 39, 85, -1, 85, 40, 85, -1, + 85, 45, 85, -1, 85, 46, 85, -1, 47, 85, + -1, 85, 62, 85, -1, 85, 48, 85, -1, 85, + 49, 85, -1, 85, 50, 85, -1, 52, 85, -1, + 53, 85, -1, 58, 85, 59, -1, 25, 11, -1, + 26, 10, -1, 31, 85, -1, 88, -1, 17, -1, + 19, 87, -1, 10, -1, 87, 63, 10, -1, 20, + 23, -1, 20, 28, -1, 20, 30, -1, 20, 89, + -1, 20, 89, 90, -1, 20, 90, -1, 35, 18, + 11, -1, 18, 11, -1, 35, 11, -1, 11, -1, + 29, 27, 11, -1, 27, 11, -1, 35, 27, 11, + -1, -1, 24, 10, 92, 82, 93, 66, 94, 84, + -1, -1, 10, -1, 93, 63, 10, -1, 93, 66, + 63, 10, -1, -1, 10, 82, 96, -1, -1, 85, + -1, 96, 63, 85, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 95, 95, 96, 97, 100, 105, 106, 107, 108, - 109, 110, 113, 119, 125, 132, 133, 135, 136, 141, - 152, 168, 182, 189, 198, 207, 217, 227, 238, 239, - 242, 243, 246, 247, 250, 258, 259, 267, 268, 269, - 271, 273, 279, 285, 292, 294, 296, 297, 298, 301, - 306, 309, 312, 318, 326, 329, 330, 331, 332, 333, - 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, - 344, 345, 346, 347, 348, 351, 352, 353, 354, 355, - 357, 360, 361, 372, 373, 374, 375, 380, 386, 393, - 394, 395, 396, 399, 400, 401, 429, 429, 436, 437, - 438, 439, 441, 444, 452, 453, 454 + 0, 98, 98, 99, 100, 103, 108, 109, 110, 111, + 112, 113, 116, 122, 128, 135, 136, 138, 139, 144, + 155, 171, 185, 192, 201, 210, 220, 230, 241, 242, + 245, 246, 249, 250, 253, 261, 262, 270, 271, 272, + 274, 276, 282, 288, 295, 297, 299, 300, 301, 304, + 309, 312, 315, 321, 329, 332, 333, 334, 335, 336, + 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, + 347, 348, 349, 350, 351, 354, 355, 356, 357, 358, + 360, 363, 364, 375, 376, 377, 378, 383, 389, 396, + 397, 398, 399, 402, 403, 404, 432, 432, 439, 440, + 441, 442, 444, 447, 455, 456, 457 }; #endif @@ -637,7 +640,7 @@ static const yytype_uint8 yyr2[] = { 0, 2, 3, 1, 2, 1, 0, 1, 1, 1, 1, 1, 4, 4, 4, 1, 1, 1, 1, 8, - 11, 12, 8, 11, 12, 6, 10, 10, 0, 3, + 11, 12, 8, 11, 11, 6, 10, 10, 0, 3, 2, 1, 2, 1, 6, 1, 5, 1, 3, 3, 2, 3, 1, 1, 0, 0, 0, 2, 2, 1, 1, 1, 4, 4, 1, 1, 3, 3, 3, 3, @@ -674,8 +677,8 @@ static const yytype_uint8 yydefact[] = 97, 19, 46, 45, 22, 45, 45, 35, 31, 0, 0, 32, 28, 0, 45, 0, 0, 30, 0, 0, 45, 44, 45, 44, 0, 0, 0, 0, 44, 26, - 0, 27, 0, 0, 20, 23, 0, 45, 29, 45, - 21, 24, 36, 34 + 0, 27, 0, 0, 20, 23, 24, 45, 29, 45, + 21, 36, 34 }; /* YYDEFGOTO[NTERM-NUM]. */ @@ -689,41 +692,41 @@ static const yytype_int16 yydefgoto[] = /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -161 +#define YYPACT_NINF -145 static const yytype_int16 yypact[] = { - 175, -49, -161, -161, -15, 469, -161, -161, 32, 118, - -161, 52, 40, 82, 342, 24, 83, 342, 342, 342, - 342, 9, -161, 11, -161, -161, -161, 37, 47, 349, - 450, -161, -161, -161, -161, -161, 342, 342, 342, -161, - 43, -161, 99, -161, 101, -161, 87, -161, 36, 29, - -161, -161, -161, -161, 57, 342, -161, 364, 107, -161, - -10, -16, -16, -16, 407, -161, -161, 227, 349, 342, - 349, 85, 431, 342, 342, 342, 342, 342, 342, 342, - 342, 342, 342, 342, 342, 342, 342, 342, 450, 41, - 42, 58, 110, -161, -161, 111, -161, 112, 115, 100, - -161, -161, 364, 121, -161, 342, 342, -161, -161, 69, - 450, 78, 383, 81, 342, 450, 450, 450, 450, 450, - 450, 450, 450, 493, 493, -16, -16, 450, 450, 450, - -161, 342, -161, -161, -161, -161, -161, 129, -161, 450, - 450, -161, 1, -161, -161, 314, 450, 450, -161, 33, - 256, 105, 342, 256, -161, -161, 132, 89, -161, -161, - 128, 342, 450, -1, -3, -161, 140, -161, 123, 450, - -161, 135, -161, 142, -161, -161, 142, -161, 349, -161, - 256, -161, -161, 256, -161, 256, 142, 142, -161, 349, - 314, -161, 120, 126, 256, 145, 146, -161, 81, 130, - -161, -161, -161, -161, 149, 137, 151, 154, -5, -161, - 314, -161, 285, 141, -161, -161, 153, 256, -161, -161, - -161, -161, -161, -161 + 174, -46, -145, -145, -9, 468, -145, -145, 47, 5, + -145, 54, 57, 82, 341, 23, 83, 341, 341, 341, + 341, 4, -145, 9, -145, -145, -145, 40, 50, 348, + 449, -145, -145, -145, -145, -145, 341, 341, 341, -145, + 39, -145, 94, -145, 97, -145, 84, -145, -1, 16, + -145, -145, -145, -145, 52, 341, -145, 363, 104, -145, + -10, 511, 511, 511, 406, -145, -145, 226, 348, 341, + 348, 86, 430, 341, 341, 341, 341, 341, 341, 341, + 341, 341, 341, 341, 341, 341, 341, 341, 449, -15, + 36, 53, 107, -145, -145, 110, -145, 111, 112, 91, + -145, -145, 363, 115, -145, 341, 341, -145, -145, 68, + 449, 69, 382, 72, 341, 449, 449, 449, 449, 449, + 449, 449, 449, 492, 492, 511, 511, 449, 449, 449, + -145, 341, -145, -145, -145, -145, -145, 121, -145, 449, + 449, -145, 11, -145, -145, 313, 449, 449, -145, 33, + 255, 99, 341, 255, -145, -145, 127, 75, -145, -145, + 123, 341, 449, -2, -7, -145, 130, -145, 109, 449, + -145, 122, -145, 131, -145, -145, 131, -145, 348, -145, + 255, -145, -145, 255, -145, 255, 131, 131, -145, 348, + 313, -145, 113, 108, 255, 129, 132, -145, 133, 120, + -145, -145, -145, -145, 139, 124, 126, 136, -3, -145, + 313, -145, 284, 128, -145, -145, -145, 255, -145, -145, + -145, -145, -145 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -161, -161, -19, 114, 6, -141, 0, -161, -161, -161, - 3, -128, -9, -65, -161, -161, -161, -160, -4, -51, - -117, 2, 7, -161, -161, -161, 138, -161, -161, -161, - -161, -161, -20 + -145, -145, -19, 96, 6, -138, 0, -145, -145, -145, + -6, -129, -25, -65, -145, -145, -145, -144, -4, -50, + -117, 1, 22, -145, -145, -145, 116, -145, -145, -145, + -145, -145, 25 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If @@ -733,122 +736,126 @@ static const yytype_int16 yypgoto[] = #define YYTABLE_NINF -55 static const yytype_int16 yytable[] = { - 25, 38, 67, 109, 154, 111, 23, 31, 35, 65, - -46, -10, 174, 189, 151, 171, 57, 90, 91, 61, - 62, 63, 64, 73, 74, 105, 189, 153, 75, 76, - 77, 72, 78, 79, 80, 175, 152, 172, 88, 88, - 88, 106, 39, 36, 85, 86, 87, 96, 191, 200, - 180, 52, -46, 183, 97, 185, 44, 102, 46, 191, - 58, 59, 51, 98, 99, 194, 66, 25, -10, 218, - 72, 110, 112, 23, 31, 115, 116, 117, 118, 119, - 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, - 66, 217, 53, 60, 144, 68, 156, 137, 69, 160, - 130, 132, 163, 164, 131, 131, 92, 139, 140, 145, - 93, 170, 94, 193, 95, 37, 146, 104, 182, 113, - 133, 131, 134, 135, 199, 192, 136, 98, 141, 41, - 157, 138, 195, 147, 196, 198, 42, 143, 66, 148, - 161, 43, 165, 204, 168, 44, 45, 46, 47, 209, - 179, 211, 166, 48, 162, 181, 184, 174, 201, 173, - 203, 205, 206, 169, 208, 213, 222, 176, 223, 214, - 216, 190, 215, 220, 221, -6, 1, 197, 0, 207, - 72, 108, 2, 3, 4, 5, 6, 100, 0, 0, - 0, 72, 7, 0, 8, 9, 10, 210, 0, 11, - 12, 13, 0, 0, 0, 0, 14, 15, 16, 0, + 25, 38, 67, 109, 65, 111, 23, 154, 174, -10, + 96, 35, -46, -46, 171, 57, 41, 97, 61, 62, + 63, 64, 31, 42, 151, 105, 98, 153, 43, 189, + 72, 175, 44, 45, 46, 47, 172, 88, 88, 88, + 48, 106, 189, 44, 130, 46, 152, 191, 131, 36, + 180, 99, 200, 183, -46, 185, 102, 39, 191, 58, + 59, 66, 90, 91, 51, 194, -10, 25, 52, 72, + 110, 112, 218, 23, 115, 116, 117, 118, 119, 120, + 121, 122, 123, 124, 125, 126, 127, 128, 129, 31, + 66, 217, 53, 60, 144, 132, 156, 137, 68, 131, + 160, 69, 92, 163, 164, 93, 139, 140, 94, 145, + 37, 95, 170, 193, 104, 146, 131, 133, 98, 182, + 113, 134, 135, 136, 199, 138, 192, 141, 143, 66, + 157, 148, 147, 195, 161, 196, 198, 165, 166, 168, + 179, 181, 203, 184, 204, 205, 174, 215, 206, 207, + 209, 201, 211, 162, 208, 213, 214, 216, 176, 173, + 220, 197, 169, 108, 0, 100, 0, 221, 0, 222, + 0, 190, 0, 0, -6, 1, 0, 0, 0, 72, + 0, 2, 3, 4, 5, 6, 0, 0, 0, 0, + 72, 7, 0, 8, 9, 10, 0, 210, 11, 12, + 13, 0, 0, 0, 0, 14, 15, 16, 0, 0, 0, 0, 219, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 17, 0, 0, 0, 0, 18, 19, 0, - 0, 0, -6, 20, 2, 3, 4, 5, 6, 0, - 0, 0, 0, 0, 7, 0, 8, 9, 10, 0, - 0, 11, 12, 13, 0, 0, 0, 0, 14, 15, - 16, 0, 0, 2, 3, 4, 54, 6, 0, 0, - 0, 0, 0, 7, 17, 8, 9, 10, 0, 18, - 19, 12, 13, 0, 0, 20, 0, 14, 15, 16, + 0, 17, 0, 0, 0, 0, 18, 19, 0, 0, + 0, -6, 20, 2, 3, 4, 5, 6, 0, 0, + 0, 0, 0, 7, 0, 8, 9, 10, 0, 0, + 11, 12, 13, 0, 0, 0, 0, 14, 15, 16, 0, 0, 2, 3, 4, 54, 6, 0, 0, 0, 0, 0, 7, 17, 8, 9, 10, 0, 18, 19, - 12, 13, 0, 66, 20, 0, 14, 15, 16, 0, + 12, 13, 0, 0, 20, 0, 14, 15, 16, 0, 0, 2, 3, 4, 54, 6, 0, 0, 0, 0, - 0, 7, 17, 8, 9, 0, 0, 18, 19, 12, - 13, 0, 0, 20, 0, 14, 0, 16, 0, 2, - 3, 4, 54, 6, 0, 0, 2, 3, 4, 54, - 6, 17, 0, 0, 0, 0, 18, 19, 0, 0, - 0, 0, 20, 55, 0, 16, 0, 0, 0, 0, - 55, 0, 16, 0, 0, 0, 103, 0, 0, 17, - 0, 0, 0, 0, 18, 19, 17, 0, 0, 0, - 20, 18, 19, 73, 74, 0, 0, 70, 75, 76, - 77, 0, 78, 79, 80, 0, 81, 82, 83, 84, - 0, 0, 73, 74, 85, 86, 87, 75, 76, 77, - 0, 78, 79, 80, 114, 81, 82, 83, 84, 0, - 0, 0, 107, 85, 86, 87, 73, 74, 0, 0, - 0, 75, 76, 77, 0, 78, 79, 80, 0, 81, - 82, 83, 84, 0, 0, 0, 107, 85, 86, 87, - 73, 74, 0, 0, 0, 75, 76, 77, 0, 78, - 79, 80, 114, 81, 82, 83, 84, 0, 0, 73, - 74, 85, 86, 87, 75, 76, 77, 0, 78, 79, - 80, 0, 81, 82, 83, 84, 0, 0, -54, -54, - 85, 86, 87, -54, -54, -54, 0, -54, -54, -54, - 0, 0, 0, -54, -54, 0, 0, 37, 0, -54, - -54, -54, 73, 74, 0, 0, 0, 75, 76, 77, - 0, 78, 79, 80, 0, 0, 0, 83, 84, 0, - 0, 0, 0, 85, 86, 87 + 0, 7, 17, 8, 9, 10, 0, 18, 19, 12, + 13, 0, 66, 20, 0, 14, 15, 16, 0, 0, + 2, 3, 4, 54, 6, 0, 0, 0, 0, 0, + 7, 17, 8, 9, 0, 0, 18, 19, 12, 13, + 0, 0, 20, 0, 14, 0, 16, 0, 2, 3, + 4, 54, 6, 0, 0, 2, 3, 4, 54, 6, + 17, 0, 0, 0, 0, 18, 19, 0, 0, 0, + 0, 20, 55, 0, 16, 0, 0, 0, 0, 55, + 0, 16, 0, 0, 0, 103, 0, 0, 17, 0, + 0, 0, 0, 18, 19, 17, 0, 0, 0, 20, + 18, 19, 73, 74, 0, 0, 70, 75, 76, 77, + 0, 78, 79, 80, 0, 81, 82, 83, 84, 0, + 0, 73, 74, 85, 86, 87, 75, 76, 77, 0, + 78, 79, 80, 114, 81, 82, 83, 84, 0, 0, + 0, 107, 85, 86, 87, 73, 74, 0, 0, 0, + 75, 76, 77, 0, 78, 79, 80, 0, 81, 82, + 83, 84, 0, 0, 0, 107, 85, 86, 87, 73, + 74, 0, 0, 0, 75, 76, 77, 0, 78, 79, + 80, 114, 81, 82, 83, 84, 0, 0, 73, 74, + 85, 86, 87, 75, 76, 77, 0, 78, 79, 80, + 0, 81, 82, 83, 84, 0, 0, -54, -54, 85, + 86, 87, -54, -54, -54, 0, -54, -54, -54, 0, + 0, 0, -54, -54, 0, 0, 37, 0, -54, -54, + -54, 73, 74, 0, 0, 0, 75, 76, 77, 0, + 78, 79, 80, 0, 0, 0, 83, 84, 0, 0, + 73, 74, 85, 86, 87, 75, 76, 77, 0, 78, + 79, 80, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 85, 86, 87 }; static const yytype_int16 yycheck[] = { - 0, 5, 21, 68, 145, 70, 0, 0, 57, 0, - 15, 0, 15, 173, 13, 16, 14, 37, 38, 17, - 18, 19, 20, 39, 40, 35, 186, 144, 44, 45, - 46, 29, 48, 49, 50, 38, 35, 38, 36, 37, - 38, 51, 10, 58, 60, 61, 62, 11, 176, 190, - 167, 11, 57, 170, 18, 172, 27, 55, 29, 187, - 36, 37, 10, 27, 35, 182, 57, 67, 57, 210, - 68, 69, 70, 67, 67, 73, 74, 75, 76, 77, - 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, - 57, 208, 10, 10, 113, 58, 63, 101, 51, 150, - 59, 59, 153, 154, 63, 63, 63, 105, 106, 113, - 11, 162, 11, 178, 27, 58, 114, 10, 169, 34, - 10, 63, 11, 11, 189, 176, 11, 27, 59, 11, - 149, 10, 183, 131, 185, 186, 18, 59, 57, 10, - 35, 23, 10, 194, 16, 27, 28, 29, 30, 200, - 10, 202, 63, 35, 152, 32, 21, 15, 38, 163, - 34, 16, 16, 161, 34, 16, 217, 164, 219, 32, - 16, 175, 21, 32, 21, 0, 1, 186, -1, 198, - 178, 67, 7, 8, 9, 10, 11, 49, -1, -1, - -1, 189, 17, -1, 19, 20, 21, 201, -1, 24, - 25, 26, -1, -1, -1, -1, 31, 32, 33, -1, + 0, 5, 21, 68, 0, 70, 0, 145, 15, 0, + 11, 57, 15, 16, 16, 14, 11, 18, 17, 18, + 19, 20, 0, 18, 13, 35, 27, 144, 23, 173, + 29, 38, 27, 28, 29, 30, 38, 36, 37, 38, + 35, 51, 186, 27, 59, 29, 35, 176, 63, 58, + 167, 35, 190, 170, 57, 172, 55, 10, 187, 36, + 37, 57, 37, 38, 10, 182, 57, 67, 11, 68, + 69, 70, 210, 67, 73, 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, 85, 86, 87, 67, + 57, 208, 10, 10, 113, 59, 63, 101, 58, 63, + 150, 51, 63, 153, 154, 11, 105, 106, 11, 113, + 58, 27, 162, 178, 10, 114, 63, 10, 27, 169, + 34, 11, 11, 11, 189, 10, 176, 59, 59, 57, + 149, 10, 131, 183, 35, 185, 186, 10, 63, 16, + 10, 32, 34, 21, 194, 16, 15, 21, 16, 16, + 200, 38, 202, 152, 34, 16, 32, 21, 164, 163, + 32, 186, 161, 67, -1, 49, -1, 217, -1, 219, + -1, 175, -1, -1, 0, 1, -1, -1, -1, 178, + -1, 7, 8, 9, 10, 11, -1, -1, -1, -1, + 189, 17, -1, 19, 20, 21, -1, 201, 24, 25, + 26, -1, -1, -1, -1, 31, 32, 33, -1, -1, -1, -1, 212, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 47, -1, -1, -1, -1, 52, 53, -1, - -1, -1, 57, 58, 7, 8, 9, 10, 11, -1, - -1, -1, -1, -1, 17, -1, 19, 20, 21, -1, - -1, 24, 25, 26, -1, -1, -1, -1, 31, 32, - 33, -1, -1, 7, 8, 9, 10, 11, -1, -1, - -1, -1, -1, 17, 47, 19, 20, 21, -1, 52, - 53, 25, 26, -1, -1, 58, -1, 31, 32, 33, + -1, 47, -1, -1, -1, -1, 52, 53, -1, -1, + -1, 57, 58, 7, 8, 9, 10, 11, -1, -1, + -1, -1, -1, 17, -1, 19, 20, 21, -1, -1, + 24, 25, 26, -1, -1, -1, -1, 31, 32, 33, -1, -1, 7, 8, 9, 10, 11, -1, -1, -1, -1, -1, 17, 47, 19, 20, 21, -1, 52, 53, - 25, 26, -1, 57, 58, -1, 31, 32, 33, -1, + 25, 26, -1, -1, 58, -1, 31, 32, 33, -1, -1, 7, 8, 9, 10, 11, -1, -1, -1, -1, - -1, 17, 47, 19, 20, -1, -1, 52, 53, 25, - 26, -1, -1, 58, -1, 31, -1, 33, -1, 7, - 8, 9, 10, 11, -1, -1, 7, 8, 9, 10, - 11, 47, -1, -1, -1, -1, 52, 53, -1, -1, - -1, -1, 58, 31, -1, 33, -1, -1, -1, -1, - 31, -1, 33, -1, -1, -1, 22, -1, -1, 47, - -1, -1, -1, -1, 52, 53, 47, -1, -1, -1, - 58, 52, 53, 39, 40, -1, -1, 58, 44, 45, - 46, -1, 48, 49, 50, -1, 52, 53, 54, 55, - -1, -1, 39, 40, 60, 61, 62, 44, 45, 46, - -1, 48, 49, 50, 51, 52, 53, 54, 55, -1, - -1, -1, 59, 60, 61, 62, 39, 40, -1, -1, - -1, 44, 45, 46, -1, 48, 49, 50, -1, 52, - 53, 54, 55, -1, -1, -1, 59, 60, 61, 62, - 39, 40, -1, -1, -1, 44, 45, 46, -1, 48, - 49, 50, 51, 52, 53, 54, 55, -1, -1, 39, - 40, 60, 61, 62, 44, 45, 46, -1, 48, 49, - 50, -1, 52, 53, 54, 55, -1, -1, 39, 40, + -1, 17, 47, 19, 20, 21, -1, 52, 53, 25, + 26, -1, 57, 58, -1, 31, 32, 33, -1, -1, + 7, 8, 9, 10, 11, -1, -1, -1, -1, -1, + 17, 47, 19, 20, -1, -1, 52, 53, 25, 26, + -1, -1, 58, -1, 31, -1, 33, -1, 7, 8, + 9, 10, 11, -1, -1, 7, 8, 9, 10, 11, + 47, -1, -1, -1, -1, 52, 53, -1, -1, -1, + -1, 58, 31, -1, 33, -1, -1, -1, -1, 31, + -1, 33, -1, -1, -1, 22, -1, -1, 47, -1, + -1, -1, -1, 52, 53, 47, -1, -1, -1, 58, + 52, 53, 39, 40, -1, -1, 58, 44, 45, 46, + -1, 48, 49, 50, -1, 52, 53, 54, 55, -1, + -1, 39, 40, 60, 61, 62, 44, 45, 46, -1, + 48, 49, 50, 51, 52, 53, 54, 55, -1, -1, + -1, 59, 60, 61, 62, 39, 40, -1, -1, -1, + 44, 45, 46, -1, 48, 49, 50, -1, 52, 53, + 54, 55, -1, -1, -1, 59, 60, 61, 62, 39, + 40, -1, -1, -1, 44, 45, 46, -1, 48, 49, + 50, 51, 52, 53, 54, 55, -1, -1, 39, 40, 60, 61, 62, 44, 45, 46, -1, 48, 49, 50, - -1, -1, -1, 54, 55, -1, -1, 58, -1, 60, - 61, 62, 39, 40, -1, -1, -1, 44, 45, 46, - -1, 48, 49, 50, -1, -1, -1, 54, 55, -1, - -1, -1, -1, 60, 61, 62 + -1, 52, 53, 54, 55, -1, -1, 39, 40, 60, + 61, 62, 44, 45, 46, -1, 48, 49, 50, -1, + -1, -1, 54, 55, -1, -1, 58, -1, 60, 61, + 62, 39, 40, -1, -1, -1, 44, 45, 46, -1, + 48, 49, 50, -1, -1, -1, 54, 55, -1, -1, + 39, 40, 60, 61, 62, 44, 45, 46, -1, 48, + 49, 50, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 60, 61, 62 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing @@ -875,9 +882,9 @@ static const yytype_uint8 yystos[] = 83, 16, 38, 82, 15, 38, 74, 75, 81, 10, 84, 32, 83, 84, 21, 84, 73, 74, 76, 81, 82, 75, 83, 77, 84, 83, 83, 76, 83, 77, - 69, 38, 72, 34, 83, 16, 16, 66, 34, 83, - 82, 83, 82, 16, 32, 21, 16, 84, 69, 70, - 32, 21, 83, 83 + 69, 38, 72, 34, 83, 16, 16, 16, 34, 83, + 82, 83, 82, 16, 32, 21, 21, 84, 69, 70, + 32, 83, 83 }; #define yyerrok (yyerrstatus = 0) @@ -1692,12 +1699,12 @@ yyreduce: switch (yyn) { case 4: -#line 97 "engines/director/lingo/lingo-gr.y" +#line 100 "engines/director/lingo/lingo-gr.y" { yyerrok; ;} break; case 5: -#line 100 "engines/director/lingo/lingo-gr.y" +#line 103 "engines/director/lingo/lingo-gr.y" { g_lingo->_linenumber++; g_lingo->_colnumber = 1; @@ -1705,12 +1712,12 @@ yyreduce: break; case 10: -#line 109 "engines/director/lingo/lingo-gr.y" +#line 112 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_xpop); ;} break; case 12: -#line 113 "engines/director/lingo/lingo-gr.y" +#line 116 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_varpush); g_lingo->codeString((yyvsp[(4) - (4)].s)->c_str()); @@ -1720,7 +1727,7 @@ yyreduce: break; case 13: -#line 119 "engines/director/lingo/lingo-gr.y" +#line 122 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_varpush); g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str()); @@ -1730,7 +1737,7 @@ yyreduce: break; case 14: -#line 125 "engines/director/lingo/lingo-gr.y" +#line 128 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_varpush); g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str()); @@ -1740,12 +1747,12 @@ yyreduce: break; case 15: -#line 132 "engines/director/lingo/lingo-gr.y" +#line 135 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_xpop); ;} break; case 19: -#line 141 "engines/director/lingo/lingo-gr.y" +#line 144 "engines/director/lingo/lingo-gr.y" { inst body = 0, end = 0; WRITE_UINT32(&body, (yyvsp[(5) - (8)].code)); @@ -1755,7 +1762,7 @@ yyreduce: break; case 20: -#line 152 "engines/director/lingo/lingo-gr.y" +#line 155 "engines/director/lingo/lingo-gr.y" { inst init = 0, finish = 0, body = 0, end = 0, inc = 0; WRITE_UINT32(&init, (yyvsp[(3) - (11)].code)); @@ -1771,7 +1778,7 @@ yyreduce: break; case 21: -#line 168 "engines/director/lingo/lingo-gr.y" +#line 171 "engines/director/lingo/lingo-gr.y" { inst init = 0, finish = 0, body = 0, end = 0, inc = 0; WRITE_UINT32(&init, (yyvsp[(3) - (12)].code)); @@ -1787,7 +1794,7 @@ yyreduce: break; case 22: -#line 182 "engines/director/lingo/lingo-gr.y" +#line 185 "engines/director/lingo/lingo-gr.y" { inst then = 0, end = 0; WRITE_UINT32(&then, (yyvsp[(5) - (8)].code)); @@ -1798,7 +1805,7 @@ yyreduce: break; case 23: -#line 189 "engines/director/lingo/lingo-gr.y" +#line 192 "engines/director/lingo/lingo-gr.y" { inst then = 0, else1 = 0, end = 0; WRITE_UINT32(&then, (yyvsp[(5) - (11)].code)); @@ -1811,20 +1818,20 @@ yyreduce: break; case 24: -#line 198 "engines/director/lingo/lingo-gr.y" +#line 201 "engines/director/lingo/lingo-gr.y" { inst then = 0, else1 = 0, end = 0; - WRITE_UINT32(&then, (yyvsp[(5) - (12)].code)); - WRITE_UINT32(&else1, (yyvsp[(7) - (12)].code)); - WRITE_UINT32(&end, (yyvsp[(9) - (12)].code)); - (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 1] = then; /* thenpart */ - (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 2] = else1; /* elsepart */ - (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 3] = end; /* end, if cond fails */ - g_lingo->processIf(0, (yyvsp[(9) - (12)].code)); ;} + WRITE_UINT32(&then, (yyvsp[(5) - (11)].code)); + WRITE_UINT32(&else1, (yyvsp[(7) - (11)].code)); + WRITE_UINT32(&end, (yyvsp[(9) - (11)].code)); + (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 1] = then; /* thenpart */ + (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 2] = else1; /* elsepart */ + (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 3] = end; /* end, if cond fails */ + g_lingo->processIf(0, (yyvsp[(9) - (11)].code)); ;} break; case 25: -#line 207 "engines/director/lingo/lingo-gr.y" +#line 210 "engines/director/lingo/lingo-gr.y" { inst then = 0, else1 = 0, end = 0; WRITE_UINT32(&then, (yyvsp[(4) - (6)].code)); @@ -1838,7 +1845,7 @@ yyreduce: break; case 26: -#line 217 "engines/director/lingo/lingo-gr.y" +#line 220 "engines/director/lingo/lingo-gr.y" { inst then = 0, else1 = 0, end = 0; WRITE_UINT32(&then, (yyvsp[(4) - (10)].code)); @@ -1852,7 +1859,7 @@ yyreduce: break; case 27: -#line 227 "engines/director/lingo/lingo-gr.y" +#line 230 "engines/director/lingo/lingo-gr.y" { inst then = 0, else1 = 0, end = 0; WRITE_UINT32(&then, (yyvsp[(4) - (10)].code)); @@ -1866,17 +1873,17 @@ yyreduce: break; case 28: -#line 238 "engines/director/lingo/lingo-gr.y" +#line 241 "engines/director/lingo/lingo-gr.y" { (yyval.code) = 0; ;} break; case 29: -#line 239 "engines/director/lingo/lingo-gr.y" +#line 242 "engines/director/lingo/lingo-gr.y" { (yyval.code) = (yyvsp[(2) - (3)].code); ;} break; case 34: -#line 250 "engines/director/lingo/lingo-gr.y" +#line 253 "engines/director/lingo/lingo-gr.y" { inst then = 0; WRITE_UINT32(&then, (yyvsp[(4) - (6)].code)); @@ -1886,7 +1893,7 @@ yyreduce: break; case 36: -#line 259 "engines/director/lingo/lingo-gr.y" +#line 262 "engines/director/lingo/lingo-gr.y" { inst then = 0; WRITE_UINT32(&then, (yyvsp[(4) - (5)].code)); @@ -1896,22 +1903,22 @@ yyreduce: break; case 37: -#line 267 "engines/director/lingo/lingo-gr.y" +#line 270 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(STOP); ;} break; case 38: -#line 268 "engines/director/lingo/lingo-gr.y" +#line 271 "engines/director/lingo/lingo-gr.y" { g_lingo->code2(g_lingo->c_eq, STOP); ;} break; case 40: -#line 271 "engines/director/lingo/lingo-gr.y" +#line 274 "engines/director/lingo/lingo-gr.y" { (yyval.code) = g_lingo->code3(g_lingo->c_repeatwhilecode, STOP, STOP); ;} break; case 41: -#line 273 "engines/director/lingo/lingo-gr.y" +#line 276 "engines/director/lingo/lingo-gr.y" { (yyval.code) = g_lingo->code3(g_lingo->c_repeatwithcode, STOP, STOP); g_lingo->code3(STOP, STOP, STOP); @@ -1920,7 +1927,7 @@ yyreduce: break; case 42: -#line 279 "engines/director/lingo/lingo-gr.y" +#line 282 "engines/director/lingo/lingo-gr.y" { (yyval.code) = g_lingo->code1(g_lingo->c_ifcode); g_lingo->code3(STOP, STOP, STOP); @@ -1929,7 +1936,7 @@ yyreduce: break; case 43: -#line 285 "engines/director/lingo/lingo-gr.y" +#line 288 "engines/director/lingo/lingo-gr.y" { inst skipEnd; WRITE_UINT32(&skipEnd, 1); // We have to skip end to avoid multiple executions @@ -1939,22 +1946,22 @@ yyreduce: break; case 44: -#line 292 "engines/director/lingo/lingo-gr.y" +#line 295 "engines/director/lingo/lingo-gr.y" { (yyval.code) = g_lingo->_currentScript->size(); ;} break; case 45: -#line 294 "engines/director/lingo/lingo-gr.y" +#line 297 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(STOP); (yyval.code) = g_lingo->_currentScript->size(); ;} break; case 46: -#line 296 "engines/director/lingo/lingo-gr.y" +#line 299 "engines/director/lingo/lingo-gr.y" { (yyval.code) = g_lingo->_currentScript->size(); ;} break; case 49: -#line 301 "engines/director/lingo/lingo-gr.y" +#line 304 "engines/director/lingo/lingo-gr.y" { (yyval.code) = g_lingo->code1(g_lingo->c_constpush); inst i = 0; @@ -1963,21 +1970,21 @@ yyreduce: break; case 50: -#line 306 "engines/director/lingo/lingo-gr.y" +#line 309 "engines/director/lingo/lingo-gr.y" { (yyval.code) = g_lingo->code1(g_lingo->c_fconstpush); g_lingo->codeFloat((yyvsp[(1) - (1)].f)); ;} break; case 51: -#line 309 "engines/director/lingo/lingo-gr.y" +#line 312 "engines/director/lingo/lingo-gr.y" { (yyval.code) = g_lingo->code1(g_lingo->c_stringpush); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); ;} break; case 52: -#line 312 "engines/director/lingo/lingo-gr.y" +#line 315 "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)); @@ -1987,7 +1994,7 @@ yyreduce: break; case 53: -#line 318 "engines/director/lingo/lingo-gr.y" +#line 321 "engines/director/lingo/lingo-gr.y" { (yyval.code) = g_lingo->code1(g_lingo->c_call); g_lingo->codeString((yyvsp[(1) - (4)].s)->c_str()); @@ -1999,155 +2006,155 @@ yyreduce: break; case 54: -#line 326 "engines/director/lingo/lingo-gr.y" +#line 329 "engines/director/lingo/lingo-gr.y" { (yyval.code) = g_lingo->codeId(*(yyvsp[(1) - (1)].s)); delete (yyvsp[(1) - (1)].s); ;} break; case 56: -#line 330 "engines/director/lingo/lingo-gr.y" +#line 333 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_add); ;} break; case 57: -#line 331 "engines/director/lingo/lingo-gr.y" +#line 334 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_sub); ;} break; case 58: -#line 332 "engines/director/lingo/lingo-gr.y" +#line 335 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_mul); ;} break; case 59: -#line 333 "engines/director/lingo/lingo-gr.y" +#line 336 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_div); ;} break; case 60: -#line 334 "engines/director/lingo/lingo-gr.y" +#line 337 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_gt); ;} break; case 61: -#line 335 "engines/director/lingo/lingo-gr.y" +#line 338 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_lt); ;} break; case 62: -#line 336 "engines/director/lingo/lingo-gr.y" +#line 339 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_neq); ;} break; case 63: -#line 337 "engines/director/lingo/lingo-gr.y" +#line 340 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_ge); ;} break; case 64: -#line 338 "engines/director/lingo/lingo-gr.y" +#line 341 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_le); ;} break; case 65: -#line 339 "engines/director/lingo/lingo-gr.y" +#line 342 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_and); ;} break; case 66: -#line 340 "engines/director/lingo/lingo-gr.y" +#line 343 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_or); ;} break; case 67: -#line 341 "engines/director/lingo/lingo-gr.y" +#line 344 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_not); ;} break; case 68: -#line 342 "engines/director/lingo/lingo-gr.y" +#line 345 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_ampersand); ;} break; case 69: -#line 343 "engines/director/lingo/lingo-gr.y" +#line 346 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_concat); ;} break; case 70: -#line 344 "engines/director/lingo/lingo-gr.y" +#line 347 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_contains); ;} break; case 71: -#line 345 "engines/director/lingo/lingo-gr.y" +#line 348 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_starts); ;} break; case 72: -#line 346 "engines/director/lingo/lingo-gr.y" +#line 349 "engines/director/lingo/lingo-gr.y" { (yyval.code) = (yyvsp[(2) - (2)].code); ;} break; case 73: -#line 347 "engines/director/lingo/lingo-gr.y" +#line 350 "engines/director/lingo/lingo-gr.y" { (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;} break; case 74: -#line 348 "engines/director/lingo/lingo-gr.y" +#line 351 "engines/director/lingo/lingo-gr.y" { (yyval.code) = (yyvsp[(2) - (3)].code); ;} break; case 75: -#line 351 "engines/director/lingo/lingo-gr.y" +#line 354 "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 76: -#line 352 "engines/director/lingo/lingo-gr.y" +#line 355 "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 77: -#line 353 "engines/director/lingo/lingo-gr.y" +#line 356 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_printtop); ;} break; case 79: -#line 355 "engines/director/lingo/lingo-gr.y" +#line 358 "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 81: -#line 360 "engines/director/lingo/lingo-gr.y" +#line 363 "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 82: -#line 361 "engines/director/lingo/lingo-gr.y" +#line 364 "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 83: -#line 372 "engines/director/lingo/lingo-gr.y" +#line 375 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_gotoloop); ;} break; case 84: -#line 373 "engines/director/lingo/lingo-gr.y" +#line 376 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_gotonext); ;} break; case 85: -#line 374 "engines/director/lingo/lingo-gr.y" +#line 377 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_gotoprevious); ;} break; case 86: -#line 375 "engines/director/lingo/lingo-gr.y" +#line 378 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); @@ -2156,7 +2163,7 @@ yyreduce: break; case 87: -#line 380 "engines/director/lingo/lingo-gr.y" +#line 383 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str()); @@ -2166,7 +2173,7 @@ yyreduce: break; case 88: -#line 386 "engines/director/lingo/lingo-gr.y" +#line 389 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString(""); @@ -2175,47 +2182,47 @@ yyreduce: break; case 89: -#line 393 "engines/director/lingo/lingo-gr.y" +#line 396 "engines/director/lingo/lingo-gr.y" { (yyval.s) = (yyvsp[(3) - (3)].s); ;} break; case 90: -#line 394 "engines/director/lingo/lingo-gr.y" +#line 397 "engines/director/lingo/lingo-gr.y" { (yyval.s) = (yyvsp[(2) - (2)].s); ;} break; case 91: -#line 395 "engines/director/lingo/lingo-gr.y" +#line 398 "engines/director/lingo/lingo-gr.y" { (yyval.s) = (yyvsp[(2) - (2)].s); ;} break; case 92: -#line 396 "engines/director/lingo/lingo-gr.y" +#line 399 "engines/director/lingo/lingo-gr.y" { (yyval.s) = (yyvsp[(1) - (1)].s); ;} break; case 93: -#line 399 "engines/director/lingo/lingo-gr.y" +#line 402 "engines/director/lingo/lingo-gr.y" { (yyval.s) = (yyvsp[(3) - (3)].s); ;} break; case 94: -#line 400 "engines/director/lingo/lingo-gr.y" +#line 403 "engines/director/lingo/lingo-gr.y" { (yyval.s) = (yyvsp[(2) - (2)].s); ;} break; case 95: -#line 401 "engines/director/lingo/lingo-gr.y" +#line 404 "engines/director/lingo/lingo-gr.y" { (yyval.s) = (yyvsp[(3) - (3)].s); ;} break; case 96: -#line 429 "engines/director/lingo/lingo-gr.y" +#line 432 "engines/director/lingo/lingo-gr.y" { g_lingo->_indef = true; ;} break; case 97: -#line 430 "engines/director/lingo/lingo-gr.y" +#line 433 "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); @@ -2224,32 +2231,32 @@ yyreduce: break; case 98: -#line 436 "engines/director/lingo/lingo-gr.y" +#line 439 "engines/director/lingo/lingo-gr.y" { (yyval.narg) = 0; ;} break; case 99: -#line 437 "engines/director/lingo/lingo-gr.y" +#line 440 "engines/director/lingo/lingo-gr.y" { g_lingo->codeArg((yyvsp[(1) - (1)].s)); (yyval.narg) = 1; ;} break; case 100: -#line 438 "engines/director/lingo/lingo-gr.y" +#line 441 "engines/director/lingo/lingo-gr.y" { g_lingo->codeArg((yyvsp[(3) - (3)].s)); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;} break; case 101: -#line 439 "engines/director/lingo/lingo-gr.y" +#line 442 "engines/director/lingo/lingo-gr.y" { g_lingo->codeArg((yyvsp[(4) - (4)].s)); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;} break; case 102: -#line 441 "engines/director/lingo/lingo-gr.y" +#line 444 "engines/director/lingo/lingo-gr.y" { g_lingo->codeArgStore(); ;} break; case 103: -#line 444 "engines/director/lingo/lingo-gr.y" +#line 447 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_call); g_lingo->codeString((yyvsp[(1) - (3)].s)->c_str()); @@ -2259,23 +2266,23 @@ yyreduce: break; case 104: -#line 452 "engines/director/lingo/lingo-gr.y" +#line 455 "engines/director/lingo/lingo-gr.y" { (yyval.narg) = 0; ;} break; case 105: -#line 453 "engines/director/lingo/lingo-gr.y" +#line 456 "engines/director/lingo/lingo-gr.y" { (yyval.narg) = 1; ;} break; case 106: -#line 454 "engines/director/lingo/lingo-gr.y" +#line 457 "engines/director/lingo/lingo-gr.y" { (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;} break; /* Line 1267 of yacc.c. */ -#line 2279 "engines/director/lingo/lingo-gr.cpp" +#line 2286 "engines/director/lingo/lingo-gr.cpp" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -2489,6 +2496,6 @@ yyreturn: } -#line 457 "engines/director/lingo/lingo-gr.y" +#line 460 "engines/director/lingo/lingo-gr.y" diff --git a/engines/director/lingo/lingo-gr.h b/engines/director/lingo/lingo-gr.h index 18a462a8f4..1ee739453b 100644 --- a/engines/director/lingo/lingo-gr.h +++ b/engines/director/lingo/lingo-gr.h @@ -144,7 +144,7 @@ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 66 "engines/director/lingo/lingo-gr.y" +#line 69 "engines/director/lingo/lingo-gr.y" { Common::String *s; int i; diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y index f1b5a496db..adb2075366 100644 --- a/engines/director/lingo/lingo-gr.y +++ b/engines/director/lingo/lingo-gr.y @@ -58,7 +58,10 @@ extern int yylex(); extern int yyparse(); using namespace Director; -void yyerror(char *s) { g_lingo->_hadError = true; warning("%s at line %d col %d", s, Director::g_lingo->_linenumber, Director::g_lingo->_colnumber); } +void yyerror(char *s) { + g_lingo->_hadError = true; + warning("%s at line %d col %d", s, g_lingo->_linenumber, g_lingo->_colnumber); +} %} @@ -195,7 +198,7 @@ ifstmt: if cond tTHEN nl stmtlist end tEND tIF { (*g_lingo->_currentScript)[$1 + 2] = else1; /* elsepart */ (*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */ g_lingo->processIf(0, 0); } - | if cond tTHEN nl stmtlist end begin elseifstmt end nl tEND tIF { + | if cond tTHEN nl stmtlist end begin elseifstmt end tEND tIF { inst then = 0, else1 = 0, end = 0; WRITE_UINT32(&then, $5); WRITE_UINT32(&else1, $7); diff --git a/engines/director/lingo/tests/if.lingo b/engines/director/lingo/tests/if.lingo index c9bdacac52..8f1e2391e6 100644 --- a/engines/director/lingo/tests/if.lingo +++ b/engines/director/lingo/tests/if.lingo @@ -3,7 +3,7 @@ set x = 1 if x = 5 then exit else put 10.0 -repeat with x = 1 to 5 +repeat with x = 1 to 6 if x = 3 then put 30 else if x = 4 then put 40 else if x = 5 then put 50 @@ -13,8 +13,15 @@ repeat with x = 1 to 5 else if x = 2 then put 1232.12345678901234 put 2.2 - else if x = 3 then put 3 + else if x = 3 then + put 3 + else if x = 4 then + put 4 + else if x = 5 then + put 5 + else if x = 6 then + put 6 end if - if x = 4 then put 4 - else put 5 + if x = 4 then put 40 + else put 50 end repeat |