From 1cf381db2aab7567e977fdc34dfc2a4598080694 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 24 Jun 2016 11:03:01 +0200 Subject: [PATCH] DIRECTOR: Lingo: Generate STOP at the macro end --- engines/director/lingo/lingo-gr.cpp | 160 ++++++++++++++-------------- engines/director/lingo/lingo-gr.y | 2 +- 2 files changed, 83 insertions(+), 79 deletions(-) diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp index 908c07b8f882..524330d33608 100644 --- a/engines/director/lingo/lingo-gr.cpp +++ b/engines/director/lingo/lingo-gr.cpp @@ -418,7 +418,7 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 49 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 287 +#define YYLAST 302 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 50 @@ -427,7 +427,7 @@ union yyalloc /* YYNRULES -- Number of rules. */ #define YYNRULES 71 /* YYNRULES -- Number of states. */ -#define YYNSTATES 146 +#define YYNSTATES 147 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 @@ -482,8 +482,8 @@ static const yytype_uint8 yyprhs[] = 118, 119, 122, 125, 127, 129, 131, 135, 139, 143, 147, 151, 155, 159, 163, 167, 170, 173, 177, 180, 183, 186, 188, 190, 193, 196, 199, 202, 206, 209, - 213, 216, 219, 221, 225, 228, 232, 233, 239, 240, - 242, 246 + 213, 216, 219, 221, 225, 228, 232, 233, 240, 241, + 243, 247 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ @@ -512,9 +512,9 @@ static const yytype_int8 yyrhs[] = 64, -1, 14, 64, 65, -1, 14, 65, -1, 29, 13, 8, -1, 13, 8, -1, 29, 8, -1, 8, -1, 23, 21, 8, -1, 21, 8, -1, 29, 21, - 8, -1, -1, 18, 7, 67, 68, 60, -1, -1, - 7, -1, 68, 49, 7, -1, 68, 49, 44, 7, - -1 + 8, -1, -1, 18, 7, 67, 68, 60, 59, -1, + -1, 7, -1, 68, 49, 7, -1, 68, 49, 44, + 7, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ @@ -583,7 +583,7 @@ static const yytype_uint8 yyr2[] = 0, 2, 2, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 3, 2, 2, 2, 1, 1, 2, 2, 2, 2, 3, 2, 3, - 2, 2, 1, 3, 2, 3, 0, 5, 0, 1, + 2, 2, 1, 3, 2, 3, 0, 6, 0, 1, 3, 4 }; @@ -603,10 +603,10 @@ static const yytype_uint8 yydefact[] = 47, 2, 0, 29, 0, 0, 30, 0, 43, 44, 42, 36, 37, 38, 39, 40, 41, 63, 59, 65, 69, 30, 13, 15, 14, 30, 0, 25, 29, 24, - 0, 67, 29, 0, 0, 31, 32, 0, 16, 17, - 70, 0, 0, 0, 29, 30, 0, 71, 0, 29, - 30, 29, 18, 20, 30, 29, 0, 29, 0, 0, - 0, 0, 19, 0, 21, 22 + 0, 29, 29, 0, 0, 31, 32, 0, 16, 17, + 70, 0, 67, 0, 0, 29, 30, 0, 71, 0, + 29, 30, 29, 18, 20, 30, 29, 0, 29, 0, + 0, 0, 0, 19, 0, 21, 22 }; /* YYDEFGOTO[NTERM-NUM]. */ @@ -621,28 +621,28 @@ static const yytype_int8 yydefgoto[] = #define YYPACT_NINF -27 static const yytype_int16 yypact[] = { - 76, -27, -27, -27, -27, 186, -27, -3, 3, 31, - 2, 13, 39, 2, 2, 2, 8, 92, 227, -27, - 10, 11, 119, 215, -27, -27, -27, -27, 40, -27, + 76, -27, -27, -27, -27, 192, -27, -3, 3, 31, + 2, 13, 39, 2, 2, 2, 8, 92, 242, -27, + 4, 10, 139, 230, -27, -27, -27, -27, 47, -27, 60, -27, 49, -27, 24, 46, -27, -27, -27, -27, - 2, -27, 144, 64, -27, -17, -13, -13, 191, -27, - 76, -27, 119, 2, 119, 44, 203, 2, 2, 2, + 2, -27, 149, 64, -27, -17, -13, -13, 206, -27, + 76, -27, 139, 2, 139, 44, 218, 2, 2, 2, 2, 2, 2, 2, 2, 2, -27, -27, 65, -27, - 66, 72, 61, -27, 77, 144, 78, -27, 2, 2, - -27, -27, 43, 215, 52, 179, -27, 2, 215, 215, - 215, 239, 239, -13, -13, 215, 215, -27, -27, -27, - -27, 37, -27, 215, 215, -27, -4, -27, 128, 215, - -5, 128, 128, 71, 2, -27, -27, 20, 215, -27, - -27, 101, 102, 2, 215, -27, 107, -27, 99, 215, - -27, 128, -27, -27, -27, 128, 116, 128, 117, 115, - 130, 113, -27, 123, -27, -27 + 66, 72, 61, -27, 77, 149, 78, -27, 2, 2, + -27, -27, 40, 230, 43, 194, -27, 2, 230, 230, + 230, 254, 254, -13, -13, 230, 230, -27, -27, -27, + -27, 51, -27, 230, 230, -27, -4, -27, 128, 230, + -5, 128, 128, 69, 2, -27, -27, 20, 230, -27, + -27, 98, -27, 97, 2, 230, -27, 94, -27, 96, + 230, -27, 128, -27, -27, -27, 128, 102, 128, 112, + 110, 116, 103, -27, 108, -27, -27 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { - -27, -14, -27, 1, 6, -26, -27, -27, -27, 58, - 4, 0, 16, -27, -27, 110, -27, -27, -27 + -27, -14, -27, 1, 6, -26, -27, -27, -27, 87, + 25, 0, 16, -27, -27, 93, -27, -27, -27 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If @@ -655,32 +655,34 @@ static const yytype_int16 yytable[] = 23, 18, 120, 51, 37, 113, 19, 2, 49, 3, 42, 38, 78, 46, 47, 48, 24, 23, 18, 57, 58, 79, 56, 19, 59, 114, 82, 40, 84, 12, - 125, 126, 69, 24, 64, 65, 81, 70, 39, 121, - 75, 13, 14, 43, 44, 71, 45, 15, 66, 53, - 23, 18, 56, 83, 85, 52, 19, 88, 89, 90, + 126, 127, 69, 24, 64, 65, 81, 70, 39, 121, + 75, 13, 14, 43, 44, 71, 45, 15, 53, 52, + 23, 18, 56, 83, 85, 66, 19, 88, 89, 90, 91, 92, 93, 94, 95, 96, 24, 30, 67, 32, 68, 77, 86, 97, 98, 72, -5, 1, 103, 104, - 99, 2, 71, 3, 100, 102, 110, 109, 4, 105, - 5, 6, -4, 1, 7, 8, 9, 2, 107, 3, - 123, 10, 11, 12, 4, 111, 5, 6, 127, 112, - 7, 8, 9, 128, 124, 13, 14, 10, 11, 12, - -5, 15, 132, 129, 2, 133, 3, 139, 141, 131, - 142, 13, 14, 2, 135, 3, 50, 15, 137, 144, - 4, 143, 5, 6, 40, 73, 12, 8, 9, 145, - 0, 0, 0, 10, 11, 12, 0, 0, 13, 14, - 76, 0, 0, 0, 54, 0, 117, 13, 14, 0, - 122, 0, 115, 15, 0, 0, 57, 58, 0, 0, - 0, 59, 130, 60, 61, 62, 63, 134, 0, 136, - 0, 64, 65, 138, 27, 140, 0, 0, 0, 28, - 0, 0, 0, 29, 0, 0, 0, 30, 31, 32, - 33, 57, 58, 0, 0, 34, 59, 87, 60, 61, - 62, 63, 0, 57, 58, 80, 64, 65, 59, 0, - 60, 61, 62, 63, 0, 57, 58, 80, 64, 65, - 59, 87, 60, 61, 62, 63, 0, 57, 58, 0, - 64, 65, 59, 0, 60, 61, 62, 63, 0, -35, - -35, 0, 64, 65, -35, 0, 0, 0, -35, -35, - 0, 57, 58, 0, -35, -35, 59, 0, 0, 0, - 62, 63, 0, 0, 0, 0, 64, 65 + 99, 2, 71, 3, 100, 102, 105, 109, 4, 107, + 5, 6, -4, 1, 7, 8, 9, 2, 124, 3, + 110, 10, 11, 12, 4, 128, 5, 6, 129, 133, + 7, 8, 9, 140, 125, 13, 14, 10, 11, 12, + -5, 15, 134, 142, 130, 143, 111, 144, 73, 145, + 112, 13, 14, 2, 146, 3, 50, 15, 0, 0, + 4, 0, 5, 6, 2, 0, 3, 8, 9, 0, + 0, 132, 0, 10, 11, 12, 136, 0, 0, 0, + 138, 0, 0, 0, 40, 76, 12, 13, 14, 0, + 0, 0, 115, 15, 0, 0, 0, 0, 13, 14, + 0, 57, 58, 0, 54, 0, 59, 0, 60, 61, + 62, 63, 0, 0, 0, 117, 64, 65, 122, 123, + 27, 0, 0, 0, 0, 28, 0, 0, 0, 29, + 0, 0, 131, 30, 31, 32, 33, 135, 0, 137, + 0, 34, 0, 139, 0, 141, 57, 58, 0, 0, + 0, 59, 87, 60, 61, 62, 63, 0, 57, 58, + 80, 64, 65, 59, 0, 60, 61, 62, 63, 0, + 57, 58, 80, 64, 65, 59, 87, 60, 61, 62, + 63, 0, 57, 58, 0, 64, 65, 59, 0, 60, + 61, 62, 63, 0, -35, -35, 0, 64, 65, -35, + 0, 0, 0, -35, -35, 0, 57, 58, 0, -35, + -35, 59, 0, 0, 0, 62, 63, 0, 0, 0, + 0, 64, 65 }; static const yytype_int16 yycheck[] = @@ -689,31 +691,33 @@ static const yytype_int16 yycheck[] = 10, 8, 29, 13, 14, 15, 0, 17, 17, 32, 33, 38, 22, 17, 37, 29, 52, 25, 54, 27, 10, 11, 8, 17, 47, 48, 50, 13, 7, 44, - 40, 39, 40, 30, 31, 21, 7, 45, 8, 38, - 50, 50, 52, 53, 54, 45, 50, 57, 58, 59, + 40, 39, 40, 30, 31, 21, 7, 45, 38, 45, + 50, 50, 52, 53, 54, 8, 50, 57, 58, 59, 60, 61, 62, 63, 64, 65, 50, 21, 8, 23, 21, 7, 28, 8, 8, 29, 0, 1, 78, 79, - 8, 5, 21, 7, 7, 7, 49, 87, 12, 46, - 14, 15, 0, 1, 18, 19, 20, 5, 46, 7, - 29, 25, 26, 27, 12, 101, 14, 15, 7, 105, + 8, 5, 21, 7, 7, 7, 46, 87, 12, 46, + 14, 15, 0, 1, 18, 19, 20, 5, 29, 7, + 49, 25, 26, 27, 12, 7, 14, 15, 11, 15, 18, 19, 20, 11, 114, 39, 40, 25, 26, 27, - 44, 45, 15, 123, 5, 26, 7, 11, 11, 125, - 15, 39, 40, 5, 130, 7, 44, 45, 134, 26, - 12, 11, 14, 15, 25, 35, 27, 19, 20, 26, - -1, -1, -1, 25, 26, 27, -1, -1, 39, 40, - 16, -1, -1, -1, 45, -1, 108, 39, 40, -1, - 112, -1, 44, 45, -1, -1, 32, 33, -1, -1, - -1, 37, 124, 39, 40, 41, 42, 129, -1, 131, - -1, 47, 48, 135, 8, 137, -1, -1, -1, 13, - -1, -1, -1, 17, -1, -1, -1, 21, 22, 23, - 24, 32, 33, -1, -1, 29, 37, 38, 39, 40, - 41, 42, -1, 32, 33, 46, 47, 48, 37, -1, - 39, 40, 41, 42, -1, 32, 33, 46, 47, 48, - 37, 38, 39, 40, 41, 42, -1, 32, 33, -1, - 47, 48, 37, -1, 39, 40, 41, 42, -1, 32, - 33, -1, 47, 48, 37, -1, -1, -1, 41, 42, - -1, 32, 33, -1, 47, 48, 37, -1, -1, -1, - 41, 42, -1, -1, -1, -1, 47, 48 + 44, 45, 26, 11, 124, 15, 101, 11, 35, 26, + 105, 39, 40, 5, 26, 7, 44, 45, -1, -1, + 12, -1, 14, 15, 5, -1, 7, 19, 20, -1, + -1, 126, -1, 25, 26, 27, 131, -1, -1, -1, + 135, -1, -1, -1, 25, 16, 27, 39, 40, -1, + -1, -1, 44, 45, -1, -1, -1, -1, 39, 40, + -1, 32, 33, -1, 45, -1, 37, -1, 39, 40, + 41, 42, -1, -1, -1, 108, 47, 48, 111, 112, + 8, -1, -1, -1, -1, 13, -1, -1, -1, 17, + -1, -1, 125, 21, 22, 23, 24, 130, -1, 132, + -1, 29, -1, 136, -1, 138, 32, 33, -1, -1, + -1, 37, 38, 39, 40, 41, 42, -1, 32, 33, + 46, 47, 48, 37, -1, 39, 40, 41, 42, -1, + 32, 33, 46, 47, 48, 37, 38, 39, 40, 41, + 42, -1, 32, 33, -1, 47, 48, 37, -1, 39, + 40, 41, 42, -1, 32, 33, -1, 47, 48, 37, + -1, -1, -1, 41, 42, -1, 32, 33, -1, 47, + 48, 37, -1, -1, -1, 41, 42, -1, -1, -1, + -1, 47, 48 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing @@ -732,9 +736,9 @@ static const yytype_uint8 yystos[] = 61, 61, 61, 61, 61, 61, 61, 8, 8, 8, 7, 68, 7, 61, 61, 46, 59, 46, 60, 61, 49, 60, 60, 9, 29, 44, 54, 59, 61, 62, - 7, 44, 59, 29, 61, 10, 11, 7, 11, 61, - 59, 60, 15, 26, 59, 60, 59, 60, 59, 11, - 59, 11, 15, 11, 26, 26 + 7, 44, 59, 59, 29, 61, 10, 11, 7, 11, + 61, 59, 60, 15, 26, 59, 60, 59, 60, 59, + 11, 59, 11, 15, 11, 26, 26 }; #define yyerrok (yyerrstatus = 0) @@ -1850,7 +1854,7 @@ yyparse () #line 271 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_procret); - g_lingo->define(*(yyvsp[(2) - (5)].s), (yyvsp[(4) - (5)].narg)); + g_lingo->define(*(yyvsp[(2) - (6)].s), (yyvsp[(4) - (6)].narg)); g_lingo->_indef = false; ;} break; @@ -1876,7 +1880,7 @@ yyparse () /* Line 1267 of yacc.c. */ -#line 1880 "engines/director/lingo/lingo-gr.cpp" +#line 1884 "engines/director/lingo/lingo-gr.cpp" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y index 910cd8077b44..c28fe66b36e8 100644 --- a/engines/director/lingo/lingo-gr.y +++ b/engines/director/lingo/lingo-gr.y @@ -268,7 +268,7 @@ gotomovie: tOF tMOVIE STRING { $$ = $3; } // See also: // on keyword defn: tMACRO VAR { g_lingo->_indef = true; } - arglist stmtlist { + arglist stmtlist end { g_lingo->code1(g_lingo->c_procret); g_lingo->define(*$2, $4); g_lingo->_indef = false; }