diff options
author | Eugene Sandulenko | 2016-06-25 12:54:38 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2016-08-03 23:40:36 +0200 |
commit | aee02d7282e696d68a01465b29c4d9da0018a76d (patch) | |
tree | b98847305bcab30f3a1a24e003830d42351f24bb /engines | |
parent | 327e625507f34c5656e4392c07d1b73bab95b976 (diff) | |
download | scummvm-rg350-aee02d7282e696d68a01465b29c4d9da0018a76d.tar.gz scummvm-rg350-aee02d7282e696d68a01465b29c4d9da0018a76d.tar.bz2 scummvm-rg350-aee02d7282e696d68a01465b29c4d9da0018a76d.zip |
DIRECTOR: Lingo: Initial code for function call grammar
Diffstat (limited to 'engines')
-rw-r--r-- | engines/director/lingo/lingo-code.cpp | 4 | ||||
-rw-r--r-- | engines/director/lingo/lingo-gr.cpp | 402 | ||||
-rw-r--r-- | engines/director/lingo/lingo-gr.y | 16 | ||||
-rw-r--r-- | engines/director/lingo/lingo.h | 1 |
4 files changed, 236 insertions, 187 deletions
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp index e14ecfe297..ef134a07ba 100644 --- a/engines/director/lingo/lingo-code.cpp +++ b/engines/director/lingo/lingo-code.cpp @@ -404,6 +404,10 @@ void Lingo::codeArg(Common::String &s) { g_lingo->code1(g_lingo->c_assign); } +void Lingo::c_call() { + warning("STUB: c_call()"); +} + void Lingo::c_procret() { warning("STUB: c_procret()"); } diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp index d3980bdc64..11f9de2459 100644 --- a/engines/director/lingo/lingo-gr.cpp +++ b/engines/director/lingo/lingo-gr.cpp @@ -418,18 +418,18 @@ union yyalloc #endif /* YYFINAL -- State number of the termination state. */ -#define YYFINAL 49 +#define YYFINAL 51 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 300 +#define YYLAST 315 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 51 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 20 +#define YYNNTS 21 /* YYNRULES -- Number of rules. */ -#define YYNRULES 72 +#define YYNRULES 76 /* YYNRULES -- Number of states. */ -#define YYNSTATES 148 +#define YYNSTATES 156 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 @@ -476,16 +476,16 @@ static const yytype_uint8 yytranslate[] = #if YYDEBUG /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */ -static const yytype_uint8 yyprhs[] = +static const yytype_uint16 yyprhs[] = { 0, 0, 3, 7, 10, 12, 13, 15, 17, 19, 21, 23, 25, 26, 31, 36, 41, 43, 45, 53, 64, 73, 85, 98, 100, 104, 108, 111, 115, 117, 118, 119, 120, 123, 126, 128, 130, 132, 136, 140, 144, 148, 152, 156, 160, 164, 168, 171, 174, 178, - 181, 184, 187, 189, 191, 194, 197, 200, 203, 207, - 210, 214, 217, 220, 222, 226, 229, 233, 234, 242, - 243, 245, 249 + 184, 187, 190, 193, 195, 197, 200, 203, 206, 209, + 213, 216, 220, 223, 226, 228, 232, 235, 239, 240, + 248, 249, 251, 255, 260, 261, 263 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ @@ -508,15 +508,16 @@ static const yytype_int8 yyrhs[] = 63, 42, 63, -1, 63, 43, 63, -1, 63, 48, 63, -1, 63, 49, 63, -1, 63, 38, 63, -1, 63, 33, 63, -1, 63, 34, 63, -1, 40, 63, - -1, 41, 63, -1, 46, 63, 47, -1, 20, 8, - -1, 21, 7, -1, 26, 63, -1, 65, -1, 13, - -1, 15, 18, -1, 15, 23, -1, 15, 25, -1, - 15, 66, -1, 15, 66, 67, -1, 15, 67, -1, - 30, 14, 8, -1, 14, 8, -1, 30, 8, -1, - 8, -1, 24, 22, 8, -1, 22, 8, -1, 30, - 22, 8, -1, -1, 19, 7, 69, 60, 70, 62, - 61, -1, -1, 7, -1, 70, 50, 7, -1, 70, - 50, 45, 7, -1 + -1, 41, 63, -1, 46, 63, 47, -1, 7, 60, + 46, 71, 47, -1, 20, 8, -1, 21, 7, -1, + 26, 63, -1, 65, -1, 13, -1, 15, 18, -1, + 15, 23, -1, 15, 25, -1, 15, 66, -1, 15, + 66, 67, -1, 15, 67, -1, 30, 14, 8, -1, + 14, 8, -1, 30, 8, -1, 8, -1, 24, 22, + 8, -1, 22, 8, -1, 30, 22, 8, -1, -1, + 19, 7, 69, 60, 70, 62, 61, -1, -1, 7, + -1, 70, 50, 7, -1, 70, 50, 45, 7, -1, + -1, 63, -1, 71, 50, 63, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ @@ -527,9 +528,9 @@ static const yytype_uint16 yyrline[] = 147, 158, 174, 188, 189, 190, 192, 194, 200, 202, 204, 206, 207, 208, 211, 216, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 236, - 237, 238, 239, 240, 251, 252, 253, 254, 259, 265, - 272, 273, 274, 275, 278, 279, 280, 308, 308, 314, - 315, 316, 317 + 242, 243, 244, 245, 246, 257, 258, 259, 260, 265, + 271, 278, 279, 280, 281, 284, 285, 286, 314, 314, + 320, 321, 322, 323, 326, 327, 328 }; #endif @@ -546,7 +547,8 @@ static const char *const yytname[] = "'*'", "'/'", "'%'", "'\\n'", "'('", "')'", "'>'", "'<'", "','", "$accept", "program", "programline", "asgn", "stmt", "cond", "repeatwhile", "repeatwith", "if", "begin", "end", "stmtlist", "expr", - "func", "gotofunc", "gotoframe", "gotomovie", "defn", "@1", "argdef", 0 + "func", "gotofunc", "gotoframe", "gotomovie", "defn", "@1", "argdef", + "arglist", 0 }; #endif @@ -572,9 +574,9 @@ static const yytype_uint8 yyr1[] = 55, 55, 55, 56, 56, 56, 57, 58, 59, 60, 61, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, - 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, - 66, 66, 66, 66, 67, 67, 67, 69, 68, 70, - 70, 70, 70 + 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, + 65, 66, 66, 66, 66, 67, 67, 67, 69, 68, + 70, 70, 70, 70, 71, 71, 71 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -584,10 +586,10 @@ static const yytype_uint8 yyr2[] = 1, 1, 0, 4, 4, 4, 1, 1, 7, 10, 8, 11, 12, 1, 3, 3, 2, 3, 1, 0, 0, 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, 7, 0, - 1, 3, 4 + 3, 3, 3, 3, 3, 3, 2, 2, 3, 5, + 2, 2, 2, 1, 1, 2, 2, 2, 2, 3, + 2, 3, 2, 2, 1, 3, 2, 3, 0, 7, + 0, 1, 3, 4, 0, 1, 3 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state @@ -595,57 +597,61 @@ static const yytype_uint8 yyr2[] = means the default is an error. */ static const yytype_uint8 yydefact[] = { - 0, 11, 34, 35, 53, 0, 28, 0, 0, 0, + 0, 11, 34, 35, 54, 0, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 9, - 0, 0, 0, 10, 7, 52, 6, 63, 0, 54, - 0, 55, 0, 56, 0, 57, 59, 67, 49, 50, - 0, 36, 51, 0, 26, 0, 46, 47, 0, 1, - 0, 3, 0, 0, 0, 0, 23, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 61, 65, 0, 62, - 0, 0, 0, 58, 29, 0, 0, 27, 0, 0, - 48, 2, 0, 30, 0, 0, 31, 0, 44, 45, - 43, 37, 38, 39, 40, 41, 42, 64, 60, 66, - 69, 13, 15, 14, 31, 0, 25, 30, 24, 70, - 31, 30, 0, 0, 32, 33, 0, 16, 17, 0, - 30, 0, 0, 30, 31, 0, 71, 0, 68, 0, - 30, 31, 30, 18, 72, 20, 31, 30, 0, 30, - 0, 0, 0, 0, 19, 0, 21, 22 + 0, 0, 0, 10, 7, 53, 6, 0, 64, 0, + 55, 0, 56, 0, 57, 0, 58, 60, 68, 50, + 51, 35, 0, 36, 52, 0, 26, 0, 46, 47, + 0, 1, 0, 3, 0, 0, 0, 0, 23, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 74, 62, + 66, 0, 63, 0, 0, 0, 59, 29, 0, 0, + 27, 0, 0, 48, 2, 0, 30, 0, 0, 31, + 0, 44, 45, 43, 37, 38, 39, 40, 41, 42, + 75, 0, 65, 61, 67, 70, 13, 15, 14, 31, + 0, 25, 30, 24, 49, 0, 71, 31, 30, 0, + 0, 32, 33, 0, 16, 17, 76, 0, 30, 0, + 0, 30, 31, 0, 72, 0, 69, 0, 30, 31, + 30, 18, 73, 20, 31, 30, 0, 30, 0, 0, + 0, 0, 19, 0, 21, 22 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int8 yydefgoto[] = { - -1, 16, 17, 41, 115, 55, 20, 21, 22, 100, - 105, 107, 117, 118, 25, 35, 36, 26, 74, 110 + -1, 16, 17, 43, 122, 57, 20, 21, 22, 27, + 110, 112, 124, 125, 25, 36, 37, 26, 77, 117, + 101 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -34 +#define YYPACT_NINF -43 static const yytype_int16 yypact[] = { - 69, -34, -34, -34, -34, 198, -34, -3, 24, 5, - -2, 15, 12, -2, -2, -2, 8, 111, 239, -34, - -12, 33, 2, 227, -34, -34, -34, -34, 28, -34, - 47, -34, 58, -34, 23, 51, -34, -34, -34, -34, - -2, -34, 162, 76, -34, -10, 87, 87, 203, -34, - 69, -34, 2, -2, 2, 57, 215, -2, -2, -2, - -2, -2, -2, -2, -2, -2, -34, -34, 84, -34, - 85, 86, 77, -34, -34, 162, 93, -34, -2, -2, - -34, -34, 54, 227, 55, 191, -34, -2, 227, 227, - 227, 251, 251, 87, 87, 227, 227, -34, -34, -34, - 97, -34, 227, 227, -34, 11, -34, 148, 227, -34, - 67, 148, 75, -2, -34, -34, 56, 227, -34, 4, - 148, 94, -2, 227, -34, 91, -34, 101, -34, 92, - 227, -34, 148, -34, -34, -34, -34, 148, 116, 148, - 117, 107, 121, 113, -34, 114, -34, -34 + 72, -43, -43, -42, -43, 213, -43, 9, 13, 18, + -2, 15, 22, -2, -2, -2, 32, 121, 254, -43, + -12, 12, 118, 242, -43, -43, -43, 4, -43, 49, + -43, 61, -43, 48, -43, 23, 11, -43, -43, -43, + -43, -43, -2, -43, 177, 67, -43, -19, 142, 142, + 218, -43, 72, -43, 118, -2, 118, 46, 230, -2, + -2, -2, -2, -2, -2, -2, -2, -2, -2, -43, + -43, 68, -43, 70, 75, 58, -43, -43, 177, 77, + -43, -2, -2, -43, -43, 39, 242, 42, 206, -43, + -2, 242, 242, 242, 266, 266, 142, 142, 242, 242, + 242, -38, -43, -43, -43, 87, -43, 242, 242, -43, + -3, -43, 158, 242, -43, -2, -43, 45, 158, 66, + -2, -43, -43, 37, 242, -43, 242, -5, 158, 85, + -2, 242, -43, 86, -43, 94, -43, 76, 242, -43, + 158, -43, -43, -43, -43, 158, 92, 158, 93, 90, + 95, 82, -43, 83, -43, -43 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { - -34, -15, -34, 1, 6, -27, -34, -34, -34, -34, - 60, -33, 0, 16, -34, -34, 99, -34, -34, -34 + -43, -9, -43, 1, 6, -26, -43, -43, -43, 34, + 69, -1, 0, 19, -43, -43, 78, -43, -43, -43, + -43 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If @@ -655,72 +661,74 @@ static const yytype_int8 yypgoto[] = #define YYTABLE_NINF -37 static const yytype_int16 yytable[] = { - 23, 18, 51, 2, 37, 3, 19, 2, 49, 3, - 42, 126, 39, 46, 47, 48, 24, 23, 18, 45, - 78, 112, 56, 19, 40, 82, 12, 84, 40, 79, - 12, 69, 38, 24, 52, 81, 66, 70, 13, 14, - 75, 113, 13, 14, 15, 71, 43, 44, 54, 127, - 23, 18, 56, 83, 85, 67, 19, 88, 89, 90, - 91, 92, 93, 94, 95, 96, 24, 124, 125, -5, - 1, 111, 53, 30, 2, 32, 3, 120, 102, 103, - 68, 72, 4, 77, 5, 6, 86, 108, 7, 8, - 9, 132, 97, 98, 99, 10, 11, 12, 137, 71, - 101, 104, 106, 139, 109, 122, 129, 133, 134, 13, - 14, -4, 1, 123, -5, 15, 2, 119, 3, 135, - 57, 58, 130, 144, 4, 59, 5, 6, 141, 143, - 7, 8, 9, 145, 73, 64, 65, 10, 11, 12, - 146, 147, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 13, 14, 2, 0, 3, 50, 15, 0, 0, - 0, 4, 0, 5, 6, 0, 0, 116, 8, 9, - 0, 121, 0, 0, 10, 11, 12, 0, 0, 76, - 128, 0, 0, 131, 0, 0, 0, 0, 13, 14, - 136, 0, 138, 114, 15, 57, 58, 140, 0, 142, - 59, 0, 60, 61, 62, 63, 27, 0, 0, 0, - 64, 65, 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, -36, -36, 0, 64, 65, -36, 0, 0, - 0, -36, -36, 0, 57, 58, 0, -36, -36, 59, - 0, 0, 0, 62, 63, 0, 0, 0, 0, 64, - 65 + 23, 18, 134, 2, -29, 41, 19, 119, 53, 114, + 44, 81, 115, 48, 49, 50, 38, 23, 18, 24, + 82, 39, 58, 19, 42, 40, 12, 120, 85, 47, + 87, 72, 51, 31, 54, 33, 24, 73, 13, 14, + 135, 75, 78, 84, 15, 74, 45, 46, 132, 133, + 68, 55, 23, 18, 58, 86, 88, 69, 19, 91, + 92, 93, 94, 95, 96, 97, 98, 99, 100, 70, + 71, 24, -5, 1, 80, 89, 102, 2, 103, 3, + 74, 107, 108, 104, 106, 4, 109, 5, 6, 111, + 113, 7, 8, 9, 116, 127, 130, 137, 10, 11, + 12, 142, 141, 143, 149, 151, 152, 153, 118, 154, + 155, 105, 13, 14, 76, 126, 128, -5, 15, 0, + 131, -4, 1, 2, 0, 41, 2, 0, 3, 0, + 138, 140, 0, 0, 4, 0, 5, 6, 145, 0, + 7, 8, 9, 147, 42, 0, 12, 10, 11, 12, + 0, 0, 0, 0, 0, 0, 0, 0, 13, 14, + 0, 13, 14, 2, 56, 3, 52, 15, 0, 0, + 0, 4, 0, 5, 6, 59, 60, 0, 8, 9, + 61, 123, 0, 0, 10, 11, 12, 129, 0, 0, + 66, 67, 0, 0, 79, 0, 0, 136, 13, 14, + 139, 0, 0, 121, 15, 0, 0, 144, 0, 146, + 59, 60, 0, 0, 148, 61, 150, 62, 63, 64, + 65, 28, 0, 0, 0, 66, 67, 29, 0, 0, + 0, 30, 0, 0, 0, 31, 32, 33, 34, 59, + 60, 0, 0, 35, 61, 90, 62, 63, 64, 65, + 0, 59, 60, 83, 66, 67, 61, 0, 62, 63, + 64, 65, 0, 59, 60, 83, 66, 67, 61, 90, + 62, 63, 64, 65, 0, 59, 60, 0, 66, 67, + 61, 0, 62, 63, 64, 65, 0, -36, -36, 0, + 66, 67, -36, 0, 0, 0, -36, -36, 0, 59, + 60, 0, -36, -36, 61, 0, 0, 0, 64, 65, + 0, 0, 0, 0, 66, 67 }; static const yytype_int16 yycheck[] = { - 0, 0, 17, 5, 7, 7, 0, 5, 0, 7, - 10, 7, 7, 13, 14, 15, 0, 17, 17, 7, - 30, 10, 22, 17, 26, 52, 28, 54, 26, 39, - 28, 8, 8, 17, 46, 50, 8, 14, 40, 41, - 40, 30, 40, 41, 46, 22, 31, 32, 46, 45, - 50, 50, 52, 53, 54, 8, 50, 57, 58, 59, - 60, 61, 62, 63, 64, 65, 50, 11, 12, 0, - 1, 104, 39, 22, 5, 24, 7, 110, 78, 79, - 22, 30, 13, 7, 15, 16, 29, 87, 19, 20, - 21, 124, 8, 8, 8, 26, 27, 28, 131, 22, - 7, 47, 47, 136, 7, 30, 12, 16, 7, 40, - 41, 0, 1, 113, 45, 46, 5, 50, 7, 27, - 33, 34, 122, 16, 13, 38, 15, 16, 12, 12, - 19, 20, 21, 12, 35, 48, 49, 26, 27, 28, - 27, 27, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 40, 41, 5, -1, 7, 45, 46, -1, -1, - -1, 13, -1, 15, 16, -1, -1, 107, 20, 21, - -1, 111, -1, -1, 26, 27, 28, -1, -1, 17, - 120, -1, -1, 123, -1, -1, -1, -1, 40, 41, - 130, -1, 132, 45, 46, 33, 34, 137, -1, 139, - 38, -1, 40, 41, 42, 43, 8, -1, -1, -1, - 48, 49, 14, -1, -1, -1, 18, -1, -1, -1, - 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, 42, 43, -1, 33, 34, -1, 48, 49, 38, - -1, -1, -1, 42, 43, -1, -1, -1, -1, 48, - 49 + 0, 0, 7, 5, 46, 7, 0, 10, 17, 47, + 10, 30, 50, 13, 14, 15, 7, 17, 17, 0, + 39, 8, 22, 17, 26, 7, 28, 30, 54, 7, + 56, 8, 0, 22, 46, 24, 17, 14, 40, 41, + 45, 30, 42, 52, 46, 22, 31, 32, 11, 12, + 46, 39, 52, 52, 54, 55, 56, 8, 52, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 8, + 22, 52, 0, 1, 7, 29, 8, 5, 8, 7, + 22, 81, 82, 8, 7, 13, 47, 15, 16, 47, + 90, 19, 20, 21, 7, 50, 30, 12, 26, 27, + 28, 7, 16, 27, 12, 12, 16, 12, 109, 27, + 27, 77, 40, 41, 36, 115, 117, 45, 46, -1, + 120, 0, 1, 5, -1, 7, 5, -1, 7, -1, + 130, 132, -1, -1, 13, -1, 15, 16, 139, -1, + 19, 20, 21, 144, 26, -1, 28, 26, 27, 28, + -1, -1, -1, -1, -1, -1, -1, -1, 40, 41, + -1, 40, 41, 5, 46, 7, 45, 46, -1, -1, + -1, 13, -1, 15, 16, 33, 34, -1, 20, 21, + 38, 112, -1, -1, 26, 27, 28, 118, -1, -1, + 48, 49, -1, -1, 17, -1, -1, 128, 40, 41, + 131, -1, -1, 45, 46, -1, -1, 138, -1, 140, + 33, 34, -1, -1, 145, 38, 147, 40, 41, 42, + 43, 8, -1, -1, -1, 48, 49, 14, -1, -1, + -1, 18, -1, -1, -1, 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, 42, 43, -1, 33, + 34, -1, 48, 49, 38, -1, -1, -1, 42, 43, + -1, -1, -1, -1, 48, 49 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing @@ -729,19 +737,20 @@ static const yytype_uint8 yystos[] = { 0, 1, 5, 7, 13, 15, 16, 19, 20, 21, 26, 27, 28, 40, 41, 46, 52, 53, 54, 55, - 57, 58, 59, 63, 64, 65, 68, 8, 14, 18, - 22, 23, 24, 25, 30, 66, 67, 7, 8, 7, - 26, 54, 63, 31, 32, 7, 63, 63, 63, 0, - 45, 52, 46, 39, 46, 56, 63, 33, 34, 38, - 40, 41, 42, 43, 48, 49, 8, 8, 22, 8, - 14, 22, 30, 67, 69, 63, 17, 7, 30, 39, - 47, 52, 56, 63, 56, 63, 29, 39, 63, 63, - 63, 63, 63, 63, 63, 63, 63, 8, 8, 8, - 60, 7, 63, 63, 47, 61, 47, 62, 63, 7, - 70, 62, 10, 30, 45, 55, 61, 63, 64, 50, - 62, 61, 30, 63, 11, 12, 7, 45, 61, 12, - 63, 61, 62, 16, 7, 27, 61, 62, 61, 62, - 61, 12, 61, 12, 16, 12, 27, 27 + 57, 58, 59, 63, 64, 65, 68, 60, 8, 14, + 18, 22, 23, 24, 25, 30, 66, 67, 7, 8, + 7, 7, 26, 54, 63, 31, 32, 7, 63, 63, + 63, 0, 45, 52, 46, 39, 46, 56, 63, 33, + 34, 38, 40, 41, 42, 43, 48, 49, 46, 8, + 8, 22, 8, 14, 22, 30, 67, 69, 63, 17, + 7, 30, 39, 47, 52, 56, 63, 56, 63, 29, + 39, 63, 63, 63, 63, 63, 63, 63, 63, 63, + 63, 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, 50, 62, 61, + 30, 63, 11, 12, 7, 45, 61, 12, 63, 61, + 62, 16, 7, 27, 61, 62, 61, 62, 61, 12, + 61, 12, 16, 12, 27, 27 }; #define yyerrok (yyerrstatus = 0) @@ -1793,41 +1802,51 @@ yyreduce: case 49: #line 236 "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); ;} + { + g_lingo->code1(g_lingo->c_call); + g_lingo->codeString((yyvsp[(1) - (5)].s)->c_str()); + inst numpar = 0; + WRITE_UINT32(&numpar, (yyvsp[(4) - (5)].narg)); + g_lingo->code1(numpar); ;} break; case 50: -#line 237 "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); ;} +#line 242 "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 51: -#line 238 "engines/director/lingo/lingo-gr.y" +#line 243 "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 52: +#line 244 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_printtop); ;} break; - case 53: -#line 240 "engines/director/lingo/lingo-gr.y" + case 54: +#line 246 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_exit); ;} break; - case 54: -#line 251 "engines/director/lingo/lingo-gr.y" + case 55: +#line 257 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_gotoloop); ;} break; - case 55: -#line 252 "engines/director/lingo/lingo-gr.y" + case 56: +#line 258 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_gotonext); ;} break; - case 56: -#line 253 "engines/director/lingo/lingo-gr.y" + case 57: +#line 259 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_gotoprevious); ;} break; - case 57: -#line 254 "engines/director/lingo/lingo-gr.y" + case 58: +#line 260 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); @@ -1835,8 +1854,8 @@ yyreduce: delete (yyvsp[(2) - (2)].s); ;} break; - case 58: -#line 259 "engines/director/lingo/lingo-gr.y" + case 59: +#line 265 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str()); @@ -1845,8 +1864,8 @@ yyreduce: delete (yyvsp[(3) - (3)].s); ;} break; - case 59: -#line 265 "engines/director/lingo/lingo-gr.y" + case 60: +#line 271 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString(""); @@ -1854,77 +1873,92 @@ yyreduce: delete (yyvsp[(2) - (2)].s); ;} break; - case 60: -#line 272 "engines/director/lingo/lingo-gr.y" + case 61: +#line 278 "engines/director/lingo/lingo-gr.y" { (yyval.s) = (yyvsp[(3) - (3)].s); ;} break; - case 61: -#line 273 "engines/director/lingo/lingo-gr.y" + case 62: +#line 279 "engines/director/lingo/lingo-gr.y" { (yyval.s) = (yyvsp[(2) - (2)].s); ;} break; - case 62: -#line 274 "engines/director/lingo/lingo-gr.y" + case 63: +#line 280 "engines/director/lingo/lingo-gr.y" { (yyval.s) = (yyvsp[(2) - (2)].s); ;} break; - case 63: -#line 275 "engines/director/lingo/lingo-gr.y" + case 64: +#line 281 "engines/director/lingo/lingo-gr.y" { (yyval.s) = (yyvsp[(1) - (1)].s); ;} break; - case 64: -#line 278 "engines/director/lingo/lingo-gr.y" + case 65: +#line 284 "engines/director/lingo/lingo-gr.y" { (yyval.s) = (yyvsp[(3) - (3)].s); ;} break; - case 65: -#line 279 "engines/director/lingo/lingo-gr.y" + case 66: +#line 285 "engines/director/lingo/lingo-gr.y" { (yyval.s) = (yyvsp[(2) - (2)].s); ;} break; - case 66: -#line 280 "engines/director/lingo/lingo-gr.y" + case 67: +#line 286 "engines/director/lingo/lingo-gr.y" { (yyval.s) = (yyvsp[(3) - (3)].s); ;} break; - case 67: -#line 308 "engines/director/lingo/lingo-gr.y" + case 68: +#line 314 "engines/director/lingo/lingo-gr.y" { g_lingo->_indef = true; ;} break; - case 68: -#line 309 "engines/director/lingo/lingo-gr.y" + case 69: +#line 315 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_procret); g_lingo->define(*(yyvsp[(2) - (7)].s), (yyvsp[(4) - (7)].code), (yyvsp[(7) - (7)].code), (yyvsp[(5) - (7)].narg)); g_lingo->_indef = false; ;} break; - case 69: -#line 314 "engines/director/lingo/lingo-gr.y" + case 70: +#line 320 "engines/director/lingo/lingo-gr.y" { (yyval.narg) = 0; ;} break; - case 70: -#line 315 "engines/director/lingo/lingo-gr.y" + case 71: +#line 321 "engines/director/lingo/lingo-gr.y" { g_lingo->codeArg(*(yyvsp[(1) - (1)].s)); delete (yyvsp[(1) - (1)].s); (yyval.narg) = 1; ;} break; - case 71: -#line 316 "engines/director/lingo/lingo-gr.y" + case 72: +#line 322 "engines/director/lingo/lingo-gr.y" { g_lingo->codeArg(*(yyvsp[(3) - (3)].s)); delete (yyvsp[(3) - (3)].s); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;} break; - case 72: -#line 317 "engines/director/lingo/lingo-gr.y" + case 73: +#line 323 "engines/director/lingo/lingo-gr.y" { g_lingo->codeArg(*(yyvsp[(4) - (4)].s)); delete (yyvsp[(4) - (4)].s); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;} break; + case 74: +#line 326 "engines/director/lingo/lingo-gr.y" + { (yyval.narg) = 0; ;} + break; + + case 75: +#line 327 "engines/director/lingo/lingo-gr.y" + { (yyval.narg) = 1; ;} + break; + + case 76: +#line 328 "engines/director/lingo/lingo-gr.y" + { (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;} + break; + /* Line 1267 of yacc.c. */ -#line 1928 "engines/director/lingo/lingo-gr.cpp" +#line 1962 "engines/director/lingo/lingo-gr.cpp" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -2138,6 +2172,6 @@ yyreturn: } -#line 321 "engines/director/lingo/lingo-gr.y" +#line 331 "engines/director/lingo/lingo-gr.y" diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y index 5b02796be3..bd64f93c20 100644 --- a/engines/director/lingo/lingo-gr.y +++ b/engines/director/lingo/lingo-gr.y @@ -80,7 +80,7 @@ using namespace Director; %type<code> asgn begin cond end expr if repeatwhile repeatwith stmtlist %type<s> gotoframe gotomovie -%type<narg> argdef +%type<narg> argdef arglist %right '=' %left '+' '-' @@ -233,7 +233,13 @@ expr: INT { | '(' expr ')' { $$ = $2; } ; -func: tMCI STRING { g_lingo->code1(g_lingo->c_mci); g_lingo->codeString($2->c_str()); delete $2; } +func: ID begin '(' arglist ')' { + g_lingo->code1(g_lingo->c_call); + g_lingo->codeString($1->c_str()); + inst numpar = 0; + WRITE_UINT32(&numpar, $4); + g_lingo->code1(numpar); }; + | tMCI STRING { g_lingo->code1(g_lingo->c_mci); g_lingo->codeString($2->c_str()); delete $2; } | tMCIWAIT ID { g_lingo->code1(g_lingo->c_mciwait); g_lingo->codeString($2->c_str()); delete $2; } | tPUT expr { g_lingo->code1(g_lingo->c_printtop); } | gotofunc @@ -311,11 +317,15 @@ defn: tMACRO ID { g_lingo->_indef = true; } g_lingo->define(*$2, $4, $7, $5); g_lingo->_indef = false; } ; -argdef: /* nothing */ { $$ = 0; } +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; } ; +arglist: /* nothing */ { $$ = 0; } + | expr { $$ = 1; } + | arglist ',' expr { $$ = $1 + 1; } + ; %% diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h index 519b9141b6..bee947931b 100644 --- a/engines/director/lingo/lingo.h +++ b/engines/director/lingo/lingo.h @@ -146,6 +146,7 @@ public: static void c_lt(); static void c_ge(); static void c_le(); + static void c_call(); static void c_procret(); static void c_exit(); |