From 46d60a794170489f4db8fdd3be5f8ee373b397ec Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 21 Jun 2016 11:50:08 +0200 Subject: DIRECTOR: Lingo: Implement 'repeat while' control keyword --- engines/director/lingo/lingo-gr.cpp | 488 +++++++++++++++++++----------------- 1 file changed, 253 insertions(+), 235 deletions(-) (limited to 'engines/director/lingo/lingo-gr.cpp') diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp index 7d7bf1d41c..17109efb66 100644 --- a/engines/director/lingo/lingo-gr.cpp +++ b/engines/director/lingo/lingo-gr.cpp @@ -86,15 +86,17 @@ tOF = 275, tPREVIOUS = 276, tPUT = 277, - tSET = 278, - tTHEN = 279, - tTO = 280, - tGE = 281, - tLE = 282, - tGT = 283, - tLT = 284, - tEQ = 285, - tNEQ = 286 + tREPEAT = 278, + tSET = 279, + tTHEN = 280, + tTO = 281, + tWHILE = 282, + tGE = 283, + tLE = 284, + tGT = 285, + tLT = 286, + tEQ = 287, + tNEQ = 288 }; #endif /* Tokens. */ @@ -118,15 +120,17 @@ #define tOF 275 #define tPREVIOUS 276 #define tPUT 277 -#define tSET 278 -#define tTHEN 279 -#define tTO 280 -#define tGE 281 -#define tLE 282 -#define tGT 283 -#define tLT 284 -#define tEQ 285 -#define tNEQ 286 +#define tREPEAT 278 +#define tSET 279 +#define tTHEN 280 +#define tTO 281 +#define tWHILE 282 +#define tGE 283 +#define tLE 284 +#define tGT 285 +#define tLT 286 +#define tEQ 287 +#define tNEQ 288 @@ -177,7 +181,7 @@ typedef union YYSTYPE int code; } /* Line 193 of yacc.c. */ -#line 181 "engines/director/lingo/lingo-gr.cpp" +#line 185 "engines/director/lingo/lingo-gr.cpp" YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 @@ -190,7 +194,7 @@ typedef union YYSTYPE /* Line 216 of yacc.c. */ -#line 194 "engines/director/lingo/lingo-gr.cpp" +#line 198 "engines/director/lingo/lingo-gr.cpp" #ifdef short # undef short @@ -403,22 +407,22 @@ union yyalloc #endif /* YYFINAL -- State number of the termination state. */ -#define YYFINAL 40 +#define YYFINAL 43 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 205 +#define YYLAST 178 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 43 +#define YYNTOKENS 45 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 14 +#define YYNNTS 15 /* YYNRULES -- Number of rules. */ -#define YYNRULES 56 +#define YYNRULES 58 /* YYNRULES -- Number of states. */ -#define YYNSTATES 101 +#define YYNSTATES 111 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 286 +#define YYMAXUTOK 288 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) @@ -427,12 +431,12 @@ union yyalloc static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 38, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 40, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 37, 2, 2, - 41, 42, 35, 33, 2, 34, 2, 36, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 39, 2, 2, + 41, 42, 37, 35, 2, 36, 2, 38, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 40, 32, 39, 2, 2, 2, 2, 2, 2, 2, + 44, 34, 43, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -454,7 +458,7 @@ static const yytype_uint8 yytranslate[] = 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31 + 25, 26, 27, 28, 29, 30, 31, 32, 33 }; #if YYDEBUG @@ -463,46 +467,47 @@ static const yytype_uint8 yytranslate[] = static const yytype_uint8 yyprhs[] = { 0, 0, 3, 7, 9, 10, 12, 14, 16, 18, - 20, 21, 26, 31, 36, 38, 46, 57, 59, 61, - 63, 67, 71, 75, 79, 83, 87, 91, 95, 99, - 102, 105, 109, 111, 115, 119, 121, 122, 123, 126, - 129, 132, 135, 138, 140, 143, 146, 149, 152, 156, - 159, 163, 166, 169, 171, 175, 178 + 20, 21, 26, 31, 36, 38, 46, 57, 66, 68, + 72, 76, 79, 81, 82, 83, 86, 89, 91, 93, + 95, 99, 103, 107, 111, 115, 119, 123, 127, 131, + 134, 137, 141, 144, 147, 150, 152, 155, 158, 161, + 164, 168, 171, 175, 178, 181, 183, 187, 190 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int8 yyrhs[] = { - 44, 0, -1, 45, 38, 44, -1, 45, -1, -1, - 53, -1, 46, -1, 47, -1, 48, -1, 1, -1, - -1, 22, 48, 14, 7, -1, 23, 7, 32, 48, - -1, 23, 7, 25, 48, -1, 48, -1, 50, 49, - 24, 52, 51, 11, 9, -1, 50, 49, 24, 52, - 51, 10, 52, 51, 11, 9, -1, 5, -1, 7, - -1, 46, -1, 48, 33, 48, -1, 48, 34, 48, - -1, 48, 35, 48, -1, 48, 36, 48, -1, 48, - 39, 48, -1, 48, 40, 48, -1, 48, 31, 48, - -1, 48, 26, 48, -1, 48, 27, 48, -1, 33, - 48, -1, 34, 48, -1, 41, 48, 42, -1, 48, - -1, 48, 32, 48, -1, 41, 49, 42, -1, 9, - -1, -1, -1, 52, 38, -1, 52, 47, -1, 16, - 8, -1, 17, 7, -1, 22, 48, -1, 54, -1, - 13, 15, -1, 13, 19, -1, 13, 21, -1, 13, - 55, -1, 13, 55, 56, -1, 13, 56, -1, 25, - 12, 8, -1, 12, 8, -1, 25, 8, -1, 8, - -1, 20, 18, 8, -1, 18, 8, -1, 25, 18, - 8, -1 + 46, 0, -1, 47, 40, 46, -1, 47, -1, -1, + 56, -1, 48, -1, 49, -1, 55, -1, 1, -1, + -1, 22, 55, 14, 7, -1, 24, 7, 34, 55, + -1, 24, 7, 26, 55, -1, 55, -1, 52, 50, + 25, 54, 53, 11, 9, -1, 52, 50, 25, 54, + 53, 10, 54, 53, 11, 9, -1, 51, 41, 50, + 42, 54, 53, 11, 23, -1, 55, -1, 55, 34, + 55, -1, 41, 50, 42, -1, 23, 27, -1, 9, + -1, -1, -1, 54, 40, -1, 54, 49, -1, 5, + -1, 7, -1, 48, -1, 55, 35, 55, -1, 55, + 36, 55, -1, 55, 37, 55, -1, 55, 38, 55, + -1, 55, 43, 55, -1, 55, 44, 55, -1, 55, + 33, 55, -1, 55, 28, 55, -1, 55, 29, 55, + -1, 35, 55, -1, 36, 55, -1, 41, 55, 42, + -1, 16, 8, -1, 17, 7, -1, 22, 55, -1, + 57, -1, 13, 15, -1, 13, 19, -1, 13, 21, + -1, 13, 58, -1, 13, 58, 59, -1, 13, 59, + -1, 26, 12, 8, -1, 12, 8, -1, 26, 8, + -1, 8, -1, 20, 18, 8, -1, 18, 8, -1, + 26, 18, 8, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint8 yyrline[] = { 0, 90, 90, 91, 94, 95, 96, 97, 98, 99, - 100, 103, 104, 105, 108, 109, 115, 125, 126, 127, - 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, - 138, 139, 142, 143, 144, 146, 148, 150, 151, 152, - 155, 156, 157, 158, 169, 170, 171, 172, 173, 174, - 177, 178, 179, 180, 183, 184, 185 + 100, 103, 104, 105, 108, 109, 115, 127, 135, 136, + 137, 139, 141, 143, 145, 146, 147, 150, 151, 152, + 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, + 163, 164, 167, 168, 169, 170, 181, 182, 183, 184, + 185, 186, 189, 190, 191, 192, 195, 196, 197 }; #endif @@ -514,10 +519,11 @@ static const char *const yytname[] = "$end", "error", "$undefined", "UNARY", "VOID", "INT", "FLOAT", "VAR", "STRING", "tIF", "tELSE", "tEND", "tFRAME", "tGO", "tINTO", "tLOOP", "tMCI", "tMCIWAIT", "tMOVIE", "tNEXT", "tOF", "tPREVIOUS", "tPUT", - "tSET", "tTHEN", "tTO", "tGE", "tLE", "tGT", "tLT", "tEQ", "tNEQ", "'='", - "'+'", "'-'", "'*'", "'/'", "'%'", "'\\n'", "'>'", "'<'", "'('", "')'", - "$accept", "program", "programline", "asgn", "stmt", "expr", "cond", - "if", "end", "stmtlist", "func", "gotofunc", "gotoframe", "gotomovie", 0 + "tREPEAT", "tSET", "tTHEN", "tTO", "tWHILE", "tGE", "tLE", "tGT", "tLT", + "tEQ", "tNEQ", "'='", "'+'", "'-'", "'*'", "'/'", "'%'", "'\\n'", "'('", + "')'", "'>'", "'<'", "$accept", "program", "programline", "asgn", "stmt", + "cond", "while", "if", "end", "stmtlist", "expr", "func", "gotofunc", + "gotoframe", "gotomovie", 0 }; #endif @@ -529,31 +535,31 @@ static const yytype_uint16 yytoknum[] = 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 61, 43, 45, 42, 47, 37, 10, 62, - 60, 40, 41 + 285, 286, 287, 288, 61, 43, 45, 42, 47, 37, + 10, 40, 41, 62, 60 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { - 0, 43, 44, 44, 45, 45, 45, 45, 45, 45, - 45, 46, 46, 46, 47, 47, 47, 48, 48, 48, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 49, 49, 49, 50, 51, 52, 52, 52, - 53, 53, 53, 53, 54, 54, 54, 54, 54, 54, - 55, 55, 55, 55, 56, 56, 56 + 0, 45, 46, 46, 47, 47, 47, 47, 47, 47, + 47, 48, 48, 48, 49, 49, 49, 49, 50, 50, + 50, 51, 52, 53, 54, 54, 54, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 56, 56, 56, 56, 57, 57, 57, 57, + 57, 57, 58, 58, 58, 58, 59, 59, 59 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { 0, 2, 3, 1, 0, 1, 1, 1, 1, 1, - 0, 4, 4, 4, 1, 7, 10, 1, 1, 1, + 0, 4, 4, 4, 1, 7, 10, 8, 1, 3, + 3, 2, 1, 0, 0, 2, 2, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, - 2, 3, 1, 3, 3, 1, 0, 0, 2, 2, - 2, 2, 2, 1, 2, 2, 2, 2, 3, 2, - 3, 2, 2, 1, 3, 2, 3 + 2, 3, 2, 2, 2, 1, 2, 2, 2, 2, + 3, 2, 3, 2, 2, 1, 3, 2, 3 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state @@ -561,49 +567,51 @@ static const yytype_uint8 yyr2[] = means the default is an error. */ static const yytype_uint8 yydefact[] = { - 0, 9, 17, 18, 35, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 3, 19, 7, 8, 0, 5, - 43, 53, 0, 44, 0, 45, 0, 46, 0, 47, - 49, 40, 41, 0, 19, 42, 0, 29, 30, 0, - 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 32, 0, 51, 55, 0, 52, 0, 0, - 0, 48, 0, 0, 0, 0, 31, 2, 27, 28, - 26, 20, 21, 22, 23, 24, 25, 0, 0, 0, - 37, 54, 50, 56, 11, 13, 12, 34, 33, 36, - 38, 39, 14, 0, 37, 0, 36, 15, 0, 0, + 0, 9, 27, 28, 22, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 3, 29, 7, 0, 0, + 8, 5, 45, 55, 0, 46, 0, 47, 0, 48, + 0, 49, 51, 42, 43, 0, 29, 44, 21, 0, + 39, 40, 0, 1, 0, 0, 0, 0, 18, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 53, 57, + 0, 54, 0, 0, 0, 50, 0, 0, 0, 0, + 41, 2, 0, 0, 0, 24, 0, 37, 38, 36, + 30, 31, 32, 33, 34, 35, 56, 52, 58, 11, + 13, 12, 24, 20, 23, 19, 23, 25, 26, 0, + 14, 0, 24, 0, 0, 23, 15, 17, 0, 0, 16 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int8 yydefgoto[] = { - -1, 13, 14, 34, 16, 17, 53, 18, 93, 89, - 19, 20, 29, 30 + -1, 14, 15, 36, 98, 47, 18, 19, 99, 94, + 100, 21, 22, 31, 32 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -42 +#define YYPACT_NINF -61 static const yytype_int16 yypact[] = { - 45, -42, -42, -42, -42, 107, 0, 5, 70, 9, - 70, 70, 70, 7, -7, 11, -42, 148, 90, -42, - -42, -42, 22, -42, 24, -42, 15, -42, -3, -1, - -42, -42, -42, 70, -42, -13, 19, 165, 165, 120, - -42, 45, 70, 70, 70, 70, 70, 70, 70, 70, - 70, 90, 137, 29, -42, -42, 51, -42, 52, 55, - 46, -42, -13, 58, 70, 70, -42, -42, 148, 148, - 148, 159, 159, 165, 165, 148, 148, 103, 27, 70, - -42, -42, -42, -42, -42, 148, 148, -42, 148, 67, - -42, -42, 148, 18, -42, 57, 67, -42, 59, 64, - -42 + 58, -61, -61, -61, -61, 10, 26, -5, 2, 34, + 59, 2, 2, 2, 73, 44, 1, -61, 45, 65, + 122, -61, -61, -61, 77, -61, 96, -61, 90, -61, + 15, 150, -61, -61, -61, 2, -61, 74, -61, 71, + 134, 134, 98, -61, 58, 65, 65, 88, 110, 2, + 2, 2, 2, 2, 2, 2, 2, 2, -61, -61, + 108, -61, 117, 124, 119, -61, 74, 142, 2, 2, + -61, -61, 114, 127, 86, -61, 2, 122, 122, 122, + -23, -23, 134, 134, 122, 122, -61, -61, -61, -61, + 122, 122, -61, -61, 55, 122, 55, -61, -61, 6, + 122, 141, -61, 152, 148, 55, -61, -61, 153, 163, + -61 }; /* YYPGOTO[NTERM-NUM]. */ -static const yytype_int8 yypgoto[] = +static const yytype_int16 yypgoto[] = { - -42, 39, -42, 6, -41, -8, 31, -42, -12, -9, - -42, -42, -42, 62 + -61, 129, -61, 3, 4, -6, -61, -61, -13, -60, + 0, -61, -61, -61, 143 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If @@ -613,52 +621,46 @@ static const yytype_int8 yypgoto[] = #define YYTABLE_NINF -7 static const yytype_int8 yytable[] = { - 35, 63, 37, 38, 39, 57, 15, 40, 31, 58, - 52, -6, 32, 42, 43, 59, 36, 24, 44, 26, - 45, 46, 47, 48, 60, 62, 49, 50, 94, 95, - 54, 41, 55, 56, 68, 69, 70, 71, 72, 73, - 74, 75, 76, 77, 64, -4, 1, 15, 91, -6, - 2, 65, 3, 80, 4, 91, 85, 86, 5, 81, - 82, 6, 7, 83, 59, 84, 97, 8, 9, 87, - 99, 88, 2, 100, 3, 2, 4, 3, 10, 11, - 67, 92, 78, -4, 98, 96, 12, 0, 92, 33, - 9, 61, 33, 9, 0, 2, 0, 3, 0, 0, - 10, 11, 0, 10, 11, 90, 0, 0, 12, 0, - 0, 12, 33, 9, 0, 21, 0, 0, 0, 22, - 0, 0, 23, 10, 11, 24, 25, 26, 27, 42, - 43, 51, 28, 0, 44, 79, 45, 46, 47, 48, - 0, 0, 49, 50, 0, 66, 42, 43, 0, 0, - 0, 44, 0, 45, 46, 47, 48, 0, 0, 49, - 50, 0, 66, 42, 43, 0, 0, 0, 44, 79, - 45, 46, 47, 48, 42, 43, 49, 50, 0, 44, - 0, 45, 46, 47, 48, 42, 43, 49, 50, 0, - 44, 42, 43, 0, 47, 48, 44, 0, 49, 50, - 0, 0, 0, 0, 49, 50 + 20, -6, 34, 16, 17, 49, 50, 2, 37, 3, + 51, 40, 41, 42, 54, 55, 102, 103, 23, 48, + 56, 57, 24, 61, 35, 25, 10, 62, 26, 27, + 28, 29, 96, 63, 33, 66, 30, 11, 12, 72, + 73, -6, 105, 13, 20, 48, 74, 16, 17, 77, + 78, 79, 80, 81, 82, 83, 84, 85, -4, 1, + 2, 38, 3, 2, 4, 3, 39, 4, 90, 91, + 2, 5, 3, 43, 6, 7, 95, 35, 9, 10, + 8, 9, 10, 101, 44, 58, 45, 35, 67, 10, + 11, 12, 108, 11, 12, 97, 13, 68, -4, 13, + 11, 12, 49, 50, 59, 69, 46, 51, 60, 52, + 53, 54, 55, 75, 49, 50, 86, 56, 57, 51, + 76, 52, 53, 54, 55, 87, 49, 50, 70, 56, + 57, 51, 88, 52, 53, 54, 55, 63, 49, 50, + 70, 56, 57, 51, 76, 52, 53, 54, 55, 89, + 49, 50, 104, 56, 57, 51, 92, 52, 53, 54, + 55, 106, 49, 50, 109, 56, 57, 51, 26, 93, + 28, 107, 110, 71, 65, 0, 64, 56, 57 }; static const yytype_int8 yycheck[] = { - 8, 14, 10, 11, 12, 8, 0, 0, 8, 12, - 18, 0, 7, 26, 27, 18, 7, 18, 31, 20, - 33, 34, 35, 36, 25, 33, 39, 40, 10, 11, - 8, 38, 8, 18, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 25, 0, 1, 41, 89, 38, - 5, 32, 7, 24, 9, 96, 64, 65, 13, 8, - 8, 16, 17, 8, 18, 7, 9, 22, 23, 42, - 11, 79, 5, 9, 7, 5, 9, 7, 33, 34, - 41, 89, 51, 38, 96, 94, 41, -1, 96, 22, - 23, 29, 22, 23, -1, 5, -1, 7, -1, -1, - 33, 34, -1, 33, 34, 38, -1, -1, 41, -1, - -1, 41, 22, 23, -1, 8, -1, -1, -1, 12, - -1, -1, 15, 33, 34, 18, 19, 20, 21, 26, - 27, 41, 25, -1, 31, 32, 33, 34, 35, 36, - -1, -1, 39, 40, -1, 42, 26, 27, -1, -1, - -1, 31, -1, 33, 34, 35, 36, -1, -1, 39, - 40, -1, 42, 26, 27, -1, -1, -1, 31, 32, - 33, 34, 35, 36, 26, 27, 39, 40, -1, 31, - -1, 33, 34, 35, 36, 26, 27, 39, 40, -1, - 31, 26, 27, -1, 35, 36, 31, -1, 39, 40, - -1, -1, -1, -1, 39, 40 + 0, 0, 7, 0, 0, 28, 29, 5, 8, 7, + 33, 11, 12, 13, 37, 38, 10, 11, 8, 19, + 43, 44, 12, 8, 22, 15, 24, 12, 18, 19, + 20, 21, 92, 18, 8, 35, 26, 35, 36, 45, + 46, 40, 102, 41, 44, 45, 46, 44, 44, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 0, 1, + 5, 27, 7, 5, 9, 7, 7, 9, 68, 69, + 5, 13, 7, 0, 16, 17, 76, 22, 23, 24, + 22, 23, 24, 96, 40, 8, 41, 22, 14, 24, + 35, 36, 105, 35, 36, 40, 41, 26, 40, 41, + 35, 36, 28, 29, 8, 34, 41, 33, 18, 35, + 36, 37, 38, 25, 28, 29, 8, 43, 44, 33, + 34, 35, 36, 37, 38, 8, 28, 29, 42, 43, + 44, 33, 8, 35, 36, 37, 38, 18, 28, 29, + 42, 43, 44, 33, 34, 35, 36, 37, 38, 7, + 28, 29, 11, 43, 44, 33, 42, 35, 36, 37, + 38, 9, 28, 29, 11, 43, 44, 33, 18, 42, + 20, 23, 9, 44, 31, -1, 26, 43, 44 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing @@ -666,15 +668,16 @@ static const yytype_int8 yycheck[] = static const yytype_uint8 yystos[] = { 0, 1, 5, 7, 9, 13, 16, 17, 22, 23, - 33, 34, 41, 44, 45, 46, 47, 48, 50, 53, - 54, 8, 12, 15, 18, 19, 20, 21, 25, 55, - 56, 8, 7, 22, 46, 48, 7, 48, 48, 48, - 0, 38, 26, 27, 31, 33, 34, 35, 36, 39, - 40, 41, 48, 49, 8, 8, 18, 8, 12, 18, - 25, 56, 48, 14, 25, 32, 42, 44, 48, 48, - 48, 48, 48, 48, 48, 48, 48, 48, 49, 32, - 24, 8, 8, 8, 7, 48, 48, 42, 48, 52, - 38, 47, 48, 51, 10, 11, 52, 9, 51, 11, + 24, 35, 36, 41, 46, 47, 48, 49, 51, 52, + 55, 56, 57, 8, 12, 15, 18, 19, 20, 21, + 26, 58, 59, 8, 7, 22, 48, 55, 27, 7, + 55, 55, 55, 0, 40, 41, 41, 50, 55, 28, + 29, 33, 35, 36, 37, 38, 43, 44, 8, 8, + 18, 8, 12, 18, 26, 59, 55, 14, 26, 34, + 42, 46, 50, 50, 55, 25, 34, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 8, 8, 8, 7, + 55, 55, 42, 42, 54, 55, 54, 40, 49, 53, + 55, 53, 10, 11, 11, 54, 9, 23, 53, 11, 9 }; @@ -1547,183 +1550,198 @@ yyreduce: break; case 17: -#line 125 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lingo->c_constpush); inst i; WRITE_LE_UINT32(&i, (yyvsp[(1) - (1)].i)); (yyval.code) = g_lingo->code1(i); ;} +#line 127 "engines/director/lingo/lingo-gr.y" + { + inst body, end; + WRITE_LE_UINT32(&body, (yyvsp[(5) - (8)].code)); + WRITE_LE_UINT32(&end, (yyvsp[(6) - (8)].code)); + (*g_lingo->_currentScript)[(yyvsp[(1) - (8)].code) + 1] = body; /* body of loop */ + (*g_lingo->_currentScript)[(yyvsp[(1) - (8)].code) + 2] = end; ;} break; case 18: -#line 126 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lingo->c_varpush); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); (yyval.code) = g_lingo->code1(g_lingo->c_eval); delete (yyvsp[(1) - (1)].s); ;} +#line 135 "engines/director/lingo/lingo-gr.y" + { g_lingo->code1(STOP); ;} break; - case 20: -#line 128 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lingo->c_add); ;} + case 19: +#line 136 "engines/director/lingo/lingo-gr.y" + { g_lingo->code2(g_lingo->c_eq, STOP); ;} break; case 21: -#line 129 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lingo->c_sub); ;} +#line 139 "engines/director/lingo/lingo-gr.y" + { (yyval.code) = g_lingo->code3(g_lingo->c_whilecode, STOP, STOP); ;} break; case 22: -#line 130 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lingo->c_mul); ;} +#line 141 "engines/director/lingo/lingo-gr.y" + { (yyval.code) = g_lingo->code1(g_lingo->c_ifcode); g_lingo->code3(STOP, STOP, STOP); ;} break; case 23: -#line 131 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lingo->c_div); ;} +#line 143 "engines/director/lingo/lingo-gr.y" + { g_lingo->code1(STOP); (yyval.code) = g_lingo->_currentScript->size(); ;} break; case 24: -#line 132 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lingo->c_gt); ;} - break; - - case 25: -#line 133 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lingo->c_lt); ;} - break; - - case 26: -#line 134 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lingo->c_neq); ;} +#line 145 "engines/director/lingo/lingo-gr.y" + { (yyval.code) = g_lingo->_currentScript->size(); ;} break; case 27: -#line 135 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lingo->c_ge); ;} +#line 150 "engines/director/lingo/lingo-gr.y" + { g_lingo->code1(g_lingo->c_constpush); inst i; WRITE_LE_UINT32(&i, (yyvsp[(1) - (1)].i)); (yyval.code) = g_lingo->code1(i); ;} break; case 28: -#line 136 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lingo->c_le); ;} - break; - - case 29: -#line 137 "engines/director/lingo/lingo-gr.y" - { (yyval.code) = (yyvsp[(2) - (2)].code); ;} +#line 151 "engines/director/lingo/lingo-gr.y" + { g_lingo->code1(g_lingo->c_varpush); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); (yyval.code) = g_lingo->code1(g_lingo->c_eval); delete (yyvsp[(1) - (1)].s); ;} break; case 30: -#line 138 "engines/director/lingo/lingo-gr.y" - { (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;} +#line 153 "engines/director/lingo/lingo-gr.y" + { g_lingo->code1(g_lingo->c_add); ;} break; case 31: -#line 139 "engines/director/lingo/lingo-gr.y" - { (yyval.code) = (yyvsp[(2) - (3)].code); ;} +#line 154 "engines/director/lingo/lingo-gr.y" + { g_lingo->code1(g_lingo->c_sub); ;} break; case 32: -#line 142 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(STOP); ;} +#line 155 "engines/director/lingo/lingo-gr.y" + { g_lingo->code1(g_lingo->c_mul); ;} break; case 33: -#line 143 "engines/director/lingo/lingo-gr.y" - { g_lingo->code2(g_lingo->c_eq, STOP); ;} +#line 156 "engines/director/lingo/lingo-gr.y" + { g_lingo->code1(g_lingo->c_div); ;} + break; + + case 34: +#line 157 "engines/director/lingo/lingo-gr.y" + { g_lingo->code1(g_lingo->c_gt); ;} break; case 35: -#line 146 "engines/director/lingo/lingo-gr.y" - { (yyval.code) = g_lingo->code1(g_lingo->c_ifcode); g_lingo->code3(STOP,STOP,STOP); ;} +#line 158 "engines/director/lingo/lingo-gr.y" + { g_lingo->code1(g_lingo->c_lt); ;} break; case 36: -#line 148 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(STOP); (yyval.code) = g_lingo->_currentScript->size(); ;} +#line 159 "engines/director/lingo/lingo-gr.y" + { g_lingo->code1(g_lingo->c_neq); ;} break; case 37: -#line 150 "engines/director/lingo/lingo-gr.y" - { (yyval.code) = g_lingo->_currentScript->size(); ;} +#line 160 "engines/director/lingo/lingo-gr.y" + { g_lingo->code1(g_lingo->c_ge); ;} + break; + + case 38: +#line 161 "engines/director/lingo/lingo-gr.y" + { g_lingo->code1(g_lingo->c_le); ;} + break; + + case 39: +#line 162 "engines/director/lingo/lingo-gr.y" + { (yyval.code) = (yyvsp[(2) - (2)].code); ;} break; case 40: -#line 155 "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); ;} +#line 163 "engines/director/lingo/lingo-gr.y" + { (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;} break; case 41: -#line 156 "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 164 "engines/director/lingo/lingo-gr.y" + { (yyval.code) = (yyvsp[(2) - (3)].code); ;} break; case 42: -#line 157 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lingo->c_printtop); ;} +#line 167 "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 43: +#line 168 "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 44: #line 169 "engines/director/lingo/lingo-gr.y" + { g_lingo->code1(g_lingo->c_printtop); ;} + break; + + case 46: +#line 181 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_gotoloop); ;} break; - case 45: -#line 170 "engines/director/lingo/lingo-gr.y" + case 47: +#line 182 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_gotonext); ;} break; - case 46: -#line 171 "engines/director/lingo/lingo-gr.y" + case 48: +#line 183 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_gotoprevious); ;} break; - case 47: -#line 172 "engines/director/lingo/lingo-gr.y" + case 49: +#line 184 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); g_lingo->codeString(""); delete (yyvsp[(2) - (2)].s); ;} break; - case 48: -#line 173 "engines/director/lingo/lingo-gr.y" + case 50: +#line 185 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str()); g_lingo->codeString((yyvsp[(3) - (3)].s)->c_str()); delete (yyvsp[(2) - (3)].s); delete (yyvsp[(3) - (3)].s); ;} break; - case 49: -#line 174 "engines/director/lingo/lingo-gr.y" + case 51: +#line 186 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString(""); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;} break; - case 50: -#line 177 "engines/director/lingo/lingo-gr.y" + case 52: +#line 189 "engines/director/lingo/lingo-gr.y" { (yyval.s) = (yyvsp[(3) - (3)].s); ;} break; - case 51: -#line 178 "engines/director/lingo/lingo-gr.y" + case 53: +#line 190 "engines/director/lingo/lingo-gr.y" { (yyval.s) = (yyvsp[(2) - (2)].s); ;} break; - case 52: -#line 179 "engines/director/lingo/lingo-gr.y" + case 54: +#line 191 "engines/director/lingo/lingo-gr.y" { (yyval.s) = (yyvsp[(2) - (2)].s); ;} break; - case 53: -#line 180 "engines/director/lingo/lingo-gr.y" + case 55: +#line 192 "engines/director/lingo/lingo-gr.y" { (yyval.s) = (yyvsp[(1) - (1)].s); ;} break; - case 54: -#line 183 "engines/director/lingo/lingo-gr.y" + case 56: +#line 195 "engines/director/lingo/lingo-gr.y" { (yyval.s) = (yyvsp[(3) - (3)].s); ;} break; - case 55: -#line 184 "engines/director/lingo/lingo-gr.y" + case 57: +#line 196 "engines/director/lingo/lingo-gr.y" { (yyval.s) = (yyvsp[(2) - (2)].s); ;} break; - case 56: -#line 185 "engines/director/lingo/lingo-gr.y" + case 58: +#line 197 "engines/director/lingo/lingo-gr.y" { (yyval.s) = (yyvsp[(3) - (3)].s); ;} break; /* Line 1267 of yacc.c. */ -#line 1727 "engines/director/lingo/lingo-gr.cpp" +#line 1745 "engines/director/lingo/lingo-gr.cpp" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -1937,6 +1955,6 @@ yyreturn: } -#line 228 "engines/director/lingo/lingo-gr.y" +#line 236 "engines/director/lingo/lingo-gr.y" -- cgit v1.2.3