diff options
author | Eugene Sandulenko | 2016-07-06 23:59:31 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2016-08-03 23:40:36 +0200 |
commit | 1745917752f5ec85f8a3b2b65dc1b2321aa576ab (patch) | |
tree | bc1715a3e5ac4de02a6ca75f19cc8930a23e383b /engines/director | |
parent | 2415a4cb419a2b877ca8868871fddd4cb878b7ff (diff) | |
download | scummvm-rg350-1745917752f5ec85f8a3b2b65dc1b2321aa576ab.tar.gz scummvm-rg350-1745917752f5ec85f8a3b2b65dc1b2321aa576ab.tar.bz2 scummvm-rg350-1745917752f5ec85f8a3b2b65dc1b2321aa576ab.zip |
DIRECTOR: Lingo: Further work on combined if statements
Diffstat (limited to 'engines/director')
-rw-r--r-- | engines/director/director.cpp | 3 | ||||
-rw-r--r-- | engines/director/lingo/lingo-gr.cpp | 730 | ||||
-rw-r--r-- | engines/director/lingo/lingo-gr.y | 34 |
3 files changed, 414 insertions, 353 deletions
diff --git a/engines/director/director.cpp b/engines/director/director.cpp index 539846a416..29b62e2996 100644 --- a/engines/director/director.cpp +++ b/engines/director/director.cpp @@ -109,6 +109,9 @@ Common::Error DirectorEngine::run() { _currentScore = nullptr; _lingo->addCode("--\n\ + if x = 3 then exit\n\ + else if x = 4 then put 4\n\ + else put 10.0\n\ set x = 1\n\ if x = 5 then exit\n\ else put 10.0\n\ diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp index 50370daed5..2b8e37a76a 100644 --- a/engines/director/lingo/lingo-gr.cpp +++ b/engines/director/lingo/lingo-gr.cpp @@ -432,16 +432,16 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 61 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 389 +#define YYLAST 383 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 57 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 30 +#define YYNNTS 31 /* YYNRULES -- Number of rules. */ -#define YYNRULES 92 +#define YYNRULES 95 /* YYNRULES -- Number of states. */ -#define YYNSTATES 195 +#define YYNSTATES 204 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 @@ -492,53 +492,55 @@ static const yytype_uint16 yyprhs[] = { 0, 0, 3, 7, 9, 10, 12, 14, 16, 18, 20, 22, 27, 32, 37, 39, 41, 43, 45, 54, - 66, 79, 88, 100, 112, 121, 122, 126, 129, 131, - 139, 145, 147, 151, 155, 158, 162, 164, 166, 167, - 168, 169, 172, 175, 177, 179, 184, 189, 191, 193, - 197, 201, 205, 209, 213, 217, 221, 225, 229, 232, - 235, 239, 242, 245, 248, 250, 252, 255, 257, 261, - 264, 267, 270, 273, 277, 280, 284, 287, 290, 292, - 296, 299, 303, 304, 313, 314, 316, 320, 325, 326, - 330, 331, 333 + 66, 79, 88, 100, 112, 119, 130, 141, 142, 146, + 149, 151, 158, 160, 166, 168, 172, 176, 179, 183, + 185, 187, 188, 189, 190, 193, 196, 198, 200, 205, + 210, 212, 214, 218, 222, 226, 230, 234, 238, 242, + 246, 250, 253, 256, 260, 263, 266, 269, 271, 273, + 276, 278, 282, 285, 288, 291, 294, 298, 301, 305, + 308, 311, 313, 317, 320, 324, 325, 334, 335, 337, + 341, 346, 347, 351, 352, 354 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int8 yyrhs[] = { 58, 0, -1, 58, 51, 59, -1, 59, -1, -1, - 81, -1, 76, -1, 85, -1, 60, -1, 62, -1, - 1, -1, 31, 75, 22, 10, -1, 33, 10, 45, - 75, -1, 33, 10, 35, 75, -1, 75, -1, 76, - -1, 61, -1, 63, -1, 68, 52, 67, 53, 74, - 73, 16, 32, -1, 69, 45, 75, 73, 35, 75, - 73, 74, 73, 16, 32, -1, 69, 45, 75, 73, - 13, 35, 75, 73, 74, 73, 16, 32, -1, 70, - 67, 34, 51, 74, 73, 16, 21, -1, 70, 67, - 34, 51, 74, 73, 14, 74, 73, 16, 21, -1, - 70, 67, 34, 51, 74, 73, 72, 65, 73, 16, - 21, -1, 70, 67, 34, 72, 61, 73, 64, 73, - -1, -1, 38, 72, 61, -1, 65, 66, -1, 66, - -1, 71, 67, 34, 72, 62, 73, 51, -1, 71, - 67, 34, 74, 73, -1, 75, -1, 75, 45, 75, - -1, 52, 67, 53, -1, 32, 37, -1, 32, 36, - 10, -1, 21, -1, 15, -1, -1, -1, -1, 74, - 51, -1, 74, 62, -1, 7, -1, 8, -1, 9, - 52, 86, 53, -1, 10, 52, 86, 53, -1, 10, - -1, 60, -1, 75, 46, 75, -1, 75, 47, 75, - -1, 75, 48, 75, -1, 75, 49, 75, -1, 75, - 54, 75, -1, 75, 55, 75, -1, 75, 44, 75, - -1, 75, 39, 75, -1, 75, 40, 75, -1, 46, - 75, -1, 47, 75, -1, 52, 75, 53, -1, 25, - 11, -1, 26, 10, -1, 31, 75, -1, 78, -1, - 17, -1, 19, 77, -1, 10, -1, 77, 56, 10, - -1, 20, 23, -1, 20, 28, -1, 20, 30, -1, - 20, 79, -1, 20, 79, 80, -1, 20, 80, -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, 82, 72, 83, 51, - 84, 74, -1, -1, 10, -1, 83, 56, 10, -1, - 83, 51, 56, 10, -1, -1, 10, 72, 86, -1, - -1, 75, -1, 86, 56, 75, -1 + 82, -1, 77, -1, 86, -1, 60, -1, 62, -1, + 1, -1, 31, 76, 22, 10, -1, 33, 10, 45, + 76, -1, 33, 10, 35, 76, -1, 76, -1, 77, + -1, 61, -1, 63, -1, 69, 52, 68, 53, 75, + 74, 16, 32, -1, 70, 45, 76, 74, 35, 76, + 74, 75, 74, 16, 32, -1, 70, 45, 76, 74, + 13, 35, 76, 74, 75, 74, 16, 32, -1, 71, + 68, 34, 51, 75, 74, 16, 21, -1, 71, 68, + 34, 51, 75, 74, 14, 75, 74, 16, 21, -1, + 71, 68, 34, 51, 75, 74, 73, 65, 74, 16, + 21, -1, 71, 68, 34, 73, 61, 74, -1, 71, + 68, 34, 73, 61, 74, 38, 73, 61, 74, -1, + 71, 68, 34, 73, 61, 74, 66, 74, 64, 74, + -1, -1, 38, 73, 61, -1, 65, 67, -1, 67, + -1, 72, 68, 34, 73, 62, 74, -1, 66, -1, + 72, 68, 34, 75, 74, -1, 76, -1, 76, 45, + 76, -1, 52, 68, 53, -1, 32, 37, -1, 32, + 36, 10, -1, 21, -1, 15, -1, -1, -1, -1, + 75, 51, -1, 75, 62, -1, 7, -1, 8, -1, + 9, 52, 87, 53, -1, 10, 52, 87, 53, -1, + 10, -1, 60, -1, 76, 46, 76, -1, 76, 47, + 76, -1, 76, 48, 76, -1, 76, 49, 76, -1, + 76, 54, 76, -1, 76, 55, 76, -1, 76, 44, + 76, -1, 76, 39, 76, -1, 76, 40, 76, -1, + 46, 76, -1, 47, 76, -1, 52, 76, 53, -1, + 25, 11, -1, 26, 10, -1, 31, 76, -1, 79, + -1, 17, -1, 19, 78, -1, 10, -1, 78, 56, + 10, -1, 20, 23, -1, 20, 28, -1, 20, 30, + -1, 20, 80, -1, 20, 80, 81, -1, 20, 81, + -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, 83, 73, 84, + 51, 85, 75, -1, -1, 10, -1, 84, 56, 10, + -1, 84, 51, 56, 10, -1, -1, 10, 73, 87, + -1, -1, 76, -1, 87, 56, 76, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ @@ -546,14 +548,14 @@ static const yytype_uint16 yyrline[] = { 0, 93, 93, 94, 97, 98, 99, 100, 101, 102, 103, 106, 112, 118, 125, 126, 128, 129, 134, 145, - 161, 175, 182, 191, 200, 211, 212, 215, 216, 219, - 225, 233, 234, 235, 237, 239, 245, 251, 258, 260, - 262, 263, 264, 267, 272, 275, 281, 289, 292, 293, - 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, - 304, 307, 308, 309, 310, 311, 313, 316, 317, 328, - 329, 330, 331, 336, 342, 349, 350, 351, 352, 355, - 356, 357, 385, 385, 392, 393, 394, 395, 397, 400, - 408, 409, 410 + 161, 175, 182, 191, 200, 210, 220, 231, 232, 235, + 236, 239, 246, 247, 255, 256, 257, 259, 261, 267, + 273, 280, 282, 284, 285, 286, 289, 294, 297, 303, + 311, 314, 315, 316, 317, 318, 319, 320, 321, 322, + 323, 324, 325, 326, 329, 330, 331, 332, 333, 335, + 338, 339, 350, 351, 352, 353, 358, 364, 371, 372, + 373, 374, 377, 378, 379, 407, 407, 414, 415, 416, + 417, 419, 422, 430, 431, 432 }; #endif @@ -570,10 +572,11 @@ static const char *const yytname[] = "tWHILE", "tNLELSE", "tGE", "tLE", "tGT", "tLT", "tEQ", "tNEQ", "'='", "'+'", "'-'", "'*'", "'/'", "'%'", "'\\n'", "'('", "')'", "'>'", "'<'", "','", "$accept", "program", "programline", "asgn", "stmtoneliner", - "stmt", "ifstmt", "elsestmt", "elseifstmt", "elseifstmt1", "cond", - "repeatwhile", "repeatwith", "if", "elseif", "begin", "end", "stmtlist", - "expr", "func", "globallist", "gotofunc", "gotoframe", "gotomovie", - "defn", "@1", "argdef", "argstore", "macro", "arglist", 0 + "stmt", "ifstmt", "elsestmtoneliner", "elseifstmt", "elseifstmtoneliner", + "elseifstmt1", "cond", "repeatwhile", "repeatwith", "if", "elseif", + "begin", "end", "stmtlist", "expr", "func", "globallist", "gotofunc", + "gotoframe", "gotomovie", "defn", "@1", "argdef", "argstore", "macro", + "arglist", 0 }; #endif @@ -596,14 +599,14 @@ static const yytype_uint8 yyr1[] = { 0, 57, 58, 58, 59, 59, 59, 59, 59, 59, 59, 60, 60, 60, 61, 61, 62, 62, 62, 62, - 62, 63, 63, 63, 63, 64, 64, 65, 65, 66, - 66, 67, 67, 67, 68, 69, 70, 71, 72, 73, - 74, 74, 74, 75, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, - 75, 76, 76, 76, 76, 76, 76, 77, 77, 78, - 78, 78, 78, 78, 78, 79, 79, 79, 79, 80, - 80, 80, 82, 81, 83, 83, 83, 83, 84, 85, - 86, 86, 86 + 62, 63, 63, 63, 63, 63, 63, 64, 64, 65, + 65, 66, 67, 67, 68, 68, 68, 69, 70, 71, + 72, 73, 74, 75, 75, 75, 76, 76, 76, 76, + 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 76, 77, 77, 77, 77, 77, 77, + 78, 78, 79, 79, 79, 79, 79, 79, 80, 80, + 80, 80, 81, 81, 81, 83, 82, 84, 84, 84, + 84, 85, 86, 87, 87, 87 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -611,14 +614,14 @@ static const yytype_uint8 yyr2[] = { 0, 2, 3, 1, 0, 1, 1, 1, 1, 1, 1, 4, 4, 4, 1, 1, 1, 1, 8, 11, - 12, 8, 11, 11, 8, 0, 3, 2, 1, 7, - 5, 1, 3, 3, 2, 3, 1, 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 + 12, 8, 11, 11, 6, 10, 10, 0, 3, 2, + 1, 6, 1, 5, 1, 3, 3, 2, 3, 1, + 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 @@ -626,160 +629,164 @@ static const yytype_uint8 yyr2[] = means the default is an error. */ static const yytype_uint8 yydefact[] = { - 0, 10, 43, 44, 0, 38, 65, 0, 0, 36, + 0, 10, 46, 47, 0, 41, 68, 0, 0, 39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 3, 48, 16, 9, 17, 0, 0, 0, 14, 6, - 64, 5, 7, 90, 90, 90, 67, 66, 78, 0, - 69, 0, 70, 0, 71, 0, 72, 74, 82, 61, - 62, 47, 0, 48, 63, 0, 34, 0, 58, 59, - 0, 1, 0, 0, 0, 0, 0, 31, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 91, 0, 0, - 89, 0, 76, 80, 0, 77, 0, 0, 0, 73, - 38, 0, 0, 35, 0, 0, 60, 2, 0, 39, - 0, 0, 38, 0, 56, 57, 55, 49, 50, 51, - 52, 53, 54, 45, 0, 46, 68, 79, 75, 81, - 84, 11, 13, 12, 40, 0, 33, 40, 0, 32, - 92, 85, 0, 39, 0, 0, 39, 39, 15, 88, - 0, 41, 42, 0, 0, 39, 38, 25, 0, 40, - 86, 0, 39, 40, 40, 0, 0, 38, 39, 87, - 83, 18, 40, 39, 39, 21, 37, 39, 28, 0, - 0, 24, 39, 0, 0, 27, 0, 0, 26, 0, - 0, 0, 0, 38, 0, 19, 22, 23, 0, 39, - 20, 39, 30, 0, 29 + 3, 51, 16, 9, 17, 0, 0, 0, 14, 6, + 67, 5, 7, 93, 93, 93, 70, 69, 81, 0, + 72, 0, 73, 0, 74, 0, 75, 77, 85, 64, + 65, 50, 0, 51, 66, 0, 37, 0, 61, 62, + 0, 1, 0, 0, 0, 0, 0, 34, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 94, 0, 0, + 92, 0, 79, 83, 0, 80, 0, 0, 0, 76, + 41, 0, 0, 38, 0, 0, 63, 2, 0, 42, + 0, 0, 41, 0, 59, 60, 58, 52, 53, 54, + 55, 56, 57, 48, 0, 49, 71, 82, 78, 84, + 87, 11, 13, 12, 43, 0, 36, 43, 0, 35, + 95, 88, 0, 42, 0, 0, 42, 42, 15, 91, + 0, 44, 45, 0, 0, 42, 41, 24, 0, 43, + 89, 0, 42, 43, 43, 0, 0, 40, 41, 42, + 0, 90, 86, 18, 43, 42, 42, 21, 42, 32, + 30, 0, 0, 27, 0, 42, 0, 0, 29, 0, + 0, 42, 41, 42, 41, 0, 0, 0, 0, 41, + 25, 0, 26, 0, 0, 19, 22, 23, 42, 28, + 42, 20, 33, 31 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { - -1, 19, 20, 53, 22, 142, 24, 158, 167, 168, - 66, 25, 26, 27, 169, 35, 125, 133, 28, 138, - 37, 30, 46, 47, 31, 90, 132, 149, 32, 78 + -1, 19, 20, 53, 22, 142, 24, 183, 168, 169, + 170, 66, 25, 26, 27, 171, 193, 125, 133, 28, + 138, 37, 30, 46, 47, 31, 90, 132, 149, 32, + 78 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -123 +#define YYPACT_NINF -124 static const yytype_int16 yypact[] = { - 124, -123, -123, -123, -45, 317, -123, 24, 277, -123, - 39, 43, 51, 152, 9, 64, 152, 152, 152, 2, - -123, 4, -123, -123, -123, 26, 12, 198, 305, -123, - -123, -123, -123, 152, 152, 152, -123, 29, -123, 76, - -123, 77, -123, 66, -123, -2, -3, -123, -123, -123, - -123, 42, 152, -123, 237, 81, -123, -12, -4, -4, - 281, -123, 124, 198, 152, 198, 61, 293, 152, 152, - 152, 152, 152, 152, 152, 152, 152, 305, -38, -15, - 40, 87, -123, -123, 89, -123, 90, 91, 79, -123, - -123, 237, 93, -123, 152, 152, -123, -123, 55, 305, - 60, 269, 53, 152, 305, 305, 305, 334, 334, -4, - -4, 305, 305, -123, 152, -123, -123, -123, -123, -123, - 105, -123, 305, 305, -123, -8, -123, -123, 247, 305, - 305, -123, -14, 170, 82, 152, 170, -123, -123, 62, - 106, -123, -123, 104, 152, 305, 63, 83, 112, -123, - -123, 94, 305, -123, -123, 102, 113, -123, -123, -123, - 170, -123, -123, 170, 170, -123, -123, 113, -123, 198, - 247, -123, 170, 111, 119, -123, 121, 95, -123, 126, - 108, 125, 130, 5, 115, -123, -123, -123, 216, 170, - -123, -123, -123, 101, -123 + 143, -124, -124, -124, -39, 328, -124, 35, 287, -124, + 40, 15, 41, 172, -25, 46, 172, 172, 172, 3, + -124, 7, -124, -124, -124, 8, 18, 218, 316, -124, + -124, -124, -124, 172, 172, 172, -124, 31, -124, 77, + -124, 78, -124, 63, -124, 13, 32, -124, -124, -124, + -124, 39, 172, -124, 86, 82, -124, -20, -17, -17, + 292, -124, 143, 218, 172, 218, 60, 304, 172, 172, + 172, 172, 172, 172, 172, 172, 172, 316, -23, -1, + 47, 87, -124, -124, 90, -124, 91, 94, 79, -124, + -124, 86, 99, -124, 172, 172, -124, -124, 58, 316, + 59, 280, 66, 172, 316, 316, 316, 240, 240, -17, + -17, 316, 316, -124, 172, -124, -124, -124, -124, -124, + 108, -124, 316, 316, -124, -3, -124, -124, 266, 316, + 316, -124, -8, 189, 84, 172, 189, -124, -124, 64, + 111, -124, -124, 106, 172, 316, 25, -9, 114, -124, + -124, 95, 316, -124, -124, 107, 122, -124, -124, -124, + 218, -124, 189, -124, -124, 189, 189, -124, 122, -124, + -124, 218, 266, 100, 105, 189, 131, 133, -124, 139, + 123, -124, -124, -124, -124, 140, 126, 138, 144, -7, + -124, 266, -124, 235, 134, -124, -124, -124, 189, -124, + -124, -124, -124, -124 }; /* YYPGOTO[NTERM-NUM]. */ -static const yytype_int8 yypgoto[] = +static const yytype_int16 yypgoto[] = { - -123, -123, 92, 10, -122, 0, -123, -123, -123, -9, - -62, -123, -123, -123, -123, -71, -53, -110, -5, 14, - -123, -123, -123, 107, -123, -123, -123, -123, -123, 47 + -124, -124, 109, 16, -123, 0, -124, -124, -124, 23, + 5, -61, -124, -124, -124, 30, -4, -52, -107, 1, + 21, -124, -124, -124, 137, -124, -124, -124, -124, -124, + 45 }; /* 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 -48 +#define YYTABLE_NINF -51 static const yytype_int16 yytable[] = { - 23, 98, 61, 100, -8, 134, 137, 33, 54, 85, - 21, 58, 59, 60, 29, 113, 86, 136, 114, 120, - -40, -40, 67, 94, 41, 87, 43, 135, 77, 77, - 77, 128, 88, 95, 36, 68, 69, 139, 115, 160, - 70, 114, 140, 163, 164, 55, 56, 91, 178, 48, - 75, 76, 172, 62, 49, -8, -40, 64, 67, 99, - 101, 50, 23, 104, 105, 106, 107, 108, 109, 110, - 111, 112, 21, 189, 57, 156, 29, 154, 63, 155, - 143, 79, 80, 146, 147, 81, 170, 82, 83, 122, - 123, 93, 153, 84, 34, 102, 114, 116, 129, 162, - 117, 118, 119, 121, 127, 171, 87, 177, 124, 130, - 173, 174, 188, 126, 176, 131, 150, 144, 148, 179, - 151, 157, 159, 165, -4, 1, 161, 180, 166, 183, - 145, 2, 3, 4, 5, 181, 192, 182, 193, 152, - 185, 6, 184, 7, 8, 9, 186, 190, 10, 11, - 12, 187, 194, 89, 97, 13, 14, 15, 175, 2, - 3, 4, 51, 0, 67, 0, 0, 0, 0, 0, - 16, 17, 0, 0, 0, -4, 18, 2, 3, 4, - 51, 0, 0, 52, 0, 15, 0, 6, 191, 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, 0, 16, 17, 0, 0, - 0, 141, 18, 2, 3, 4, 51, 0, 0, 52, - 0, 15, 0, 6, 0, 7, 8, 9, 0, 0, - 0, 11, 12, 0, 16, 17, 0, 13, 14, 15, - 65, 0, 0, 0, 2, 3, 4, 51, 0, 92, - 0, 0, 16, 17, 6, 0, 7, 8, 18, 0, - 0, 0, 11, 12, 0, 0, 68, 69, 13, 0, - 15, 70, 0, 71, 72, 73, 74, 0, 38, 0, - 0, 75, 76, 16, 17, 39, 0, 0, 0, 18, - 40, 0, 0, 0, 41, 42, 43, 44, 68, 69, - 0, 0, 45, 70, 103, 71, 72, 73, 74, 0, - 68, 69, 96, 75, 76, 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, -47, -47, 0, 75, - 76, -47, 0, 0, 0, -47, -47, 0, 0, 34, - 0, -47, -47, 68, 69, 0, 0, 0, 70, 0, - 0, 0, 73, 74, 0, 0, 0, 0, 75, 76 + 23, 35, 98, 61, 100, 137, 157, -8, -43, -43, + 134, 55, 56, 33, 54, 94, 21, 58, 59, 60, + 136, 29, 68, 69, 85, 95, 49, 70, 67, 158, + 113, 86, 135, 114, 77, 77, 77, 75, 76, 154, + 87, 155, 162, 139, -43, 36, 165, 166, 140, 181, + 48, 50, 115, 91, 62, 114, 57, 175, -8, 41, + 63, 43, 23, 64, 67, 99, 101, 88, 199, 104, + 105, 106, 107, 108, 109, 110, 111, 112, 21, 79, + 80, 143, 198, 29, 146, 147, 120, 81, 82, 83, + 84, 34, 93, 153, 102, 122, 123, 116, 128, 174, + 164, 117, 118, 114, 129, 119, 87, 173, 92, 121, + 180, 124, 126, 176, 177, 130, 179, 127, 131, 144, + 148, 150, 151, 185, 161, 68, 69, 163, 167, 190, + 70, 192, 71, 72, 73, 74, 145, 157, 182, 184, + 75, 76, 156, -4, 1, 152, 202, 186, 203, 187, + 2, 3, 4, 5, 172, 188, 194, 189, 195, 196, + 6, 67, 7, 8, 9, 197, 201, 10, 11, 12, + 159, 97, 67, 178, 13, 14, 15, 160, 191, 2, + 3, 4, 51, 89, 0, 0, 0, 0, 0, 16, + 17, 0, 0, 200, -4, 18, 2, 3, 4, 51, + 0, 0, 0, 52, 0, 15, 6, 0, 7, 8, + 9, 0, 0, 0, 11, 12, 0, 0, 16, 17, + 13, 14, 15, 0, 18, 2, 3, 4, 51, 0, + 0, 0, 0, 0, 0, 16, 17, 0, 0, 0, + 141, 18, 2, 3, 4, 51, 0, 0, 0, 52, + 0, 15, 6, 0, 7, 8, 9, 0, 0, 0, + 11, 12, 0, 0, 16, 17, 13, 14, 15, 0, + 65, 0, 0, 2, 3, 4, 51, 0, 0, 68, + 69, 16, 17, 6, 70, 7, 8, 18, 73, 74, + 0, 11, 12, 0, 75, 76, 0, 13, 38, 15, + 0, 0, 0, 0, 0, 39, 0, 0, 0, 0, + 40, 0, 16, 17, 41, 42, 43, 44, 18, 68, + 69, 0, 45, 0, 70, 103, 71, 72, 73, 74, + 0, 68, 69, 96, 75, 76, 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, -50, -50, 0, + 75, 76, -50, 0, 0, 0, -50, -50, 0, 0, + 34, 0, -50, -50 }; static const yytype_int16 yycheck[] = { - 0, 63, 0, 65, 0, 13, 128, 52, 13, 11, - 0, 16, 17, 18, 0, 53, 18, 127, 56, 90, - 15, 16, 27, 35, 27, 27, 29, 35, 33, 34, - 35, 102, 35, 45, 10, 39, 40, 51, 53, 149, - 44, 56, 56, 153, 154, 36, 37, 52, 170, 10, - 54, 55, 162, 51, 11, 51, 51, 45, 63, 64, - 65, 10, 62, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 62, 183, 10, 146, 62, 14, 52, 16, - 133, 34, 35, 136, 137, 56, 157, 11, 11, 94, - 95, 10, 145, 27, 52, 34, 56, 10, 103, 152, - 11, 11, 11, 10, 51, 158, 27, 169, 53, 114, - 163, 164, 183, 53, 167, 10, 10, 35, 56, 172, - 16, 38, 10, 21, 0, 1, 32, 16, 15, 34, - 135, 7, 8, 9, 10, 16, 189, 16, 191, 144, - 32, 17, 16, 19, 20, 21, 21, 32, 24, 25, - 26, 21, 51, 46, 62, 31, 32, 33, 167, 7, - 8, 9, 10, -1, 169, -1, -1, -1, -1, -1, - 46, 47, -1, -1, -1, 51, 52, 7, 8, 9, - 10, -1, -1, 31, -1, 33, -1, 17, 188, 19, - 20, 21, -1, -1, -1, 25, 26, -1, 46, 47, - -1, 31, 32, 33, 52, 7, 8, 9, 10, -1, - -1, -1, -1, -1, -1, -1, 46, 47, -1, -1, - -1, 51, 52, 7, 8, 9, 10, -1, -1, 31, - -1, 33, -1, 17, -1, 19, 20, 21, -1, -1, - -1, 25, 26, -1, 46, 47, -1, 31, 32, 33, - 52, -1, -1, -1, 7, 8, 9, 10, -1, 22, - -1, -1, 46, 47, 17, -1, 19, 20, 52, -1, - -1, -1, 25, 26, -1, -1, 39, 40, 31, -1, - 33, 44, -1, 46, 47, 48, 49, -1, 11, -1, - -1, 54, 55, 46, 47, 18, -1, -1, -1, 52, - 23, -1, -1, -1, 27, 28, 29, 30, 39, 40, - -1, -1, 35, 44, 45, 46, 47, 48, 49, -1, - 39, 40, 53, 54, 55, 44, -1, 46, 47, 48, - 49, -1, 39, 40, 53, 54, 55, 44, 45, 46, - 47, 48, 49, -1, 39, 40, -1, 54, 55, 44, - -1, 46, 47, 48, 49, -1, 39, 40, -1, 54, - 55, 44, -1, -1, -1, 48, 49, -1, -1, 52, - -1, 54, 55, 39, 40, -1, -1, -1, 44, -1, - -1, -1, 48, 49, -1, -1, -1, -1, 54, 55 + 0, 5, 63, 0, 65, 128, 15, 0, 15, 16, + 13, 36, 37, 52, 13, 35, 0, 16, 17, 18, + 127, 0, 39, 40, 11, 45, 11, 44, 27, 38, + 53, 18, 35, 56, 33, 34, 35, 54, 55, 14, + 27, 16, 149, 51, 51, 10, 153, 154, 56, 172, + 10, 10, 53, 52, 51, 56, 10, 164, 51, 27, + 52, 29, 62, 45, 63, 64, 65, 35, 191, 68, + 69, 70, 71, 72, 73, 74, 75, 76, 62, 34, + 35, 133, 189, 62, 136, 137, 90, 56, 11, 11, + 27, 52, 10, 145, 34, 94, 95, 10, 102, 160, + 152, 11, 11, 56, 103, 11, 27, 159, 22, 10, + 171, 53, 53, 165, 166, 114, 168, 51, 10, 35, + 56, 10, 16, 175, 10, 39, 40, 32, 21, 181, + 44, 183, 46, 47, 48, 49, 135, 15, 38, 34, + 54, 55, 146, 0, 1, 144, 198, 16, 200, 16, + 7, 8, 9, 10, 158, 16, 16, 34, 32, 21, + 17, 160, 19, 20, 21, 21, 32, 24, 25, 26, + 147, 62, 171, 168, 31, 32, 33, 147, 182, 7, + 8, 9, 10, 46, -1, -1, -1, -1, -1, 46, + 47, -1, -1, 193, 51, 52, 7, 8, 9, 10, + -1, -1, -1, 31, -1, 33, 17, -1, 19, 20, + 21, -1, -1, -1, 25, 26, -1, -1, 46, 47, + 31, 32, 33, -1, 52, 7, 8, 9, 10, -1, + -1, -1, -1, -1, -1, 46, 47, -1, -1, -1, + 51, 52, 7, 8, 9, 10, -1, -1, -1, 31, + -1, 33, 17, -1, 19, 20, 21, -1, -1, -1, + 25, 26, -1, -1, 46, 47, 31, 32, 33, -1, + 52, -1, -1, 7, 8, 9, 10, -1, -1, 39, + 40, 46, 47, 17, 44, 19, 20, 52, 48, 49, + -1, 25, 26, -1, 54, 55, -1, 31, 11, 33, + -1, -1, -1, -1, -1, 18, -1, -1, -1, -1, + 23, -1, 46, 47, 27, 28, 29, 30, 52, 39, + 40, -1, 35, -1, 44, 45, 46, 47, 48, 49, + -1, 39, 40, 53, 54, 55, 44, -1, 46, 47, + 48, 49, -1, 39, 40, 53, 54, 55, 44, 45, + 46, 47, 48, 49, -1, 39, 40, -1, 54, 55, + 44, -1, 46, 47, 48, 49, -1, 39, 40, -1, + 54, 55, 44, -1, -1, -1, 48, 49, -1, -1, + 52, -1, 54, 55 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing @@ -788,24 +795,25 @@ static const yytype_uint8 yystos[] = { 0, 1, 7, 8, 9, 10, 17, 19, 20, 21, 24, 25, 26, 31, 32, 33, 46, 47, 52, 58, - 59, 60, 61, 62, 63, 68, 69, 70, 75, 76, - 78, 81, 85, 52, 52, 72, 10, 77, 11, 18, - 23, 27, 28, 29, 30, 35, 79, 80, 10, 11, - 10, 10, 31, 60, 75, 36, 37, 10, 75, 75, - 75, 0, 51, 52, 45, 52, 67, 75, 39, 40, - 44, 46, 47, 48, 49, 54, 55, 75, 86, 86, - 86, 56, 11, 11, 27, 11, 18, 27, 35, 80, - 82, 75, 22, 10, 35, 45, 53, 59, 67, 75, - 67, 75, 34, 45, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 53, 56, 53, 10, 11, 11, 11, - 72, 10, 75, 75, 53, 73, 53, 51, 72, 75, - 75, 10, 83, 74, 13, 35, 74, 61, 76, 51, - 56, 51, 62, 73, 35, 75, 73, 73, 56, 84, - 10, 16, 75, 73, 14, 16, 72, 38, 64, 10, - 74, 32, 73, 74, 74, 21, 15, 65, 66, 71, - 72, 73, 74, 73, 73, 66, 73, 67, 61, 73, - 16, 16, 16, 34, 16, 32, 21, 21, 72, 74, - 32, 62, 73, 73, 51 + 59, 60, 61, 62, 63, 69, 70, 71, 76, 77, + 79, 82, 86, 52, 52, 73, 10, 78, 11, 18, + 23, 27, 28, 29, 30, 35, 80, 81, 10, 11, + 10, 10, 31, 60, 76, 36, 37, 10, 76, 76, + 76, 0, 51, 52, 45, 52, 68, 76, 39, 40, + 44, 46, 47, 48, 49, 54, 55, 76, 87, 87, + 87, 56, 11, 11, 27, 11, 18, 27, 35, 81, + 83, 76, 22, 10, 35, 45, 53, 59, 68, 76, + 68, 76, 34, 45, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 53, 56, 53, 10, 11, 11, 11, + 73, 10, 76, 76, 53, 74, 53, 51, 73, 76, + 76, 10, 84, 75, 13, 35, 75, 61, 77, 51, + 56, 51, 62, 74, 35, 76, 74, 74, 56, 85, + 10, 16, 76, 74, 14, 16, 73, 15, 38, 66, + 72, 10, 75, 32, 74, 75, 75, 21, 65, 66, + 67, 72, 73, 74, 68, 75, 74, 74, 67, 74, + 68, 61, 38, 64, 34, 74, 16, 16, 16, 34, + 74, 73, 74, 73, 16, 32, 21, 21, 75, 61, + 62, 32, 74, 74 }; #define yyerrok (yyerrstatus = 0) @@ -1747,38 +1755,66 @@ yyreduce: #line 200 "engines/director/lingo/lingo-gr.y" { inst then = 0, else1 = 0, end = 0; - WRITE_UINT32(&then, (yyvsp[(4) - (8)].code)); - WRITE_UINT32(&else1, (yyvsp[(7) - (8)].code)); - WRITE_UINT32(&end, (yyvsp[(8) - (8)].code)); - (*g_lingo->_currentScript)[(yyvsp[(1) - (8)].code) + 1] = then; /* thenpart */ - (*g_lingo->_currentScript)[(yyvsp[(1) - (8)].code) + 2] = else1; /* elsepart */ - (*g_lingo->_currentScript)[(yyvsp[(1) - (8)].code) + 3] = end; /* end, if cond fails */ + WRITE_UINT32(&then, (yyvsp[(4) - (6)].code)); + WRITE_UINT32(&else1, 0); + WRITE_UINT32(&end, (yyvsp[(6) - (6)].code)); + (*g_lingo->_currentScript)[(yyvsp[(1) - (6)].code) + 1] = then; /* thenpart */ + (*g_lingo->_currentScript)[(yyvsp[(1) - (6)].code) + 2] = else1; /* elsepart */ + (*g_lingo->_currentScript)[(yyvsp[(1) - (6)].code) + 3] = end; /* end, if cond fails */ g_lingo->processIf(0, 0); ;} break; case 25: -#line 211 "engines/director/lingo/lingo-gr.y" - { (yyval.code) = 0; ;} +#line 210 "engines/director/lingo/lingo-gr.y" + { + inst then = 0, else1 = 0, end = 0; + WRITE_UINT32(&then, (yyvsp[(4) - (10)].code)); + WRITE_UINT32(&else1, (yyvsp[(8) - (10)].code)); + WRITE_UINT32(&end, (yyvsp[(10) - (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; /* end, if cond fails */ + + g_lingo->processIf(0, 0); ;} break; case 26: -#line 212 "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)); + WRITE_UINT32(&else1, (yyvsp[(6) - (10)].code)); + WRITE_UINT32(&end, (yyvsp[(10) - (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; /* end, if cond fails */ + + g_lingo->processIf(0, (yyvsp[(10) - (10)].code)); ;} + break; + + case 27: +#line 231 "engines/director/lingo/lingo-gr.y" + { (yyval.code) = 0; ;} + break; + + case 28: +#line 232 "engines/director/lingo/lingo-gr.y" { (yyval.code) = (yyvsp[(2) - (3)].code); ;} break; - case 29: -#line 219 "engines/director/lingo/lingo-gr.y" + case 31: +#line 239 "engines/director/lingo/lingo-gr.y" { inst then = 0; - WRITE_UINT32(&then, (yyvsp[(4) - (7)].code)); - (*g_lingo->_currentScript)[(yyvsp[(1) - (7)].code) + 1] = then; /* thenpart */ + WRITE_UINT32(&then, (yyvsp[(4) - (6)].code)); + (*g_lingo->_currentScript)[(yyvsp[(1) - (6)].code) + 1] = then; /* thenpart */ - g_lingo->codeLabel((yyvsp[(1) - (7)].code)); ;} + g_lingo->codeLabel((yyvsp[(1) - (6)].code)); ;} break; - case 30: -#line 225 "engines/director/lingo/lingo-gr.y" + case 33: +#line 247 "engines/director/lingo/lingo-gr.y" { inst then = 0; WRITE_UINT32(&then, (yyvsp[(4) - (5)].code)); @@ -1787,23 +1823,23 @@ yyreduce: g_lingo->codeLabel((yyvsp[(1) - (5)].code)); ;} break; - case 31: -#line 233 "engines/director/lingo/lingo-gr.y" + case 34: +#line 255 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(STOP); ;} break; - case 32: -#line 234 "engines/director/lingo/lingo-gr.y" + case 35: +#line 256 "engines/director/lingo/lingo-gr.y" { g_lingo->code2(g_lingo->c_eq, STOP); ;} break; - case 34: -#line 237 "engines/director/lingo/lingo-gr.y" + case 37: +#line 259 "engines/director/lingo/lingo-gr.y" { (yyval.code) = g_lingo->code3(g_lingo->c_repeatwhilecode, STOP, STOP); ;} break; - case 35: -#line 239 "engines/director/lingo/lingo-gr.y" + case 38: +#line 261 "engines/director/lingo/lingo-gr.y" { (yyval.code) = g_lingo->code3(g_lingo->c_repeatwithcode, STOP, STOP); g_lingo->code3(STOP, STOP, STOP); @@ -1811,8 +1847,8 @@ yyreduce: delete (yyvsp[(3) - (3)].s); ;} break; - case 36: -#line 245 "engines/director/lingo/lingo-gr.y" + case 39: +#line 267 "engines/director/lingo/lingo-gr.y" { (yyval.code) = g_lingo->code1(g_lingo->c_ifcode); g_lingo->code3(STOP, STOP, STOP); @@ -1820,8 +1856,8 @@ yyreduce: g_lingo->codeLabel(0); ;} break; - case 37: -#line 251 "engines/director/lingo/lingo-gr.y" + case 40: +#line 273 "engines/director/lingo/lingo-gr.y" { inst skipEnd; WRITE_UINT32(&skipEnd, 1); // We have to skip end to avoid multiple executions @@ -1830,23 +1866,23 @@ yyreduce: g_lingo->code1(skipEnd); ;} break; - case 38: -#line 258 "engines/director/lingo/lingo-gr.y" + case 41: +#line 280 "engines/director/lingo/lingo-gr.y" { (yyval.code) = g_lingo->_currentScript->size(); ;} break; - case 39: -#line 260 "engines/director/lingo/lingo-gr.y" + case 42: +#line 282 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(STOP); (yyval.code) = g_lingo->_currentScript->size(); ;} break; - case 40: -#line 262 "engines/director/lingo/lingo-gr.y" + case 43: +#line 284 "engines/director/lingo/lingo-gr.y" { (yyval.code) = g_lingo->_currentScript->size(); ;} break; - case 43: -#line 267 "engines/director/lingo/lingo-gr.y" + case 46: +#line 289 "engines/director/lingo/lingo-gr.y" { (yyval.code) = g_lingo->code1(g_lingo->c_constpush); inst i = 0; @@ -1854,15 +1890,15 @@ yyreduce: g_lingo->code1(i); ;} break; - case 44: -#line 272 "engines/director/lingo/lingo-gr.y" + case 47: +#line 294 "engines/director/lingo/lingo-gr.y" { (yyval.code) = g_lingo->code1(g_lingo->c_fconstpush); g_lingo->codeFloat((yyvsp[(1) - (1)].f)); ;} break; - case 45: -#line 275 "engines/director/lingo/lingo-gr.y" + case 48: +#line 297 "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)); @@ -1871,8 +1907,8 @@ yyreduce: delete (yyvsp[(1) - (4)].s); ;} break; - case 46: -#line 281 "engines/director/lingo/lingo-gr.y" + case 49: +#line 303 "engines/director/lingo/lingo-gr.y" { (yyval.code) = g_lingo->code1(g_lingo->c_call); g_lingo->codeString((yyvsp[(1) - (4)].s)->c_str()); @@ -1883,121 +1919,121 @@ yyreduce: delete (yyvsp[(1) - (4)].s); ;} break; - case 47: -#line 289 "engines/director/lingo/lingo-gr.y" + case 50: +#line 311 "engines/director/lingo/lingo-gr.y" { (yyval.code) = g_lingo->codeId(*(yyvsp[(1) - (1)].s)); delete (yyvsp[(1) - (1)].s); ;} break; - case 49: -#line 293 "engines/director/lingo/lingo-gr.y" + case 52: +#line 315 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_add); ;} break; - case 50: -#line 294 "engines/director/lingo/lingo-gr.y" + case 53: +#line 316 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_sub); ;} break; - case 51: -#line 295 "engines/director/lingo/lingo-gr.y" + case 54: +#line 317 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_mul); ;} break; - case 52: -#line 296 "engines/director/lingo/lingo-gr.y" + case 55: +#line 318 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_div); ;} break; - case 53: -#line 297 "engines/director/lingo/lingo-gr.y" + case 56: +#line 319 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_gt); ;} break; - case 54: -#line 298 "engines/director/lingo/lingo-gr.y" + case 57: +#line 320 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_lt); ;} break; - case 55: -#line 299 "engines/director/lingo/lingo-gr.y" + case 58: +#line 321 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_neq); ;} break; - case 56: -#line 300 "engines/director/lingo/lingo-gr.y" + case 59: +#line 322 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_ge); ;} break; - case 57: -#line 301 "engines/director/lingo/lingo-gr.y" + case 60: +#line 323 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_le); ;} break; - case 58: -#line 302 "engines/director/lingo/lingo-gr.y" + case 61: +#line 324 "engines/director/lingo/lingo-gr.y" { (yyval.code) = (yyvsp[(2) - (2)].code); ;} break; - case 59: -#line 303 "engines/director/lingo/lingo-gr.y" + case 62: +#line 325 "engines/director/lingo/lingo-gr.y" { (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;} break; - case 60: -#line 304 "engines/director/lingo/lingo-gr.y" + case 63: +#line 326 "engines/director/lingo/lingo-gr.y" { (yyval.code) = (yyvsp[(2) - (3)].code); ;} break; - case 61: -#line 307 "engines/director/lingo/lingo-gr.y" + case 64: +#line 329 "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 62: -#line 308 "engines/director/lingo/lingo-gr.y" + case 65: +#line 330 "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 63: -#line 309 "engines/director/lingo/lingo-gr.y" + case 66: +#line 331 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_printtop); ;} break; - case 65: -#line 311 "engines/director/lingo/lingo-gr.y" + case 68: +#line 333 "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 67: -#line 316 "engines/director/lingo/lingo-gr.y" + case 70: +#line 338 "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 68: -#line 317 "engines/director/lingo/lingo-gr.y" + case 71: +#line 339 "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 69: -#line 328 "engines/director/lingo/lingo-gr.y" + case 72: +#line 350 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_gotoloop); ;} break; - case 70: -#line 329 "engines/director/lingo/lingo-gr.y" + case 73: +#line 351 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_gotonext); ;} break; - case 71: -#line 330 "engines/director/lingo/lingo-gr.y" + case 74: +#line 352 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_gotoprevious); ;} break; - case 72: -#line 331 "engines/director/lingo/lingo-gr.y" + case 75: +#line 353 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); @@ -2005,8 +2041,8 @@ yyreduce: delete (yyvsp[(2) - (2)].s); ;} break; - case 73: -#line 336 "engines/director/lingo/lingo-gr.y" + case 76: +#line 358 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str()); @@ -2015,8 +2051,8 @@ yyreduce: delete (yyvsp[(3) - (3)].s); ;} break; - case 74: -#line 342 "engines/director/lingo/lingo-gr.y" + case 77: +#line 364 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString(""); @@ -2024,48 +2060,48 @@ yyreduce: delete (yyvsp[(2) - (2)].s); ;} break; - case 75: -#line 349 "engines/director/lingo/lingo-gr.y" + case 78: +#line 371 "engines/director/lingo/lingo-gr.y" { (yyval.s) = (yyvsp[(3) - (3)].s); ;} break; - case 76: -#line 350 "engines/director/lingo/lingo-gr.y" + case 79: +#line 372 "engines/director/lingo/lingo-gr.y" { (yyval.s) = (yyvsp[(2) - (2)].s); ;} break; - case 77: -#line 351 "engines/director/lingo/lingo-gr.y" + case 80: +#line 373 "engines/director/lingo/lingo-gr.y" { (yyval.s) = (yyvsp[(2) - (2)].s); ;} break; - case 78: -#line 352 "engines/director/lingo/lingo-gr.y" + case 81: +#line 374 "engines/director/lingo/lingo-gr.y" { (yyval.s) = (yyvsp[(1) - (1)].s); ;} break; - case 79: -#line 355 "engines/director/lingo/lingo-gr.y" + case 82: +#line 377 "engines/director/lingo/lingo-gr.y" { (yyval.s) = (yyvsp[(3) - (3)].s); ;} break; - case 80: -#line 356 "engines/director/lingo/lingo-gr.y" + case 83: +#line 378 "engines/director/lingo/lingo-gr.y" { (yyval.s) = (yyvsp[(2) - (2)].s); ;} break; - case 81: -#line 357 "engines/director/lingo/lingo-gr.y" + case 84: +#line 379 "engines/director/lingo/lingo-gr.y" { (yyval.s) = (yyvsp[(3) - (3)].s); ;} break; - case 82: -#line 385 "engines/director/lingo/lingo-gr.y" + case 85: +#line 407 "engines/director/lingo/lingo-gr.y" { g_lingo->_indef = true; ;} break; - case 83: -#line 386 "engines/director/lingo/lingo-gr.y" + case 86: +#line 408 "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); @@ -2073,33 +2109,33 @@ yyreduce: g_lingo->_indef = false; ;} break; - case 84: -#line 392 "engines/director/lingo/lingo-gr.y" + case 87: +#line 414 "engines/director/lingo/lingo-gr.y" { (yyval.narg) = 0; ;} break; - case 85: -#line 393 "engines/director/lingo/lingo-gr.y" + case 88: +#line 415 "engines/director/lingo/lingo-gr.y" { g_lingo->codeArg((yyvsp[(1) - (1)].s)); (yyval.narg) = 1; ;} break; - case 86: -#line 394 "engines/director/lingo/lingo-gr.y" + case 89: +#line 416 "engines/director/lingo/lingo-gr.y" { g_lingo->codeArg((yyvsp[(3) - (3)].s)); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;} break; - case 87: -#line 395 "engines/director/lingo/lingo-gr.y" + case 90: +#line 417 "engines/director/lingo/lingo-gr.y" { g_lingo->codeArg((yyvsp[(4) - (4)].s)); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;} break; - case 88: -#line 397 "engines/director/lingo/lingo-gr.y" + case 91: +#line 419 "engines/director/lingo/lingo-gr.y" { g_lingo->codeArgStore(); ;} break; - case 89: -#line 400 "engines/director/lingo/lingo-gr.y" + case 92: +#line 422 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_call); g_lingo->codeString((yyvsp[(1) - (3)].s)->c_str()); @@ -2108,24 +2144,24 @@ yyreduce: g_lingo->code1(numpar); ;} break; - case 90: -#line 408 "engines/director/lingo/lingo-gr.y" + case 93: +#line 430 "engines/director/lingo/lingo-gr.y" { (yyval.narg) = 0; ;} break; - case 91: -#line 409 "engines/director/lingo/lingo-gr.y" + case 94: +#line 431 "engines/director/lingo/lingo-gr.y" { (yyval.narg) = 1; ;} break; - case 92: -#line 410 "engines/director/lingo/lingo-gr.y" + case 95: +#line 432 "engines/director/lingo/lingo-gr.y" { (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;} break; /* Line 1267 of yacc.c. */ -#line 2129 "engines/director/lingo/lingo-gr.cpp" +#line 2165 "engines/director/lingo/lingo-gr.cpp" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -2339,6 +2375,6 @@ yyreturn: } -#line 413 "engines/director/lingo/lingo-gr.y" +#line 435 "engines/director/lingo/lingo-gr.y" diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y index d65e683cb2..221c7219db 100644 --- a/engines/director/lingo/lingo-gr.y +++ b/engines/director/lingo/lingo-gr.y @@ -79,7 +79,7 @@ using namespace Director; %token tWITH tWHILE tNLELSE %token tGE tLE tGT tLT tEQ tNEQ -%type<code> asgn begin elseif elsestmt end expr if repeatwhile repeatwith stmtlist +%type<code> asgn begin elseif elsestmtoneliner end expr if repeatwhile repeatwith stmtlist %type<s> gotoframe gotomovie %type<narg> argdef arglist @@ -197,18 +197,38 @@ ifstmt: if cond tTHEN '\n' 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, $9); } - | if cond tTHEN begin stmtoneliner end elsestmt end { + | if cond tTHEN begin stmtoneliner end { inst then = 0, else1 = 0, end = 0; WRITE_UINT32(&then, $4); - WRITE_UINT32(&else1, $7); - WRITE_UINT32(&end, $8); + WRITE_UINT32(&else1, 0); + WRITE_UINT32(&end, $6); (*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */ (*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 begin stmtoneliner end tNLELSE begin stmtoneliner end { + inst then = 0, else1 = 0, end = 0; + WRITE_UINT32(&then, $4); + WRITE_UINT32(&else1, $8); + WRITE_UINT32(&end, $10); + (*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */ + (*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 begin stmtoneliner end elseifstmtoneliner end elsestmtoneliner end { + inst then = 0, else1 = 0, end = 0; + WRITE_UINT32(&then, $4); + WRITE_UINT32(&else1, $6); + WRITE_UINT32(&end, $10); + (*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */ + (*g_lingo->_currentScript)[$1 + 2] = else1; /* elsepart */ + (*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */ + + g_lingo->processIf(0, $10); } ; -elsestmt: /* nothing */ { $$ = 0; } +elsestmtoneliner: /* nothing */ { $$ = 0; } | tNLELSE begin stmtoneliner { $$ = $2; } ; @@ -216,12 +236,14 @@ elseifstmt: elseifstmt elseifstmt1 | elseifstmt1 ; -elseifstmt1: elseif cond tTHEN begin stmt end '\n' { +elseifstmtoneliner: elseif cond tTHEN begin stmt end { inst then = 0; WRITE_UINT32(&then, $4); (*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */ g_lingo->codeLabel($1); } + +elseifstmt1: elseifstmtoneliner | elseif cond tTHEN stmtlist end { inst then = 0; WRITE_UINT32(&then, $4); |