From e11c036ba8c49d89c9276da9313d63ec3ca22dc7 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 9 Jul 2016 23:53:19 +0200 Subject: DIRECTOR: Lingo: Fix multiline if() statements --- engines/director/director.cpp | 7 +- engines/director/lingo/lingo-gr.cpp | 134 ++++++++++++++++++------------------ engines/director/lingo/lingo-gr.y | 2 +- 3 files changed, 73 insertions(+), 70 deletions(-) (limited to 'engines') diff --git a/engines/director/director.cpp b/engines/director/director.cpp index 5a6c8ec32f..bbd7916a41 100644 --- a/engines/director/director.cpp +++ b/engines/director/director.cpp @@ -135,8 +135,11 @@ Common::Error DirectorEngine::run() { put chars(\"Macromedia\", 6, 6)\n\ put chars(\"Macromedia\", 6, 10)\n\ put chars(\"Macromedia\", -1, 15)\n\ - if z1 contains \"Me\xafW\" then put \"Contains\"\n\ - else put \"Doesn't contain\"\n\ + if z1 contains \"Me\xafW\" then\n\ + put \"Contains\"\n\ + else\n\ + put \"Doesn't contain\"\n\ + end if\n\ ", kMovieScript, 2); _lingo->executeScript(kMovieScript, 2); diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp index 50d34d9992..3aef4795c7 100644 --- a/engines/director/lingo/lingo-gr.cpp +++ b/engines/director/lingo/lingo-gr.cpp @@ -528,7 +528,7 @@ static const yytype_int8 yyrhs[] = 35, 85, 83, 84, 83, 16, 32, -1, 79, 51, 85, 83, 13, 35, 85, 83, 84, 83, 16, 32, -1, 80, 77, 34, 66, 84, 83, 16, 21, -1, - 80, 77, 34, 66, 84, 83, 14, 84, 83, 16, + 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, @@ -669,8 +669,8 @@ static const yytype_uint8 yydefact[] = 46, 0, 39, 46, 0, 38, 106, 99, 0, 45, 0, 0, 45, 45, 16, 0, 102, 47, 48, 0, 0, 45, 44, 25, 100, 0, 46, 0, 45, 46, - 46, 0, 0, 43, 44, 45, 33, 0, 101, 97, - 19, 46, 45, 45, 22, 45, 35, 31, 0, 0, + 0, 46, 0, 43, 44, 45, 33, 0, 101, 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, @@ -688,41 +688,41 @@ static const yytype_int16 yydefgoto[] = /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -159 +#define YYPACT_NINF -162 static const yytype_int16 yypact[] = { - 174, -159, -159, -159, -43, 439, -159, -159, 25, 116, - -159, 30, 33, 31, 312, 13, 49, 312, 312, 312, - 312, 4, -159, 8, -159, -159, -159, 9, 11, 319, - 420, -159, -159, -159, -159, 312, 312, 312, -159, 5, - -159, 53, -159, 80, -159, 65, -159, -1, 1, -159, - -159, -159, -159, 36, 312, -159, 334, 50, -159, -22, - 482, 482, 482, 377, -159, -159, 174, 319, 312, 319, - 61, 401, 312, 312, 312, 312, 312, 312, 312, 312, - 312, 312, 312, 312, 312, 312, 312, 420, -17, -16, - 35, 89, -159, -159, 91, -159, 92, 93, 78, -159, - -159, 334, 101, -159, 312, 312, -159, -159, 55, 420, - 58, 353, 62, 312, 420, 420, 420, 420, 420, 420, - 420, 420, 463, 463, 482, 482, 420, 420, 420, -159, - 312, -159, -159, -159, -159, -159, 102, -159, 420, 420, - -159, -2, -159, -159, 284, 420, 420, -159, -39, 226, - 83, 312, 226, -159, -159, 110, 59, -159, -159, 105, - 312, 420, 39, -6, -159, 115, -159, 94, 420, -159, - -159, 107, 120, -159, -159, 120, -159, 319, -159, 226, - -159, -159, 226, 226, -159, 120, 120, -159, 319, 284, - -159, 98, 103, 226, 122, 124, -159, 62, 108, -159, - -159, -159, -159, 132, 118, 131, 138, -3, -159, 284, - -159, 255, 123, -159, -159, 135, 226, -159, -159, -159, - -159, -159, -159 + 174, -162, -162, -162, -34, 439, -162, -162, 30, 18, + -162, 42, 44, 47, 312, 25, 49, 312, 312, 312, + 312, 8, -162, 10, -162, -162, -162, 5, 41, 319, + 420, -162, -162, -162, -162, 312, 312, 312, -162, 32, + -162, 86, -162, 87, -162, 72, -162, 83, -12, -162, + -162, -162, -162, 53, 312, -162, 334, 92, -162, -17, + 482, 482, 482, 377, -162, -162, 174, 319, 312, 319, + 71, 401, 312, 312, 312, 312, 312, 312, 312, 312, + 312, 312, 312, 312, 312, 312, 312, 420, -5, 1, + 51, 106, -162, -162, 107, -162, 109, 110, 90, -162, + -162, 334, 112, -162, 312, 312, -162, -162, 64, 420, + 66, 353, 70, 312, 420, 420, 420, 420, 420, 420, + 420, 420, 463, 463, 482, 482, 420, 420, 420, -162, + 312, -162, -162, -162, -162, -162, 118, -162, 420, 420, + -162, -2, -162, -162, 284, 420, 420, -162, -14, 226, + 95, 312, 226, -162, -162, 121, 74, -162, -162, 122, + 312, 420, 12, -3, -162, 124, -162, 108, 420, -162, + 120, -162, 127, -162, -162, 127, -162, 319, -162, 226, + -162, -162, 226, -162, 226, 127, 127, -162, 319, 284, + -162, 101, 111, 226, 130, 131, -162, 70, 114, -162, + -162, -162, -162, 133, 119, 134, 138, -6, -162, 284, + -162, 255, 125, -162, -162, 135, 226, -162, -162, -162, + -162, -162, -162 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -159, -159, -19, 95, 6, -99, 0, -159, -159, -159, - 10, -152, -28, -64, -159, -159, -159, -158, -4, -52, - -118, 2, 7, -159, -159, -159, 111, -159, -159, -159, - -159, -159, 21 + -162, -162, -19, 77, 6, -100, 0, -162, -162, -162, + 3, -161, -26, -64, -162, -162, -162, -159, -4, -49, + -139, 2, 7, -162, -162, -162, 113, -162, -162, -162, + -162, -162, 54 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If @@ -732,24 +732,24 @@ static const yytype_int16 yypgoto[] = #define YYTABLE_NINF -55 static const yytype_int16 yytable[] = { - 25, 37, 66, 108, 64, 110, 23, 31, -9, 173, - 95, 150, -46, 104, 188, 35, 56, 96, 65, 60, - 61, 62, 63, 190, 155, 152, 97, 188, 43, 105, - 45, 71, 174, 151, 190, 38, 98, 87, 87, 87, - 50, 52, 129, 131, 51, 153, 130, 130, 179, 57, - 58, 182, 183, 170, -46, 171, 101, 89, 90, 59, - 103, 65, 68, 193, 92, -9, 25, 67, 91, 71, + 25, 37, 66, 108, 152, 110, 23, 31, 64, -46, + -9, 150, 173, 188, 190, 43, 56, 45, 104, 60, + 61, 62, 63, 98, 35, 190, 188, 179, 170, 40, + 182, 71, 184, 151, 105, 174, 41, 87, 87, 87, + 38, 42, 193, 65, 153, 43, 44, 45, 46, 155, + 171, -46, 50, 47, 129, 51, 101, 52, 130, 59, + 131, 57, 58, 67, 130, 65, 25, -9, 216, 71, 109, 111, 23, 31, 114, 115, 116, 117, 118, 119, - 120, 121, 122, 123, 124, 125, 126, 127, 128, 216, - 199, 93, 94, 143, 36, 112, 136, 159, 130, 132, - 162, 163, 133, 134, 135, 97, 138, 139, 144, 169, - 217, 137, 147, 192, 140, 145, 181, 142, 160, 65, - 164, 167, 165, 191, 198, 178, 180, 40, 184, 156, - 194, 195, 146, 197, 41, 173, 200, 202, 204, 42, - 205, 203, 207, 43, 44, 45, 46, 208, 212, 210, - 213, 47, 214, 161, 215, 219, 220, 196, 172, 99, - 0, 107, 168, 0, 221, 0, 222, 0, 0, 0, - 189, 0, 0, 175, -5, 1, 0, 0, 206, 71, + 120, 121, 122, 123, 124, 125, 126, 127, 128, 199, + 89, 90, 68, 143, 95, 91, 136, 92, 93, 94, + 159, 96, 103, 162, 163, 112, 138, 139, 144, 217, + 97, 36, 169, 192, 130, 145, 132, 97, 133, 181, + 134, 135, 137, 140, 198, 142, 191, 65, 147, 156, + 160, 164, 146, 194, 178, 195, 197, 165, 167, 200, + 180, 183, 173, 107, 203, 202, 204, 205, 207, 212, + 208, 213, 210, 161, 215, 214, 220, 219, 172, 196, + 0, 99, 168, 0, 0, 0, 175, 221, 0, 222, + 189, 0, 0, 0, -5, 1, 0, 0, 206, 71, 0, 2, 3, 4, 5, 6, 0, 0, 0, 0, 71, 7, 0, 8, 9, 10, 209, 0, 11, 12, 13, 0, 0, 0, 0, 14, 15, 16, 0, 0, @@ -791,24 +791,24 @@ static const yytype_int16 yytable[] = static const yytype_int16 yycheck[] = { - 0, 5, 21, 67, 0, 69, 0, 0, 0, 15, - 11, 13, 15, 35, 172, 58, 14, 18, 57, 17, - 18, 19, 20, 175, 63, 143, 27, 185, 27, 51, - 29, 29, 38, 35, 186, 10, 35, 35, 36, 37, - 10, 10, 59, 59, 11, 144, 63, 63, 166, 36, - 37, 169, 170, 14, 57, 16, 54, 36, 37, 10, - 10, 57, 51, 181, 11, 57, 66, 58, 63, 67, + 0, 5, 21, 67, 143, 69, 0, 0, 0, 15, + 0, 13, 15, 172, 175, 27, 14, 29, 35, 17, + 18, 19, 20, 35, 58, 186, 185, 166, 16, 11, + 169, 29, 171, 35, 51, 38, 18, 35, 36, 37, + 10, 23, 181, 57, 144, 27, 28, 29, 30, 63, + 38, 57, 10, 35, 59, 11, 54, 10, 63, 10, + 59, 36, 37, 58, 63, 57, 66, 57, 207, 67, 68, 69, 66, 66, 72, 73, 74, 75, 76, 77, - 78, 79, 80, 81, 82, 83, 84, 85, 86, 207, - 189, 11, 27, 112, 58, 34, 100, 149, 63, 10, - 152, 153, 11, 11, 11, 27, 104, 105, 112, 161, - 209, 10, 10, 177, 59, 113, 168, 59, 35, 57, - 10, 16, 63, 175, 188, 10, 32, 11, 21, 148, - 182, 183, 130, 185, 18, 15, 38, 34, 16, 23, - 16, 193, 34, 27, 28, 29, 30, 199, 16, 201, - 32, 35, 21, 151, 16, 32, 21, 185, 162, 48, - -1, 66, 160, -1, 216, -1, 218, -1, -1, -1, - 174, -1, -1, 163, 0, 1, -1, -1, 197, 177, + 78, 79, 80, 81, 82, 83, 84, 85, 86, 189, + 36, 37, 51, 112, 11, 63, 100, 11, 11, 27, + 149, 18, 10, 152, 153, 34, 104, 105, 112, 209, + 27, 58, 161, 177, 63, 113, 10, 27, 11, 168, + 11, 11, 10, 59, 188, 59, 175, 57, 10, 148, + 35, 10, 130, 182, 10, 184, 185, 63, 16, 38, + 32, 21, 15, 66, 193, 34, 16, 16, 34, 16, + 199, 32, 201, 151, 16, 21, 21, 32, 162, 185, + -1, 48, 160, -1, -1, -1, 163, 216, -1, 218, + 174, -1, -1, -1, 0, 1, -1, -1, 197, 177, -1, 7, 8, 9, 10, 11, -1, -1, -1, -1, 188, 17, -1, 19, 20, 21, 200, -1, 24, 25, 26, -1, -1, -1, -1, 31, 32, 33, -1, -1, @@ -869,8 +869,8 @@ static const yytype_uint8 yystos[] = 59, 83, 59, 66, 82, 85, 85, 10, 93, 84, 13, 35, 84, 69, 86, 63, 66, 66, 70, 83, 35, 85, 83, 83, 10, 63, 94, 16, 85, 83, - 14, 16, 82, 15, 38, 74, 75, 81, 10, 84, - 32, 83, 84, 84, 21, 73, 74, 76, 81, 82, + 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, diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y index 6af9ca145f..3006176583 100644 --- a/engines/director/lingo/lingo-gr.y +++ b/engines/director/lingo/lingo-gr.y @@ -185,7 +185,7 @@ ifstmt: if cond tTHEN nl stmtlist end tEND tIF { (*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */ (*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */ g_lingo->processIf(0, 0); } - | if cond tTHEN nl stmtlist end tELSE stmtlist end tEND tIF { + | if cond tTHEN nl stmtlist end tNLELSE stmtlist end tEND tIF { inst then = 0, else1 = 0, end = 0; WRITE_UINT32(&then, $5); WRITE_UINT32(&else1, $8); -- cgit v1.2.3