From 29e8752fcaa461dbb273a93b37a84ffb7dc93e7d Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 28 Jun 2016 08:32:05 +0200 Subject: DIRECTOR: Lingo: Parse continuation arguments in macros --- engines/director/director.cpp | 4 +- engines/director/lingo/lingo-gr.cpp | 148 ++++++++++++++++++------------------ engines/director/lingo/lingo-gr.y | 2 +- 3 files changed, 77 insertions(+), 77 deletions(-) (limited to 'engines/director') diff --git a/engines/director/director.cpp b/engines/director/director.cpp index 2c8441d1d9..036a341dbb 100644 --- a/engines/director/director.cpp +++ b/engines/director/director.cpp @@ -78,6 +78,7 @@ Common::Error DirectorEngine::run() { #if 0 _lingo->addCode("--\n\ macro check par1, par2\n\ +, par3\n\ if par1 = 3 then\n\ put -3\n\ else\n\ @@ -90,9 +91,10 @@ else\n\ end if\n\ put par1\n\ put par2\n\ +put par3\n\ ", kMovieScript, 5); -_lingo->addCode("check(3, 2)\n\ +_lingo->addCode("check(1, 2, 3)\n\ ", kMovieScript, 2); _lingo->executeScript(kMovieScript, 2); diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp index d1262f1baa..c68959d85f 100644 --- a/engines/director/lingo/lingo-gr.cpp +++ b/engines/director/lingo/lingo-gr.cpp @@ -420,7 +420,7 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 51 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 255 +#define YYLAST 246 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 51 @@ -516,7 +516,7 @@ static const yytype_int8 yyrhs[] = 30, 8, -1, 8, -1, 24, 22, 8, -1, 22, 8, -1, 30, 22, 8, -1, -1, 19, 7, 69, 60, 70, 45, 62, -1, -1, 7, -1, 70, 50, - 7, -1, 70, 50, 45, 7, -1, -1, 63, -1, + 7, -1, 70, 45, 50, 7, -1, -1, 63, -1, 71, 50, 63, -1 }; @@ -610,7 +610,7 @@ static const yytype_uint8 yydefact[] = 0, 64, 60, 66, 69, 12, 14, 13, 30, 0, 24, 29, 23, 48, 0, 70, 0, 29, 0, 0, 31, 32, 0, 15, 16, 75, 30, 0, 0, 0, - 29, 30, 0, 68, 71, 0, 0, 29, 30, 29, + 29, 30, 0, 0, 68, 71, 0, 29, 30, 29, 17, 72, 19, 30, 29, 0, 29, 0, 0, 0, 0, 18, 0, 20, 21 }; @@ -625,33 +625,33 @@ static const yytype_int8 yydefgoto[] = /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -106 +#define YYPACT_NINF -110 static const yytype_int16 yypact[] = { - 71, -106, -106, -39, -106, 165, -106, 22, 3, 26, - 98, 17, 30, 98, 98, 98, 44, 24, 1, -106, - 27, 31, 140, 194, -106, -106, -106, 28, -106, 67, - -106, 69, -106, 57, -106, 13, 6, -106, -106, -106, - -106, -106, 98, -106, 129, 75, -106, -21, 206, 206, - 170, -106, 71, 140, 98, 140, 54, 182, 98, 98, - 98, 98, 98, 98, 98, 98, 98, 98, -106, -106, - 77, -106, 80, 85, 72, -106, -106, 129, 88, -106, - 98, 98, -106, -106, 49, 194, 53, 158, -106, 98, - 194, 194, 194, 116, 116, 206, 206, 194, 194, 194, - -30, -106, -106, -106, 94, -106, 194, 194, -106, -7, - -106, 115, 194, -106, 98, -106, -26, 115, 74, 98, - -106, -106, 39, 194, -106, 194, -106, -5, 90, 98, - 194, -106, 91, 115, -106, 99, 81, 194, -106, 115, - -106, -106, -106, -106, 115, 97, 115, 101, 102, 103, - 83, -106, 96, -106, -106 + 71, -110, -110, -35, -110, 9, -110, 12, 18, 33, + 98, 17, 43, 98, 98, 98, 70, 32, 1, -110, + 36, 40, 140, 185, -110, -110, -110, 39, -110, 80, + -110, 85, -110, 72, -110, 61, 21, -110, -110, -110, + -110, -110, 98, -110, 129, 88, -110, -27, 197, 197, + 161, -110, 71, 140, 98, 140, 67, 173, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, -110, -110, + 92, -110, 93, 94, 82, -110, -110, 129, 99, -110, + 98, 98, -110, -110, 60, 185, 63, 149, -110, 98, + 185, 185, 185, 116, 116, 197, 197, 185, 185, 185, + -3, -110, -110, -110, 101, -110, 185, 185, -110, 8, + -110, 115, 185, -110, 98, -110, -25, 115, 79, 98, + -110, -110, 62, 185, -110, 185, 65, 106, 109, 98, + 185, -110, 102, 118, 115, -110, 96, 185, -110, 115, + -110, -110, -110, -110, 115, 120, 115, 121, 111, 122, + 110, -110, 113, -110, -110 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { - -106, 73, -106, 4, 5, -8, -106, -106, -106, 45, - -105, -100, 0, 16, -106, -106, 104, -106, -106, -106, - -106 + -110, 100, -110, 4, 5, -46, -110, -110, -110, 75, + -109, -102, 0, 16, -110, -110, 112, -110, -110, -110, + -110 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If @@ -661,62 +661,60 @@ static const yytype_int8 yypgoto[] = #define YYTABLE_NINF -29 static const yytype_int16 yytable[] = { - 23, -7, 134, 118, 18, 19, 122, -28, 117, 80, - 44, 39, 128, 48, 49, 50, 24, 113, 81, 126, - 114, 71, 57, 119, 127, 138, 133, 72, 31, 38, - 33, 139, 143, 40, 145, 73, 74, 47, 144, 147, - 135, 149, 77, 146, 51, 84, -7, 86, 45, 46, - 131, 132, 23, 57, 85, 87, 18, 19, 90, 91, - 92, 93, 94, 95, 96, 97, 98, 99, 24, 52, - 54, -4, 1, 53, 67, 68, 2, 69, 3, 70, - 106, 107, 79, 88, 4, 101, 5, 6, 102, 112, - 7, 8, 9, 103, 73, 105, 108, 10, 11, 12, - 110, 115, 136, 2, 129, 41, 141, 140, 142, 148, - 153, 13, 14, 150, 125, 152, -4, 15, 151, 130, - 2, 104, 3, 154, 42, 83, 12, 0, 4, 137, - 5, 6, 0, 0, 0, 8, 9, 0, 13, 14, - 75, 10, 11, 12, 15, 2, 78, 41, 0, 58, - 59, 0, 0, 0, 60, 13, 14, 0, 63, 64, + 23, -7, 122, 80, 18, 19, 117, 84, 128, 86, + 44, -28, 81, 48, 49, 50, 24, 28, 118, 38, + 126, 138, 57, 29, 134, 127, 39, 30, 143, 139, + 145, 31, 32, 33, 34, 147, 144, 149, 119, 35, + 40, 146, 77, 31, 113, 33, -7, 114, 45, 46, + 47, 74, 23, 57, 85, 87, 18, 19, 90, 91, + 92, 93, 94, 95, 96, 97, 98, 99, 24, 71, + 51, -4, 1, 131, 132, 72, 2, 52, 3, 54, + 106, 107, 53, 73, 4, 67, 5, 6, 68, 112, + 7, 8, 9, 69, 70, 79, 88, 10, 11, 12, + 101, 102, 103, 2, 73, 41, 105, 108, 115, 129, + 110, 13, 14, 135, 125, 133, -4, 15, 140, 130, + 2, 136, 3, 142, 42, 141, 12, 151, 4, 137, + 5, 6, 148, 150, 152, 8, 9, 153, 13, 14, + 154, 10, 11, 12, 15, 2, 78, 41, 75, 58, + 59, 104, 83, 0, 60, 13, 14, 0, 63, 64, 120, 15, 58, 59, 65, 66, 42, 60, 12, 61, - 62, 63, 64, 28, 0, 0, 0, 65, 66, 29, - 13, 14, 0, 30, 0, 0, 55, 31, 32, 33, - 34, 58, 59, 0, 0, 35, 60, 89, 61, 62, - 63, 64, 0, 58, 59, 82, 65, 66, 60, 0, - 61, 62, 63, 64, 0, 58, 59, 82, 65, 66, - 60, 89, 61, 62, 63, 64, 0, 58, 59, 0, - 65, 66, 60, 0, 61, 62, 63, 64, 0, 58, - 59, 0, 65, 66, 60, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 65, 66 + 62, 63, 64, 0, 0, 0, 0, 65, 66, 0, + 13, 14, 58, 59, 0, 0, 55, 60, 89, 61, + 62, 63, 64, 0, 58, 59, 82, 65, 66, 60, + 0, 61, 62, 63, 64, 0, 58, 59, 82, 65, + 66, 60, 89, 61, 62, 63, 64, 0, 58, 59, + 0, 65, 66, 60, 0, 61, 62, 63, 64, 0, + 58, 59, 0, 65, 66, 60, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 65, 66 }; static const yytype_int16 yycheck[] = { - 0, 0, 7, 10, 0, 0, 111, 46, 108, 30, - 10, 8, 117, 13, 14, 15, 0, 47, 39, 45, - 50, 8, 22, 30, 50, 130, 126, 14, 22, 7, - 24, 131, 137, 7, 139, 22, 30, 7, 138, 144, - 45, 146, 42, 143, 0, 53, 45, 55, 31, 32, - 11, 12, 52, 53, 54, 55, 52, 52, 58, 59, - 60, 61, 62, 63, 64, 65, 66, 67, 52, 45, - 39, 0, 1, 46, 46, 8, 5, 8, 7, 22, - 80, 81, 7, 29, 13, 8, 15, 16, 8, 89, - 19, 20, 21, 8, 22, 7, 47, 26, 27, 28, - 47, 7, 12, 5, 30, 7, 7, 16, 27, 12, - 27, 40, 41, 12, 114, 12, 45, 46, 16, 119, - 5, 76, 7, 27, 26, 52, 28, -1, 13, 129, - 15, 16, -1, -1, -1, 20, 21, -1, 40, 41, - 36, 26, 27, 28, 46, 5, 17, 7, -1, 33, - 34, -1, -1, -1, 38, 40, 41, -1, 42, 43, + 0, 0, 111, 30, 0, 0, 108, 53, 117, 55, + 10, 46, 39, 13, 14, 15, 0, 8, 10, 7, + 45, 130, 22, 14, 126, 50, 8, 18, 137, 131, + 139, 22, 23, 24, 25, 144, 138, 146, 30, 30, + 7, 143, 42, 22, 47, 24, 45, 50, 31, 32, + 7, 30, 52, 53, 54, 55, 52, 52, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 52, 8, + 0, 0, 1, 11, 12, 14, 5, 45, 7, 39, + 80, 81, 46, 22, 13, 46, 15, 16, 8, 89, + 19, 20, 21, 8, 22, 7, 29, 26, 27, 28, + 8, 8, 8, 5, 22, 7, 7, 47, 7, 30, + 47, 40, 41, 7, 114, 50, 45, 46, 16, 119, + 5, 12, 7, 27, 26, 7, 28, 16, 13, 129, + 15, 16, 12, 12, 12, 20, 21, 27, 40, 41, + 27, 26, 27, 28, 46, 5, 17, 7, 36, 33, + 34, 76, 52, -1, 38, 40, 41, -1, 42, 43, 45, 46, 33, 34, 48, 49, 26, 38, 28, 40, - 41, 42, 43, 8, -1, -1, -1, 48, 49, 14, - 40, 41, -1, 18, -1, -1, 46, 22, 23, 24, - 25, 33, 34, -1, -1, 30, 38, 39, 40, 41, - 42, 43, -1, 33, 34, 47, 48, 49, 38, -1, - 40, 41, 42, 43, -1, 33, 34, 47, 48, 49, - 38, 39, 40, 41, 42, 43, -1, 33, 34, -1, - 48, 49, 38, -1, 40, 41, 42, 43, -1, 33, - 34, -1, 48, 49, 38, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 48, 49 + 41, 42, 43, -1, -1, -1, -1, 48, 49, -1, + 40, 41, 33, 34, -1, -1, 46, 38, 39, 40, + 41, 42, 43, -1, 33, 34, 47, 48, 49, 38, + -1, 40, 41, 42, 43, -1, 33, 34, 47, 48, + 49, 38, 39, 40, 41, 42, 43, -1, 33, 34, + -1, 48, 49, 38, -1, 40, 41, 42, 43, -1, + 33, 34, -1, 48, 49, 38, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 48, 49 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing @@ -736,7 +734,7 @@ static const yytype_uint8 yystos[] = 71, 8, 8, 8, 60, 7, 63, 63, 47, 61, 47, 62, 63, 47, 50, 7, 70, 62, 10, 30, 45, 55, 61, 63, 64, 63, 45, 50, 61, 30, - 63, 11, 12, 62, 7, 45, 12, 63, 61, 62, + 63, 11, 12, 50, 62, 7, 12, 63, 61, 62, 16, 7, 27, 61, 62, 61, 62, 61, 12, 61, 12, 16, 12, 27, 27 }; @@ -1939,7 +1937,7 @@ yyreduce: /* Line 1267 of yacc.c. */ -#line 1943 "engines/director/lingo/lingo-gr.cpp" +#line 1941 "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 94a2b78a1c..6ed5400e21 100644 --- a/engines/director/lingo/lingo-gr.y +++ b/engines/director/lingo/lingo-gr.y @@ -317,7 +317,7 @@ defn: tMACRO ID { g_lingo->_indef = true; } argdef: /* nothing */ { $$ = 0; } | ID { g_lingo->codeArg(*$1); delete $1; $$ = 1; } | argdef ',' ID { g_lingo->codeArg(*$3); delete $3; $$ = $1 + 1; } - | argdef ',' '\n' ID { g_lingo->codeArg(*$4); delete $4; $$ = $1 + 1; } + | argdef '\n' ',' ID { g_lingo->codeArg(*$4); delete $4; $$ = $1 + 1; } ; arglist: /* nothing */ { $$ = 0; } -- cgit v1.2.3