From aa45e48355e670b2d8807515fa3158c0a130fcfb Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 10 Jul 2016 15:24:00 +0200 Subject: [PATCH] DIRECTOR: Lingo: Better error recovery and further work on if() statements --- engines/director/lingo/lingo-gr.cpp | 974 +++++++++++----------- engines/director/lingo/lingo-gr.h | 146 ++-- engines/director/lingo/lingo-gr.y | 30 +- engines/director/lingo/lingo-lex.cpp | 331 ++++---- engines/director/lingo/lingo-lex.l | 3 +- engines/director/lingo/lingo.cpp | 15 +- engines/director/lingo/lingo.h | 2 + engines/director/lingo/tests/macros.lingo | 4 +- 8 files changed, 765 insertions(+), 740 deletions(-) diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp index 3aef4795c7b9..adb97feaeea4 100644 --- a/engines/director/lingo/lingo-gr.cpp +++ b/engines/director/lingo/lingo-gr.cpp @@ -79,41 +79,42 @@ tDOWN = 268, tELSE = 269, tNLELSIF = 270, - tEND = 271, - tEXIT = 272, - tFRAME = 273, - tGLOBAL = 274, - tGO = 275, - tIF = 276, - tINTO = 277, - tLOOP = 278, - tMACRO = 279, - tMCI = 280, - tMCIWAIT = 281, - tMOVIE = 282, - tNEXT = 283, - tOF = 284, - tPREVIOUS = 285, - tPUT = 286, - tREPEAT = 287, - tSET = 288, - tTHEN = 289, - tTO = 290, - tWITH = 291, - tWHILE = 292, - tNLELSE = 293, - tGE = 294, - tLE = 295, - tGT = 296, - tLT = 297, - tEQ = 298, - tNEQ = 299, - tAND = 300, - tOR = 301, - tNOT = 302, - tCONCAT = 303, - tCONTAINS = 304, - tSTARTS = 305 + tENDIF = 271, + tENDREPEAT = 272, + tEXIT = 273, + tFRAME = 274, + tGLOBAL = 275, + tGO = 276, + tIF = 277, + tINTO = 278, + tLOOP = 279, + tMACRO = 280, + tMCI = 281, + tMCIWAIT = 282, + tMOVIE = 283, + tNEXT = 284, + tOF = 285, + tPREVIOUS = 286, + tPUT = 287, + tREPEAT = 288, + tSET = 289, + tTHEN = 290, + tTO = 291, + tWITH = 292, + tWHILE = 293, + tNLELSE = 294, + tGE = 295, + tLE = 296, + tGT = 297, + tLT = 298, + tEQ = 299, + tNEQ = 300, + tAND = 301, + tOR = 302, + tNOT = 303, + tCONCAT = 304, + tCONTAINS = 305, + tSTARTS = 306 }; #endif /* Tokens. */ @@ -130,41 +131,42 @@ #define tDOWN 268 #define tELSE 269 #define tNLELSIF 270 -#define tEND 271 -#define tEXIT 272 -#define tFRAME 273 -#define tGLOBAL 274 -#define tGO 275 -#define tIF 276 -#define tINTO 277 -#define tLOOP 278 -#define tMACRO 279 -#define tMCI 280 -#define tMCIWAIT 281 -#define tMOVIE 282 -#define tNEXT 283 -#define tOF 284 -#define tPREVIOUS 285 -#define tPUT 286 -#define tREPEAT 287 -#define tSET 288 -#define tTHEN 289 -#define tTO 290 -#define tWITH 291 -#define tWHILE 292 -#define tNLELSE 293 -#define tGE 294 -#define tLE 295 -#define tGT 296 -#define tLT 297 -#define tEQ 298 -#define tNEQ 299 -#define tAND 300 -#define tOR 301 -#define tNOT 302 -#define tCONCAT 303 -#define tCONTAINS 304 -#define tSTARTS 305 +#define tENDIF 271 +#define tENDREPEAT 272 +#define tEXIT 273 +#define tFRAME 274 +#define tGLOBAL 275 +#define tGO 276 +#define tIF 277 +#define tINTO 278 +#define tLOOP 279 +#define tMACRO 280 +#define tMCI 281 +#define tMCIWAIT 282 +#define tMOVIE 283 +#define tNEXT 284 +#define tOF 285 +#define tPREVIOUS 286 +#define tPUT 287 +#define tREPEAT 288 +#define tSET 289 +#define tTHEN 290 +#define tTO 291 +#define tWITH 292 +#define tWHILE 293 +#define tNLELSE 294 +#define tGE 295 +#define tLE 296 +#define tGT 297 +#define tLT 298 +#define tEQ 299 +#define tNEQ 300 +#define tAND 301 +#define tOR 302 +#define tNOT 303 +#define tCONCAT 304 +#define tCONTAINS 305 +#define tSTARTS 306 @@ -181,9 +183,10 @@ extern int yylex(); extern int yyparse(); -void yyerror(char *s) { error("%s at line %d col %d", s, Director::g_lingo->_linenumber, Director::g_lingo->_colnumber); } using namespace Director; +void yyerror(char *s) { g_lingo->_hadError = true; warning("%s at line %d col %d", s, Director::g_lingo->_linenumber, Director::g_lingo->_colnumber); } + @@ -207,7 +210,7 @@ using namespace Director; #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 65 "engines/director/lingo/lingo-gr.y" +#line 66 "engines/director/lingo/lingo-gr.y" { Common::String *s; int i; @@ -216,7 +219,7 @@ typedef union YYSTYPE int narg; /* number of arguments */ } /* Line 193 of yacc.c. */ -#line 220 "engines/director/lingo/lingo-gr.cpp" +#line 223 "engines/director/lingo/lingo-gr.cpp" YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 @@ -229,7 +232,7 @@ typedef union YYSTYPE /* Line 216 of yacc.c. */ -#line 233 "engines/director/lingo/lingo-gr.cpp" +#line 236 "engines/director/lingo/lingo-gr.cpp" #ifdef short # undef short @@ -442,22 +445,22 @@ union yyalloc #endif /* YYFINAL -- State number of the termination state. */ -#define YYFINAL 64 +#define YYFINAL 65 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 544 +#define YYLAST 534 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 64 +#define YYNTOKENS 65 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 33 /* YYNRULES -- Number of rules. */ -#define YYNRULES 106 +#define YYNRULES 105 /* YYNRULES -- Number of states. */ -#define YYNSTATES 223 +#define YYNSTATES 221 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 305 +#define YYMAXUTOK 306 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) @@ -466,12 +469,12 @@ union yyalloc static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 57, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 58, 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, 56, 62, 2, - 58, 59, 54, 52, 63, 53, 2, 55, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 57, 63, 2, + 59, 60, 55, 53, 64, 54, 2, 56, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 61, 51, 60, 2, 2, 2, 2, 2, 2, 2, + 62, 52, 61, 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, @@ -495,7 +498,7 @@ static const yytype_uint8 yytranslate[] = 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50 + 45, 46, 47, 48, 49, 50, 51 }; #if YYDEBUG @@ -503,78 +506,78 @@ static const yytype_uint8 yytranslate[] = YYRHS. */ static const yytype_uint16 yyprhs[] = { - 0, 0, 3, 7, 9, 11, 12, 14, 16, 18, - 20, 22, 24, 29, 34, 39, 41, 43, 45, 47, - 56, 68, 81, 90, 102, 115, 122, 133, 144, 145, - 149, 152, 154, 157, 159, 166, 168, 174, 176, 180, - 184, 187, 191, 193, 195, 196, 197, 198, 201, 204, - 206, 208, 210, 215, 220, 222, 224, 228, 232, 236, - 240, 244, 248, 252, 256, 260, 264, 268, 271, 275, - 279, 283, 287, 290, 293, 297, 300, 303, 306, 308, - 310, 313, 315, 319, 322, 325, 328, 331, 335, 338, - 342, 345, 348, 350, 354, 357, 361, 362, 371, 372, - 374, 378, 383, 384, 388, 389, 391 + 0, 0, 3, 7, 9, 12, 14, 15, 17, 19, + 21, 23, 25, 30, 35, 40, 42, 44, 46, 48, + 56, 67, 79, 87, 99, 111, 118, 129, 140, 141, + 145, 148, 150, 153, 155, 162, 164, 170, 172, 176, + 180, 183, 187, 189, 191, 192, 193, 197, 199, 201, + 203, 205, 210, 215, 217, 219, 223, 227, 231, 235, + 239, 243, 247, 251, 255, 259, 263, 266, 270, 274, + 278, 282, 285, 288, 292, 295, 298, 301, 303, 305, + 308, 310, 314, 317, 320, 323, 326, 330, 333, 337, + 340, 343, 345, 349, 352, 356, 357, 367, 368, 370, + 374, 379, 380, 384, 385, 387 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int8 yyrhs[] = { - 65, 0, -1, 65, 66, 67, -1, 67, -1, 57, - -1, -1, 91, -1, 86, -1, 95, -1, 68, -1, - 70, -1, 1, -1, 31, 85, 22, 10, -1, 33, - 10, 51, 85, -1, 33, 10, 35, 85, -1, 85, - -1, 86, -1, 69, -1, 71, -1, 78, 58, 77, - 59, 84, 83, 16, 32, -1, 79, 51, 85, 83, - 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, 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, - 69, 83, -1, 80, 77, 34, 82, 69, 83, 74, - 83, 72, 83, -1, -1, 38, 82, 69, -1, 73, - 76, -1, 76, -1, 74, 75, -1, 75, -1, 81, - 77, 34, 82, 70, 83, -1, 74, -1, 81, 77, - 34, 84, 83, -1, 85, -1, 85, 51, 85, -1, - 58, 77, 59, -1, 32, 37, -1, 32, 36, 10, - -1, 21, -1, 15, -1, -1, -1, -1, 84, 66, - -1, 84, 70, -1, 7, -1, 8, -1, 11, -1, - 9, 58, 96, 59, -1, 10, 58, 96, 59, -1, - 10, -1, 68, -1, 85, 52, 85, -1, 85, 53, - 85, -1, 85, 54, 85, -1, 85, 55, 85, -1, - 85, 60, 85, -1, 85, 61, 85, -1, 85, 44, - 85, -1, 85, 39, 85, -1, 85, 40, 85, -1, - 85, 45, 85, -1, 85, 46, 85, -1, 47, 85, - -1, 85, 62, 85, -1, 85, 48, 85, -1, 85, - 49, 85, -1, 85, 50, 85, -1, 52, 85, -1, - 53, 85, -1, 58, 85, 59, -1, 25, 11, -1, - 26, 10, -1, 31, 85, -1, 88, -1, 17, -1, - 19, 87, -1, 10, -1, 87, 63, 10, -1, 20, - 23, -1, 20, 28, -1, 20, 30, -1, 20, 89, - -1, 20, 89, 90, -1, 20, 90, -1, 35, 18, - 11, -1, 18, 11, -1, 35, 11, -1, 11, -1, - 29, 27, 11, -1, 27, 11, -1, 35, 27, 11, - -1, -1, 24, 10, 92, 82, 93, 66, 94, 84, - -1, -1, 10, -1, 93, 63, 10, -1, 93, 66, - 63, 10, -1, -1, 10, 82, 96, -1, -1, 85, - -1, 96, 63, 85, -1 + 66, 0, -1, 66, 67, 68, -1, 68, -1, 1, + 58, -1, 58, -1, -1, 92, -1, 87, -1, 96, + -1, 69, -1, 71, -1, 32, 86, 23, 10, -1, + 34, 10, 52, 86, -1, 34, 10, 36, 86, -1, + 86, -1, 87, -1, 70, -1, 72, -1, 79, 59, + 78, 60, 85, 84, 17, -1, 80, 52, 86, 84, + 36, 86, 84, 85, 84, 17, -1, 80, 52, 86, + 84, 13, 36, 86, 84, 85, 84, 17, -1, 81, + 78, 35, 67, 85, 84, 16, -1, 81, 78, 35, + 67, 85, 84, 39, 85, 84, 67, 16, -1, 81, + 78, 35, 67, 85, 84, 83, 74, 84, 67, 16, + -1, 81, 78, 35, 83, 70, 84, -1, 81, 78, + 35, 83, 70, 84, 39, 83, 70, 84, -1, 81, + 78, 35, 83, 70, 84, 75, 84, 73, 84, -1, + -1, 39, 83, 70, -1, 74, 77, -1, 77, -1, + 75, 76, -1, 76, -1, 82, 78, 35, 83, 71, + 84, -1, 75, -1, 82, 78, 35, 85, 84, -1, + 86, -1, 86, 52, 86, -1, 59, 78, 60, -1, + 33, 38, -1, 33, 37, 10, -1, 22, -1, 15, + -1, -1, -1, 85, 67, 71, -1, 71, -1, 7, + -1, 8, -1, 11, -1, 9, 59, 97, 60, -1, + 10, 59, 97, 60, -1, 10, -1, 69, -1, 86, + 53, 86, -1, 86, 54, 86, -1, 86, 55, 86, + -1, 86, 56, 86, -1, 86, 61, 86, -1, 86, + 62, 86, -1, 86, 45, 86, -1, 86, 40, 86, + -1, 86, 41, 86, -1, 86, 46, 86, -1, 86, + 47, 86, -1, 48, 86, -1, 86, 63, 86, -1, + 86, 49, 86, -1, 86, 50, 86, -1, 86, 51, + 86, -1, 53, 86, -1, 54, 86, -1, 59, 86, + 60, -1, 26, 11, -1, 27, 10, -1, 32, 86, + -1, 89, -1, 18, -1, 20, 88, -1, 10, -1, + 88, 64, 10, -1, 21, 24, -1, 21, 29, -1, + 21, 31, -1, 21, 90, -1, 21, 90, 91, -1, + 21, 91, -1, 36, 19, 11, -1, 19, 11, -1, + 36, 11, -1, 11, -1, 30, 28, 11, -1, 28, + 11, -1, 36, 28, 11, -1, -1, 25, 10, 93, + 83, 94, 67, 95, 85, 67, -1, -1, 10, -1, + 94, 64, 10, -1, 94, 67, 64, 10, -1, -1, + 10, 83, 97, -1, -1, 86, -1, 97, 64, 86, + -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 94, 94, 95, 98, 103, 104, 105, 106, 107, - 108, 109, 112, 118, 124, 131, 132, 134, 135, 140, - 151, 167, 181, 188, 197, 206, 216, 226, 237, 238, - 241, 242, 245, 246, 249, 257, 258, 266, 267, 268, - 270, 272, 278, 284, 291, 293, 295, 296, 297, 300, - 305, 308, 311, 317, 325, 328, 329, 330, 331, 332, - 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, - 343, 344, 345, 346, 347, 350, 351, 352, 353, 354, - 356, 359, 360, 371, 372, 373, 374, 379, 385, 392, - 393, 394, 395, 398, 399, 400, 428, 428, 435, 436, - 437, 438, 440, 443, 451, 452, 453 + 0, 95, 95, 96, 97, 100, 105, 106, 107, 108, + 109, 110, 113, 119, 125, 132, 133, 135, 136, 141, + 152, 168, 182, 189, 198, 207, 217, 227, 238, 239, + 242, 243, 246, 247, 250, 258, 259, 267, 268, 269, + 271, 273, 279, 285, 292, 294, 296, 297, 300, 305, + 308, 311, 317, 325, 328, 329, 330, 331, 332, 333, + 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, + 344, 345, 346, 347, 350, 351, 352, 353, 354, 356, + 359, 360, 371, 372, 373, 374, 379, 385, 392, 393, + 394, 395, 398, 399, 400, 428, 428, 435, 436, 437, + 438, 440, 443, 451, 452, 453 }; #endif @@ -585,9 +588,9 @@ static const char *const yytname[] = { "$end", "error", "$undefined", "CASTREF", "UNARY", "VOID", "VAR", "INT", "FLOAT", "BLTIN", "ID", "STRING", "HANDLER", "tDOWN", "tELSE", - "tNLELSIF", "tEND", "tEXIT", "tFRAME", "tGLOBAL", "tGO", "tIF", "tINTO", - "tLOOP", "tMACRO", "tMCI", "tMCIWAIT", "tMOVIE", "tNEXT", "tOF", - "tPREVIOUS", "tPUT", "tREPEAT", "tSET", "tTHEN", "tTO", "tWITH", + "tNLELSIF", "tENDIF", "tENDREPEAT", "tEXIT", "tFRAME", "tGLOBAL", "tGO", + "tIF", "tINTO", "tLOOP", "tMACRO", "tMCI", "tMCIWAIT", "tMOVIE", "tNEXT", + "tOF", "tPREVIOUS", "tPUT", "tREPEAT", "tSET", "tTHEN", "tTO", "tWITH", "tWHILE", "tNLELSE", "tGE", "tLE", "tGT", "tLT", "tEQ", "tNEQ", "tAND", "tOR", "tNOT", "tCONCAT", "tCONTAINS", "tSTARTS", "'='", "'+'", "'-'", "'*'", "'/'", "'%'", "'\\n'", "'('", "')'", "'>'", "'<'", "'&'", "','", @@ -610,41 +613,41 @@ static const yytype_uint16 yytoknum[] = 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, - 305, 61, 43, 45, 42, 47, 37, 10, 40, 41, - 62, 60, 38, 44 + 305, 306, 61, 43, 45, 42, 47, 37, 10, 40, + 41, 62, 60, 38, 44 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { - 0, 64, 65, 65, 66, 67, 67, 67, 67, 67, - 67, 67, 68, 68, 68, 69, 69, 70, 70, 70, - 70, 70, 71, 71, 71, 71, 71, 71, 72, 72, - 73, 73, 74, 74, 75, 76, 76, 77, 77, 77, - 78, 79, 80, 81, 82, 83, 84, 84, 84, 85, - 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, - 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, - 85, 85, 85, 85, 85, 86, 86, 86, 86, 86, - 86, 87, 87, 88, 88, 88, 88, 88, 88, 89, - 89, 89, 89, 90, 90, 90, 92, 91, 93, 93, - 93, 93, 94, 95, 96, 96, 96 + 0, 65, 66, 66, 66, 67, 68, 68, 68, 68, + 68, 68, 69, 69, 69, 70, 70, 71, 71, 71, + 71, 71, 72, 72, 72, 72, 72, 72, 73, 73, + 74, 74, 75, 75, 76, 77, 77, 78, 78, 78, + 79, 80, 81, 82, 83, 84, 85, 85, 86, 86, + 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, + 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, + 86, 86, 86, 86, 87, 87, 87, 87, 87, 87, + 88, 88, 89, 89, 89, 89, 89, 89, 90, 90, + 90, 90, 91, 91, 91, 93, 92, 94, 94, 94, + 94, 95, 96, 97, 97, 97 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { - 0, 2, 3, 1, 1, 0, 1, 1, 1, 1, - 1, 1, 4, 4, 4, 1, 1, 1, 1, 8, - 11, 12, 8, 11, 12, 6, 10, 10, 0, 3, + 0, 2, 3, 1, 2, 1, 0, 1, 1, 1, + 1, 1, 4, 4, 4, 1, 1, 1, 1, 7, + 10, 11, 7, 11, 11, 6, 10, 10, 0, 3, 2, 1, 2, 1, 6, 1, 5, 1, 3, 3, - 2, 3, 1, 1, 0, 0, 0, 2, 2, 1, - 1, 1, 4, 4, 1, 1, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, - 3, 3, 2, 2, 3, 2, 2, 2, 1, 1, - 2, 1, 3, 2, 2, 2, 2, 3, 2, 3, - 2, 2, 1, 3, 2, 3, 0, 8, 0, 1, - 3, 4, 0, 3, 0, 1, 3 + 2, 3, 1, 1, 0, 0, 3, 1, 1, 1, + 1, 4, 4, 1, 1, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, + 3, 2, 2, 3, 2, 2, 2, 1, 1, 2, + 1, 3, 2, 2, 2, 2, 3, 2, 3, 2, + 2, 1, 3, 2, 3, 0, 9, 0, 1, 3, + 4, 0, 3, 0, 1, 3 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state @@ -652,229 +655,227 @@ static const yytype_uint8 yyr2[] = means the default is an error. */ static const yytype_uint8 yydefact[] = { - 0, 11, 49, 50, 0, 44, 51, 79, 0, 0, + 0, 0, 48, 49, 0, 44, 50, 78, 0, 0, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 3, 55, 17, 10, 18, 0, 0, 0, - 15, 7, 78, 6, 8, 104, 104, 104, 81, 80, - 92, 0, 83, 0, 84, 0, 85, 0, 86, 88, - 96, 75, 76, 54, 0, 55, 77, 0, 40, 0, - 67, 72, 73, 0, 1, 4, 0, 0, 0, 0, - 0, 37, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 105, 0, 0, - 103, 0, 90, 94, 0, 91, 0, 0, 0, 87, - 44, 0, 0, 41, 0, 0, 74, 2, 0, 45, - 0, 0, 44, 0, 63, 64, 62, 65, 66, 69, - 70, 71, 56, 57, 58, 59, 60, 61, 68, 52, - 0, 53, 82, 93, 89, 95, 98, 12, 14, 13, - 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, - 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, - 24, 36, 34 + 0, 0, 3, 54, 17, 11, 18, 0, 0, 0, + 15, 8, 77, 7, 9, 4, 103, 103, 103, 80, + 79, 91, 0, 82, 0, 83, 0, 84, 0, 85, + 87, 95, 74, 75, 53, 0, 54, 76, 0, 40, + 0, 66, 71, 72, 0, 1, 5, 6, 0, 0, + 0, 0, 37, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 104, 0, + 0, 102, 0, 89, 93, 0, 90, 0, 0, 0, + 86, 44, 0, 0, 41, 0, 0, 73, 2, 0, + 45, 0, 0, 44, 0, 62, 63, 61, 64, 65, + 68, 69, 70, 55, 56, 57, 58, 59, 60, 67, + 51, 0, 52, 81, 92, 88, 94, 97, 12, 14, + 13, 0, 0, 39, 0, 0, 38, 105, 98, 0, + 47, 45, 16, 0, 0, 45, 45, 0, 101, 0, + 0, 0, 45, 44, 25, 99, 0, 0, 46, 19, + 45, 0, 22, 0, 0, 43, 44, 45, 33, 0, + 100, 0, 0, 45, 0, 45, 35, 31, 0, 0, + 32, 28, 0, 96, 45, 0, 0, 30, 0, 0, + 45, 44, 45, 44, 0, 20, 0, 0, 0, 26, + 0, 27, 0, 21, 23, 24, 45, 29, 45, 36, + 34 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { - -1, 21, 157, 22, 55, 24, 158, 26, 201, 185, - 186, 176, 187, 70, 27, 28, 29, 177, 211, 141, - 149, 30, 154, 39, 32, 48, 49, 33, 100, 148, - 166, 34, 88 + -1, 21, 159, 22, 56, 24, 150, 26, 202, 185, + 186, 178, 187, 71, 27, 28, 29, 179, 212, 142, + 151, 30, 152, 40, 32, 49, 50, 33, 101, 149, + 167, 34, 89 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -162 +#define YYPACT_NINF -167 static const yytype_int16 yypact[] = { - 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 + 181, -50, -167, -167, -49, 428, -167, -167, 25, 134, + -167, 45, 47, 78, 320, -11, 81, 320, 320, 320, + 320, 4, -167, 28, -167, -167, -167, 33, 53, 327, + 409, -167, -167, -167, -167, -167, 320, 320, 320, -167, + 30, -167, 88, -167, 96, -167, 85, -167, 18, 67, + -167, -167, -167, -167, 56, 320, -167, -2, 110, -167, + -29, 471, 471, 471, 366, -167, -167, 234, 327, 320, + 327, 86, 390, 320, 320, 320, 320, 320, 320, 320, + 320, 320, 320, 320, 320, 320, 320, 320, 409, 42, + 52, 58, 114, -167, -167, 116, -167, 119, 121, 97, + -167, -167, -2, 123, -167, 320, 320, -167, -167, 79, + 409, 80, 342, 83, 320, 409, 409, 409, 409, 409, + 409, 409, 409, 452, 452, 471, 471, 409, 409, 409, + -167, 320, -167, -167, -167, -167, -167, 128, -167, 409, + 409, 263, 5, -167, 263, 292, 409, 409, -167, -24, + -167, 83, -167, 106, 320, 83, -167, 133, 84, 263, + 127, 320, 409, 3, -9, -167, 137, 263, -167, -167, + 409, 263, -167, 263, 136, -167, -167, 136, -167, 327, + -167, 83, 263, 83, 83, 136, 136, -167, 327, 292, + -167, 115, 120, 263, 83, 140, 83, -167, 83, 131, + -167, -167, -167, -167, 150, -167, 152, 153, 263, -167, + 292, -167, 263, -167, -167, -167, 83, -167, -167, -167, + -167 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -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 + -167, -167, -20, 104, 16, -123, 0, -167, -167, -167, + 11, -166, -8, -65, -167, -167, -167, -149, -3, -66, + -36, -5, 17, -167, -167, -167, 130, -167, -167, -167, + -167, -167, 19 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -55 +#define YYTABLE_NINF -54 static const yytype_int16 yytable[] = { - 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, 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, - 0, 218, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 17, 0, 0, 0, 0, 18, 19, 0, 0, - 0, -5, 20, 2, 3, 4, 53, 6, 0, 0, - 0, 0, 0, 7, 0, 8, 9, 10, 0, 0, - 0, 12, 13, 0, 0, 0, 0, 14, 15, 16, - 0, 0, 2, 3, 4, 53, 6, 0, 0, 0, - 0, 0, 7, 17, 8, 9, 10, 0, 18, 19, - 12, 13, 0, 65, 20, 0, 14, 15, 16, 0, - 0, 2, 3, 4, 53, 6, 0, 0, 0, 0, - 0, 7, 17, 8, 9, 0, 0, 18, 19, 12, - 13, 0, 0, 20, 0, 14, 0, 16, 0, 2, - 3, 4, 53, 6, 0, 0, 2, 3, 4, 53, - 6, 17, 0, 0, 0, 0, 18, 19, 0, 0, - 0, 0, 20, 54, 0, 16, 0, 0, 0, 0, - 54, 0, 16, 0, 0, 0, 102, 0, 0, 17, - 0, 0, 0, 0, 18, 19, 17, 0, 0, 0, - 20, 18, 19, 72, 73, 0, 0, 69, 74, 75, - 76, 0, 77, 78, 79, 0, 80, 81, 82, 83, - 0, 0, 72, 73, 84, 85, 86, 74, 75, 76, - 0, 77, 78, 79, 113, 80, 81, 82, 83, 0, - 0, 0, 106, 84, 85, 86, 72, 73, 0, 0, - 0, 74, 75, 76, 0, 77, 78, 79, 0, 80, - 81, 82, 83, 0, 0, 0, 106, 84, 85, 86, - 72, 73, 0, 0, 0, 74, 75, 76, 0, 77, - 78, 79, 113, 80, 81, 82, 83, 0, 0, 72, - 73, 84, 85, 86, 74, 75, 76, 0, 77, 78, - 79, 0, 80, 81, 82, 83, 0, 0, -54, -54, - 84, 85, 86, -54, -54, -54, 0, -54, -54, -54, - 0, 0, 0, -54, -54, 0, 0, 36, 0, -54, - -54, -54, 72, 73, 0, 0, 0, 74, 75, 76, - 0, 77, 78, 79, 0, 0, 0, 82, 83, 0, - 0, 72, 73, 84, 85, 86, 74, 75, 76, 0, - 77, 78, 79, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 84, 85, 86 + 25, 67, 38, 109, 65, 111, 175, 105, 35, 57, + 36, 190, 61, 62, 63, 64, 23, 31, 153, 172, + 190, 103, 156, 106, 72, 188, 58, 59, -10, 96, + 176, 88, 88, 88, 66, 39, 188, 97, 73, 74, + 157, 154, 173, 75, 76, 77, 98, 78, 79, 80, + 102, 81, 82, 83, 84, 51, 90, 91, 52, 85, + 86, 87, 66, 72, 110, 112, 200, 25, 115, 116, + 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, + 127, 128, 129, 23, 31, 160, -10, 217, 53, 163, + 164, 60, 68, 144, 92, 44, 171, 46, 137, 93, + 139, 140, 130, 99, 182, 69, 131, 94, 155, 146, + 145, 191, 132, 95, 192, 37, 131, 195, 196, 198, + 104, 113, 131, 199, 133, 98, 147, 134, 204, 158, + 135, 181, 136, 138, 209, 183, 211, 184, 148, 141, + 143, 66, 161, 165, 169, 41, 194, 180, 166, 162, + 219, 175, 220, 42, 201, 203, 170, 205, 43, 168, + 174, 193, 44, 45, 46, 47, 208, 213, 214, 215, + 48, 108, 216, 189, 72, 177, 206, 197, 207, 100, + 0, -6, 1, 72, 0, 0, 0, 0, 2, 3, + 4, 5, 6, 168, 0, 0, 0, 0, 210, 7, + 0, 8, 9, 10, 0, 0, 11, 12, 13, 0, + 0, 0, 218, 14, 15, 16, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, + 0, 0, 0, 0, 18, 19, 0, 0, 0, -6, + 20, 2, 3, 4, 5, 6, 0, 0, 0, 0, + 0, 0, 7, 0, 8, 9, 10, 0, 0, 11, + 12, 13, 0, 0, 0, 0, 14, 15, 16, 0, + 2, 3, 4, 54, 6, 0, 0, 0, 0, 0, + 0, 7, 17, 8, 9, 10, 0, 18, 19, 12, + 13, 0, 0, 20, 0, 14, 15, 16, 0, 2, + 3, 4, 54, 6, 0, 0, 0, 0, 0, 0, + 7, 17, 8, 9, 0, 0, 18, 19, 12, 13, + 0, 0, 20, 0, 14, 0, 16, 2, 3, 4, + 54, 6, 0, 0, 2, 3, 4, 54, 6, 0, + 17, 0, 0, 0, 0, 18, 19, 0, 0, 0, + 0, 20, 55, 0, 16, 0, 0, 0, 0, 55, + 0, 16, 0, 0, 0, 0, 0, 0, 17, 0, + 0, 0, 0, 18, 19, 17, 0, 0, 0, 20, + 18, 19, 73, 74, 0, 0, 70, 75, 76, 77, + 0, 78, 79, 80, 114, 81, 82, 83, 84, 0, + 0, 0, 107, 85, 86, 87, 73, 74, 0, 0, + 0, 75, 76, 77, 0, 78, 79, 80, 0, 81, + 82, 83, 84, 0, 0, 0, 107, 85, 86, 87, + 73, 74, 0, 0, 0, 75, 76, 77, 0, 78, + 79, 80, 114, 81, 82, 83, 84, 0, 0, 73, + 74, 85, 86, 87, 75, 76, 77, 0, 78, 79, + 80, 0, 81, 82, 83, 84, 0, 0, -53, -53, + 85, 86, 87, -53, -53, -53, 0, -53, -53, -53, + 0, 0, 0, -53, -53, 0, 0, 37, 0, -53, + -53, -53, 73, 74, 0, 0, 0, 75, 76, 77, + 0, 78, 79, 80, 0, 0, 0, 83, 84, 0, + 0, 73, 74, 85, 86, 87, 75, 76, 77, 0, + 78, 79, 80, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 85, 86, 87 }; static const yytype_int16 yycheck[] = { - 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, 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, - -1, 211, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 47, -1, -1, -1, -1, 52, 53, -1, -1, - -1, 57, 58, 7, 8, 9, 10, 11, -1, -1, - -1, -1, -1, 17, -1, 19, 20, 21, -1, -1, - -1, 25, 26, -1, -1, -1, -1, 31, 32, 33, - -1, -1, 7, 8, 9, 10, 11, -1, -1, -1, - -1, -1, 17, 47, 19, 20, 21, -1, 52, 53, - 25, 26, -1, 57, 58, -1, 31, 32, 33, -1, - -1, 7, 8, 9, 10, 11, -1, -1, -1, -1, - -1, 17, 47, 19, 20, -1, -1, 52, 53, 25, - 26, -1, -1, 58, -1, 31, -1, 33, -1, 7, - 8, 9, 10, 11, -1, -1, 7, 8, 9, 10, - 11, 47, -1, -1, -1, -1, 52, 53, -1, -1, - -1, -1, 58, 31, -1, 33, -1, -1, -1, -1, - 31, -1, 33, -1, -1, -1, 22, -1, -1, 47, - -1, -1, -1, -1, 52, 53, 47, -1, -1, -1, - 58, 52, 53, 39, 40, -1, -1, 58, 44, 45, - 46, -1, 48, 49, 50, -1, 52, 53, 54, 55, - -1, -1, 39, 40, 60, 61, 62, 44, 45, 46, - -1, 48, 49, 50, 51, 52, 53, 54, 55, -1, - -1, -1, 59, 60, 61, 62, 39, 40, -1, -1, - -1, 44, 45, 46, -1, 48, 49, 50, -1, 52, - 53, 54, 55, -1, -1, -1, 59, 60, 61, 62, - 39, 40, -1, -1, -1, 44, 45, 46, -1, 48, - 49, 50, 51, 52, 53, 54, 55, -1, -1, 39, - 40, 60, 61, 62, 44, 45, 46, -1, 48, 49, - 50, -1, 52, 53, 54, 55, -1, -1, 39, 40, - 60, 61, 62, 44, 45, 46, -1, 48, 49, 50, - -1, -1, -1, 54, 55, -1, -1, 58, -1, 60, - 61, 62, 39, 40, -1, -1, -1, 44, 45, 46, - -1, 48, 49, 50, -1, -1, -1, 54, 55, -1, - -1, 39, 40, 60, 61, 62, 44, 45, 46, -1, - 48, 49, 50, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 60, 61, 62 + 0, 21, 5, 68, 0, 70, 15, 36, 58, 14, + 59, 177, 17, 18, 19, 20, 0, 0, 13, 16, + 186, 23, 145, 52, 29, 174, 37, 38, 0, 11, + 39, 36, 37, 38, 58, 10, 185, 19, 40, 41, + 64, 36, 39, 45, 46, 47, 28, 49, 50, 51, + 55, 53, 54, 55, 56, 10, 37, 38, 11, 61, + 62, 63, 58, 68, 69, 70, 189, 67, 73, 74, + 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, + 85, 86, 87, 67, 67, 151, 58, 210, 10, 155, + 156, 10, 59, 113, 64, 28, 162, 30, 101, 11, + 105, 106, 60, 36, 170, 52, 64, 11, 144, 114, + 113, 177, 60, 28, 179, 59, 64, 183, 184, 185, + 10, 35, 64, 188, 10, 28, 131, 11, 194, 149, + 11, 167, 11, 10, 200, 171, 202, 173, 10, 60, + 60, 58, 36, 10, 17, 11, 182, 10, 64, 154, + 216, 15, 218, 19, 39, 35, 161, 17, 24, 159, + 163, 181, 28, 29, 30, 31, 35, 17, 16, 16, + 36, 67, 208, 176, 179, 164, 196, 185, 198, 49, + -1, 0, 1, 188, -1, -1, -1, -1, 7, 8, + 9, 10, 11, 193, -1, -1, -1, -1, 201, 18, + -1, 20, 21, 22, -1, -1, 25, 26, 27, -1, + -1, -1, 212, 32, 33, 34, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 48, + -1, -1, -1, -1, 53, 54, -1, -1, -1, 58, + 59, 7, 8, 9, 10, 11, -1, -1, -1, -1, + -1, -1, 18, -1, 20, 21, 22, -1, -1, 25, + 26, 27, -1, -1, -1, -1, 32, 33, 34, -1, + 7, 8, 9, 10, 11, -1, -1, -1, -1, -1, + -1, 18, 48, 20, 21, 22, -1, 53, 54, 26, + 27, -1, -1, 59, -1, 32, 33, 34, -1, 7, + 8, 9, 10, 11, -1, -1, -1, -1, -1, -1, + 18, 48, 20, 21, -1, -1, 53, 54, 26, 27, + -1, -1, 59, -1, 32, -1, 34, 7, 8, 9, + 10, 11, -1, -1, 7, 8, 9, 10, 11, -1, + 48, -1, -1, -1, -1, 53, 54, -1, -1, -1, + -1, 59, 32, -1, 34, -1, -1, -1, -1, 32, + -1, 34, -1, -1, -1, -1, -1, -1, 48, -1, + -1, -1, -1, 53, 54, 48, -1, -1, -1, 59, + 53, 54, 40, 41, -1, -1, 59, 45, 46, 47, + -1, 49, 50, 51, 52, 53, 54, 55, 56, -1, + -1, -1, 60, 61, 62, 63, 40, 41, -1, -1, + -1, 45, 46, 47, -1, 49, 50, 51, -1, 53, + 54, 55, 56, -1, -1, -1, 60, 61, 62, 63, + 40, 41, -1, -1, -1, 45, 46, 47, -1, 49, + 50, 51, 52, 53, 54, 55, 56, -1, -1, 40, + 41, 61, 62, 63, 45, 46, 47, -1, 49, 50, + 51, -1, 53, 54, 55, 56, -1, -1, 40, 41, + 61, 62, 63, 45, 46, 47, -1, 49, 50, 51, + -1, -1, -1, 55, 56, -1, -1, 59, -1, 61, + 62, 63, 40, 41, -1, -1, -1, 45, 46, 47, + -1, 49, 50, 51, -1, -1, -1, 55, 56, -1, + -1, 40, 41, 61, 62, 63, 45, 46, 47, -1, + 49, 50, 51, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 61, 62, 63 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { - 0, 1, 7, 8, 9, 10, 11, 17, 19, 20, - 21, 24, 25, 26, 31, 32, 33, 47, 52, 53, - 58, 65, 67, 68, 69, 70, 71, 78, 79, 80, - 85, 86, 88, 91, 95, 58, 58, 82, 10, 87, - 11, 18, 23, 27, 28, 29, 30, 35, 89, 90, - 10, 11, 10, 10, 31, 68, 85, 36, 37, 10, - 85, 85, 85, 85, 0, 57, 66, 58, 51, 58, - 77, 85, 39, 40, 44, 45, 46, 48, 49, 50, - 52, 53, 54, 55, 60, 61, 62, 85, 96, 96, - 96, 63, 11, 11, 27, 11, 18, 27, 35, 90, - 92, 85, 22, 10, 35, 51, 59, 67, 77, 85, - 77, 85, 34, 51, 85, 85, 85, 85, 85, 85, - 85, 85, 85, 85, 85, 85, 85, 85, 85, 59, - 63, 59, 10, 11, 11, 11, 82, 10, 85, 85, - 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, - 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, - 21, 83, 83 + 0, 1, 7, 8, 9, 10, 11, 18, 20, 21, + 22, 25, 26, 27, 32, 33, 34, 48, 53, 54, + 59, 66, 68, 69, 70, 71, 72, 79, 80, 81, + 86, 87, 89, 92, 96, 58, 59, 59, 83, 10, + 88, 11, 19, 24, 28, 29, 30, 31, 36, 90, + 91, 10, 11, 10, 10, 32, 69, 86, 37, 38, + 10, 86, 86, 86, 86, 0, 58, 67, 59, 52, + 59, 78, 86, 40, 41, 45, 46, 47, 49, 50, + 51, 53, 54, 55, 56, 61, 62, 63, 86, 97, + 97, 97, 64, 11, 11, 28, 11, 19, 28, 36, + 91, 93, 86, 23, 10, 36, 52, 60, 68, 78, + 86, 78, 86, 35, 52, 86, 86, 86, 86, 86, + 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, + 60, 64, 60, 10, 11, 11, 11, 83, 10, 86, + 86, 60, 84, 60, 67, 83, 86, 86, 10, 94, + 71, 85, 87, 13, 36, 85, 70, 64, 67, 67, + 84, 36, 86, 84, 84, 10, 64, 95, 71, 17, + 86, 84, 16, 39, 83, 15, 39, 75, 76, 82, + 10, 85, 84, 85, 85, 74, 75, 77, 82, 83, + 76, 84, 78, 67, 85, 84, 84, 77, 84, 78, + 70, 39, 73, 35, 84, 17, 67, 67, 35, 84, + 83, 84, 83, 17, 16, 16, 85, 70, 71, 84, + 84 }; #define yyerrok (yyerrstatus = 0) @@ -1689,25 +1690,25 @@ yyparse () switch (yyn) { case 4: -#line 98 "engines/director/lingo/lingo-gr.y" +#line 97 "engines/director/lingo/lingo-gr.y" + { yyerrok; ;} + break; + + case 5: +#line 100 "engines/director/lingo/lingo-gr.y" { g_lingo->_linenumber++; g_lingo->_colnumber = 1; ;} break; - case 9: -#line 107 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lingo->c_xpop); ;} - break; - - case 11: + case 10: #line 109 "engines/director/lingo/lingo-gr.y" - { yyerrok; ;} + { g_lingo->code1(g_lingo->c_xpop); ;} break; case 12: -#line 112 "engines/director/lingo/lingo-gr.y" +#line 113 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_varpush); g_lingo->codeString((yyvsp[(4) - (4)].s)->c_str()); @@ -1717,7 +1718,7 @@ yyparse () break; case 13: -#line 118 "engines/director/lingo/lingo-gr.y" +#line 119 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_varpush); g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str()); @@ -1727,7 +1728,7 @@ yyparse () break; case 14: -#line 124 "engines/director/lingo/lingo-gr.y" +#line 125 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_varpush); g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str()); @@ -1737,65 +1738,65 @@ yyparse () break; case 15: -#line 131 "engines/director/lingo/lingo-gr.y" +#line 132 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_xpop); ;} break; case 19: -#line 140 "engines/director/lingo/lingo-gr.y" +#line 141 "engines/director/lingo/lingo-gr.y" { inst body = 0, end = 0; - WRITE_UINT32(&body, (yyvsp[(5) - (8)].code)); - WRITE_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; ;} + WRITE_UINT32(&body, (yyvsp[(5) - (7)].code)); + WRITE_UINT32(&end, (yyvsp[(6) - (7)].code)); + (*g_lingo->_currentScript)[(yyvsp[(1) - (7)].code) + 1] = body; /* body of loop */ + (*g_lingo->_currentScript)[(yyvsp[(1) - (7)].code) + 2] = end; ;} break; case 20: -#line 151 "engines/director/lingo/lingo-gr.y" +#line 152 "engines/director/lingo/lingo-gr.y" { inst init = 0, finish = 0, body = 0, end = 0, inc = 0; - WRITE_UINT32(&init, (yyvsp[(3) - (11)].code)); - WRITE_UINT32(&finish, (yyvsp[(6) - (11)].code)); - WRITE_UINT32(&body, (yyvsp[(8) - (11)].code)); - WRITE_UINT32(&end, (yyvsp[(9) - (11)].code)); + WRITE_UINT32(&init, (yyvsp[(3) - (10)].code)); + WRITE_UINT32(&finish, (yyvsp[(6) - (10)].code)); + WRITE_UINT32(&body, (yyvsp[(8) - (10)].code)); + WRITE_UINT32(&end, (yyvsp[(9) - (10)].code)); WRITE_UINT32(&inc, 1); - (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 1] = init; /* initial count value */ - (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 2] = finish;/* final count value */ - (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 3] = body; /* body of loop */ - (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 4] = inc; /* increment */ - (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 5] = end; ;} + (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 1] = init; /* initial count value */ + (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 2] = finish;/* final count value */ + (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 3] = body; /* body of loop */ + (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 4] = inc; /* increment */ + (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 5] = end; ;} break; case 21: -#line 167 "engines/director/lingo/lingo-gr.y" +#line 168 "engines/director/lingo/lingo-gr.y" { inst init = 0, finish = 0, body = 0, end = 0, inc = 0; - WRITE_UINT32(&init, (yyvsp[(3) - (12)].code)); - WRITE_UINT32(&finish, (yyvsp[(7) - (12)].code)); - WRITE_UINT32(&body, (yyvsp[(9) - (12)].code)); - WRITE_UINT32(&end, (yyvsp[(10) - (12)].code)); + WRITE_UINT32(&init, (yyvsp[(3) - (11)].code)); + WRITE_UINT32(&finish, (yyvsp[(7) - (11)].code)); + WRITE_UINT32(&body, (yyvsp[(9) - (11)].code)); + WRITE_UINT32(&end, (yyvsp[(10) - (11)].code)); WRITE_UINT32(&inc, -1); - (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 1] = init; /* initial count value */ - (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 2] = finish;/* final count value */ - (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 3] = body; /* body of loop */ - (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 4] = inc; /* increment */ - (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 5] = end; ;} + (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 1] = init; /* initial count value */ + (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 2] = finish;/* final count value */ + (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 3] = body; /* body of loop */ + (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 4] = inc; /* increment */ + (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 5] = end; ;} break; case 22: -#line 181 "engines/director/lingo/lingo-gr.y" +#line 182 "engines/director/lingo/lingo-gr.y" { inst then = 0, end = 0; - WRITE_UINT32(&then, (yyvsp[(5) - (8)].code)); - WRITE_UINT32(&end, (yyvsp[(6) - (8)].code)); - (*g_lingo->_currentScript)[(yyvsp[(1) - (8)].code) + 1] = then; /* thenpart */ - (*g_lingo->_currentScript)[(yyvsp[(1) - (8)].code) + 3] = end; /* end, if cond fails */ + WRITE_UINT32(&then, (yyvsp[(5) - (7)].code)); + WRITE_UINT32(&end, (yyvsp[(6) - (7)].code)); + (*g_lingo->_currentScript)[(yyvsp[(1) - (7)].code) + 1] = then; /* thenpart */ + (*g_lingo->_currentScript)[(yyvsp[(1) - (7)].code) + 3] = end; /* end, if cond fails */ g_lingo->processIf(0, 0); ;} break; case 23: -#line 188 "engines/director/lingo/lingo-gr.y" +#line 189 "engines/director/lingo/lingo-gr.y" { inst then = 0, else1 = 0, end = 0; WRITE_UINT32(&then, (yyvsp[(5) - (11)].code)); @@ -1808,20 +1809,20 @@ yyparse () break; case 24: -#line 197 "engines/director/lingo/lingo-gr.y" +#line 198 "engines/director/lingo/lingo-gr.y" { inst then = 0, else1 = 0, end = 0; - WRITE_UINT32(&then, (yyvsp[(5) - (12)].code)); - WRITE_UINT32(&else1, (yyvsp[(7) - (12)].code)); - WRITE_UINT32(&end, (yyvsp[(9) - (12)].code)); - (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 1] = then; /* thenpart */ - (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 2] = else1; /* elsepart */ - (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 3] = end; /* end, if cond fails */ - g_lingo->processIf(0, (yyvsp[(9) - (12)].code)); ;} + WRITE_UINT32(&then, (yyvsp[(5) - (11)].code)); + WRITE_UINT32(&else1, (yyvsp[(7) - (11)].code)); + WRITE_UINT32(&end, (yyvsp[(9) - (11)].code)); + (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 1] = then; /* thenpart */ + (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 2] = else1; /* elsepart */ + (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 3] = end; /* end, if cond fails */ + g_lingo->processIf(0, (yyvsp[(9) - (11)].code)); ;} break; case 25: -#line 206 "engines/director/lingo/lingo-gr.y" +#line 207 "engines/director/lingo/lingo-gr.y" { inst then = 0, else1 = 0, end = 0; WRITE_UINT32(&then, (yyvsp[(4) - (6)].code)); @@ -1835,7 +1836,7 @@ yyparse () break; case 26: -#line 216 "engines/director/lingo/lingo-gr.y" +#line 217 "engines/director/lingo/lingo-gr.y" { inst then = 0, else1 = 0, end = 0; WRITE_UINT32(&then, (yyvsp[(4) - (10)].code)); @@ -1849,7 +1850,7 @@ yyparse () break; case 27: -#line 226 "engines/director/lingo/lingo-gr.y" +#line 227 "engines/director/lingo/lingo-gr.y" { inst then = 0, else1 = 0, end = 0; WRITE_UINT32(&then, (yyvsp[(4) - (10)].code)); @@ -1863,17 +1864,17 @@ yyparse () break; case 28: -#line 237 "engines/director/lingo/lingo-gr.y" +#line 238 "engines/director/lingo/lingo-gr.y" { (yyval.code) = 0; ;} break; case 29: -#line 238 "engines/director/lingo/lingo-gr.y" +#line 239 "engines/director/lingo/lingo-gr.y" { (yyval.code) = (yyvsp[(2) - (3)].code); ;} break; case 34: -#line 249 "engines/director/lingo/lingo-gr.y" +#line 250 "engines/director/lingo/lingo-gr.y" { inst then = 0; WRITE_UINT32(&then, (yyvsp[(4) - (6)].code)); @@ -1883,7 +1884,7 @@ yyparse () break; case 36: -#line 258 "engines/director/lingo/lingo-gr.y" +#line 259 "engines/director/lingo/lingo-gr.y" { inst then = 0; WRITE_UINT32(&then, (yyvsp[(4) - (5)].code)); @@ -1893,22 +1894,22 @@ yyparse () break; case 37: -#line 266 "engines/director/lingo/lingo-gr.y" +#line 267 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(STOP); ;} break; case 38: -#line 267 "engines/director/lingo/lingo-gr.y" +#line 268 "engines/director/lingo/lingo-gr.y" { g_lingo->code2(g_lingo->c_eq, STOP); ;} break; case 40: -#line 270 "engines/director/lingo/lingo-gr.y" +#line 271 "engines/director/lingo/lingo-gr.y" { (yyval.code) = g_lingo->code3(g_lingo->c_repeatwhilecode, STOP, STOP); ;} break; case 41: -#line 272 "engines/director/lingo/lingo-gr.y" +#line 273 "engines/director/lingo/lingo-gr.y" { (yyval.code) = g_lingo->code3(g_lingo->c_repeatwithcode, STOP, STOP); g_lingo->code3(STOP, STOP, STOP); @@ -1917,7 +1918,7 @@ yyparse () break; case 42: -#line 278 "engines/director/lingo/lingo-gr.y" +#line 279 "engines/director/lingo/lingo-gr.y" { (yyval.code) = g_lingo->code1(g_lingo->c_ifcode); g_lingo->code3(STOP, STOP, STOP); @@ -1926,7 +1927,7 @@ yyparse () break; case 43: -#line 284 "engines/director/lingo/lingo-gr.y" +#line 285 "engines/director/lingo/lingo-gr.y" { inst skipEnd; WRITE_UINT32(&skipEnd, 1); // We have to skip end to avoid multiple executions @@ -1936,21 +1937,16 @@ yyparse () break; case 44: -#line 291 "engines/director/lingo/lingo-gr.y" +#line 292 "engines/director/lingo/lingo-gr.y" { (yyval.code) = g_lingo->_currentScript->size(); ;} break; case 45: -#line 293 "engines/director/lingo/lingo-gr.y" +#line 294 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(STOP); (yyval.code) = g_lingo->_currentScript->size(); ;} break; - case 46: -#line 295 "engines/director/lingo/lingo-gr.y" - { (yyval.code) = g_lingo->_currentScript->size(); ;} - break; - - case 49: + case 48: #line 300 "engines/director/lingo/lingo-gr.y" { (yyval.code) = g_lingo->code1(g_lingo->c_constpush); @@ -1959,21 +1955,21 @@ yyparse () g_lingo->code1(i); ;} break; - case 50: + case 49: #line 305 "engines/director/lingo/lingo-gr.y" { (yyval.code) = g_lingo->code1(g_lingo->c_fconstpush); g_lingo->codeFloat((yyvsp[(1) - (1)].f)); ;} break; - case 51: + case 50: #line 308 "engines/director/lingo/lingo-gr.y" { (yyval.code) = g_lingo->code1(g_lingo->c_stringpush); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); ;} break; - case 52: + case 51: #line 311 "engines/director/lingo/lingo-gr.y" { if ((yyvsp[(3) - (4)].narg) != g_lingo->_builtins[*(yyvsp[(1) - (4)].s)]->nargs) @@ -1983,7 +1979,7 @@ yyparse () delete (yyvsp[(1) - (4)].s); ;} break; - case 53: + case 52: #line 317 "engines/director/lingo/lingo-gr.y" { (yyval.code) = g_lingo->code1(g_lingo->c_call); @@ -1995,155 +1991,155 @@ yyparse () delete (yyvsp[(1) - (4)].s); ;} break; - case 54: + case 53: #line 325 "engines/director/lingo/lingo-gr.y" { (yyval.code) = g_lingo->codeId(*(yyvsp[(1) - (1)].s)); delete (yyvsp[(1) - (1)].s); ;} break; - case 56: + case 55: #line 329 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_add); ;} break; - case 57: + case 56: #line 330 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_sub); ;} break; - case 58: + case 57: #line 331 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_mul); ;} break; - case 59: + case 58: #line 332 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_div); ;} break; - case 60: + case 59: #line 333 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_gt); ;} break; - case 61: + case 60: #line 334 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_lt); ;} break; - case 62: + case 61: #line 335 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_neq); ;} break; - case 63: + case 62: #line 336 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_ge); ;} break; - case 64: + case 63: #line 337 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_le); ;} break; - case 65: + case 64: #line 338 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_and); ;} break; - case 66: + case 65: #line 339 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_or); ;} break; - case 67: + case 66: #line 340 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_not); ;} break; - case 68: + case 67: #line 341 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_ampersand); ;} break; - case 69: + case 68: #line 342 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_concat); ;} break; - case 70: + case 69: #line 343 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_contains); ;} break; - case 71: + case 70: #line 344 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_starts); ;} break; - case 72: + case 71: #line 345 "engines/director/lingo/lingo-gr.y" { (yyval.code) = (yyvsp[(2) - (2)].code); ;} break; - case 73: + case 72: #line 346 "engines/director/lingo/lingo-gr.y" { (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;} break; - case 74: + case 73: #line 347 "engines/director/lingo/lingo-gr.y" { (yyval.code) = (yyvsp[(2) - (3)].code); ;} break; - case 75: + case 74: #line 350 "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 76: + case 75: #line 351 "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 77: + case 76: #line 352 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_printtop); ;} break; - case 79: + case 78: #line 354 "engines/director/lingo/lingo-gr.y" { g_lingo->code2(g_lingo->c_constpush, (inst)0); // Push fake value on stack g_lingo->code1(g_lingo->c_procret); ;} break; - case 81: + case 80: #line 359 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_global); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); delete (yyvsp[(1) - (1)].s); ;} break; - case 82: + case 81: #line 360 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_global); g_lingo->codeString((yyvsp[(3) - (3)].s)->c_str()); delete (yyvsp[(3) - (3)].s); ;} break; - case 83: + case 82: #line 371 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_gotoloop); ;} break; - case 84: + case 83: #line 372 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_gotonext); ;} break; - case 85: + case 84: #line 373 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_gotoprevious); ;} break; - case 86: + case 85: #line 374 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_goto); @@ -2152,7 +2148,7 @@ yyparse () delete (yyvsp[(2) - (2)].s); ;} break; - case 87: + case 86: #line 379 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_goto); @@ -2162,7 +2158,7 @@ yyparse () delete (yyvsp[(3) - (3)].s); ;} break; - case 88: + case 87: #line 385 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_goto); @@ -2171,81 +2167,81 @@ yyparse () delete (yyvsp[(2) - (2)].s); ;} break; - case 89: + case 88: #line 392 "engines/director/lingo/lingo-gr.y" { (yyval.s) = (yyvsp[(3) - (3)].s); ;} break; - case 90: + case 89: #line 393 "engines/director/lingo/lingo-gr.y" { (yyval.s) = (yyvsp[(2) - (2)].s); ;} break; - case 91: + case 90: #line 394 "engines/director/lingo/lingo-gr.y" { (yyval.s) = (yyvsp[(2) - (2)].s); ;} break; - case 92: + case 91: #line 395 "engines/director/lingo/lingo-gr.y" { (yyval.s) = (yyvsp[(1) - (1)].s); ;} break; - case 93: + case 92: #line 398 "engines/director/lingo/lingo-gr.y" { (yyval.s) = (yyvsp[(3) - (3)].s); ;} break; - case 94: + case 93: #line 399 "engines/director/lingo/lingo-gr.y" { (yyval.s) = (yyvsp[(2) - (2)].s); ;} break; - case 95: + case 94: #line 400 "engines/director/lingo/lingo-gr.y" { (yyval.s) = (yyvsp[(3) - (3)].s); ;} break; - case 96: + case 95: #line 428 "engines/director/lingo/lingo-gr.y" { g_lingo->_indef = true; ;} break; - case 97: + case 96: #line 429 "engines/director/lingo/lingo-gr.y" { g_lingo->code2(g_lingo->c_constpush, (inst)0); // Push fake value on stack g_lingo->code1(g_lingo->c_procret); - g_lingo->define(*(yyvsp[(2) - (8)].s), (yyvsp[(4) - (8)].code), (yyvsp[(5) - (8)].narg)); + g_lingo->define(*(yyvsp[(2) - (9)].s), (yyvsp[(4) - (9)].code), (yyvsp[(5) - (9)].narg)); g_lingo->_indef = false; ;} break; - case 98: + case 97: #line 435 "engines/director/lingo/lingo-gr.y" { (yyval.narg) = 0; ;} break; - case 99: + case 98: #line 436 "engines/director/lingo/lingo-gr.y" { g_lingo->codeArg((yyvsp[(1) - (1)].s)); (yyval.narg) = 1; ;} break; - case 100: + case 99: #line 437 "engines/director/lingo/lingo-gr.y" { g_lingo->codeArg((yyvsp[(3) - (3)].s)); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;} break; - case 101: + case 100: #line 438 "engines/director/lingo/lingo-gr.y" { g_lingo->codeArg((yyvsp[(4) - (4)].s)); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;} break; - case 102: + case 101: #line 440 "engines/director/lingo/lingo-gr.y" { g_lingo->codeArgStore(); ;} break; - case 103: + case 102: #line 443 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_call); @@ -2255,24 +2251,24 @@ yyparse () g_lingo->code1(numpar); ;} break; - case 104: + case 103: #line 451 "engines/director/lingo/lingo-gr.y" { (yyval.narg) = 0; ;} break; - case 105: + case 104: #line 452 "engines/director/lingo/lingo-gr.y" { (yyval.narg) = 1; ;} break; - case 106: + case 105: #line 453 "engines/director/lingo/lingo-gr.y" { (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;} break; /* Line 1267 of yacc.c. */ -#line 2276 "engines/director/lingo/lingo-gr.cpp" +#line 2272 "engines/director/lingo/lingo-gr.cpp" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); diff --git a/engines/director/lingo/lingo-gr.h b/engines/director/lingo/lingo-gr.h index b809af7775cc..bf99268aed87 100644 --- a/engines/director/lingo/lingo-gr.h +++ b/engines/director/lingo/lingo-gr.h @@ -52,41 +52,42 @@ tDOWN = 268, tELSE = 269, tNLELSIF = 270, - tEND = 271, - tEXIT = 272, - tFRAME = 273, - tGLOBAL = 274, - tGO = 275, - tIF = 276, - tINTO = 277, - tLOOP = 278, - tMACRO = 279, - tMCI = 280, - tMCIWAIT = 281, - tMOVIE = 282, - tNEXT = 283, - tOF = 284, - tPREVIOUS = 285, - tPUT = 286, - tREPEAT = 287, - tSET = 288, - tTHEN = 289, - tTO = 290, - tWITH = 291, - tWHILE = 292, - tNLELSE = 293, - tGE = 294, - tLE = 295, - tGT = 296, - tLT = 297, - tEQ = 298, - tNEQ = 299, - tAND = 300, - tOR = 301, - tNOT = 302, - tCONCAT = 303, - tCONTAINS = 304, - tSTARTS = 305 + tENDIF = 271, + tENDREPEAT = 272, + tEXIT = 273, + tFRAME = 274, + tGLOBAL = 275, + tGO = 276, + tIF = 277, + tINTO = 278, + tLOOP = 279, + tMACRO = 280, + tMCI = 281, + tMCIWAIT = 282, + tMOVIE = 283, + tNEXT = 284, + tOF = 285, + tPREVIOUS = 286, + tPUT = 287, + tREPEAT = 288, + tSET = 289, + tTHEN = 290, + tTO = 291, + tWITH = 292, + tWHILE = 293, + tNLELSE = 294, + tGE = 295, + tLE = 296, + tGT = 297, + tLT = 298, + tEQ = 299, + tNEQ = 300, + tAND = 301, + tOR = 302, + tNOT = 303, + tCONCAT = 304, + tCONTAINS = 305, + tSTARTS = 306 }; #endif /* Tokens. */ @@ -103,48 +104,49 @@ #define tDOWN 268 #define tELSE 269 #define tNLELSIF 270 -#define tEND 271 -#define tEXIT 272 -#define tFRAME 273 -#define tGLOBAL 274 -#define tGO 275 -#define tIF 276 -#define tINTO 277 -#define tLOOP 278 -#define tMACRO 279 -#define tMCI 280 -#define tMCIWAIT 281 -#define tMOVIE 282 -#define tNEXT 283 -#define tOF 284 -#define tPREVIOUS 285 -#define tPUT 286 -#define tREPEAT 287 -#define tSET 288 -#define tTHEN 289 -#define tTO 290 -#define tWITH 291 -#define tWHILE 292 -#define tNLELSE 293 -#define tGE 294 -#define tLE 295 -#define tGT 296 -#define tLT 297 -#define tEQ 298 -#define tNEQ 299 -#define tAND 300 -#define tOR 301 -#define tNOT 302 -#define tCONCAT 303 -#define tCONTAINS 304 -#define tSTARTS 305 +#define tENDIF 271 +#define tENDREPEAT 272 +#define tEXIT 273 +#define tFRAME 274 +#define tGLOBAL 275 +#define tGO 276 +#define tIF 277 +#define tINTO 278 +#define tLOOP 279 +#define tMACRO 280 +#define tMCI 281 +#define tMCIWAIT 282 +#define tMOVIE 283 +#define tNEXT 284 +#define tOF 285 +#define tPREVIOUS 286 +#define tPUT 287 +#define tREPEAT 288 +#define tSET 289 +#define tTHEN 290 +#define tTO 291 +#define tWITH 292 +#define tWHILE 293 +#define tNLELSE 294 +#define tGE 295 +#define tLE 296 +#define tGT 297 +#define tLT 298 +#define tEQ 299 +#define tNEQ 300 +#define tAND 301 +#define tOR 302 +#define tNOT 303 +#define tCONCAT 304 +#define tCONTAINS 305 +#define tSTARTS 306 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 65 "engines/director/lingo/lingo-gr.y" +#line 66 "engines/director/lingo/lingo-gr.y" { Common::String *s; int i; @@ -153,7 +155,7 @@ typedef union YYSTYPE int narg; /* number of arguments */ } /* Line 1529 of yacc.c. */ -#line 157 "engines/director/lingo/lingo-gr.hpp" +#line 159 "engines/director/lingo/lingo-gr.hpp" YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y index 3006176583d9..4e1778fb7bd6 100644 --- a/engines/director/lingo/lingo-gr.y +++ b/engines/director/lingo/lingo-gr.y @@ -56,9 +56,10 @@ extern int yylex(); extern int yyparse(); -void yyerror(char *s) { error("%s at line %d col %d", s, Director::g_lingo->_linenumber, Director::g_lingo->_colnumber); } using namespace Director; +void yyerror(char *s) { g_lingo->_hadError = true; warning("%s at line %d col %d", s, Director::g_lingo->_linenumber, Director::g_lingo->_colnumber); } + %} @@ -74,7 +75,7 @@ using namespace Director; %token INT %token FLOAT %token BLTIN ID STRING HANDLER -%token tDOWN tELSE tNLELSIF tEND tEXIT tFRAME tGLOBAL tGO tIF tINTO tLOOP tMACRO +%token tDOWN tELSE tNLELSIF tENDIF tENDREPEAT tEXIT tFRAME tGLOBAL tGO tIF tINTO tLOOP tMACRO %token tMCI tMCIWAIT tMOVIE tNEXT tOF tPREVIOUS tPUT tREPEAT tSET tTHEN tTO %token tWITH tWHILE tNLELSE %token tGE tLE tGT tLT tEQ tNEQ tAND tOR tNOT @@ -93,6 +94,7 @@ using namespace Director; program: program nl programline | programline + | error '\n' { yyerrok; } ; nl: '\n' { @@ -100,13 +102,12 @@ nl: '\n' { g_lingo->_colnumber = 1; } -programline: +programline: /* empty */ | defn | func | macro | asgn { g_lingo->code1(g_lingo->c_xpop); } | stmt - | error { yyerrok; } ; asgn: tPUT expr tINTO ID { @@ -137,7 +138,7 @@ stmt: stmtoneliner // statements // end repeat // - | repeatwhile '(' cond ')' stmtlist end tEND tREPEAT { + | repeatwhile '(' cond ')' stmtlist end tENDREPEAT { inst body = 0, end = 0; WRITE_UINT32(&body, $5); WRITE_UINT32(&end, $6); @@ -148,7 +149,7 @@ stmt: stmtoneliner // statements // end repeat // - | repeatwith '=' expr end tTO expr end stmtlist end tEND tREPEAT { + | repeatwith '=' expr end tTO expr end stmtlist end tENDREPEAT { inst init = 0, finish = 0, body = 0, end = 0, inc = 0; WRITE_UINT32(&init, $3); WRITE_UINT32(&finish, $6); @@ -164,7 +165,7 @@ stmt: stmtoneliner // statements // end repeat // - | repeatwith '=' expr end tDOWN tTO expr end stmtlist end tEND tREPEAT { + | repeatwith '=' expr end tDOWN tTO expr end stmtlist end tENDREPEAT { inst init = 0, finish = 0, body = 0, end = 0, inc = 0; WRITE_UINT32(&init, $3); WRITE_UINT32(&finish, $7); @@ -178,14 +179,14 @@ stmt: stmtoneliner (*g_lingo->_currentScript)[$1 + 5] = end; } /* end, if cond fails */ ; -ifstmt: if cond tTHEN nl stmtlist end tEND tIF { +ifstmt: if cond tTHEN nl stmtlist end tENDIF { inst then = 0, end = 0; WRITE_UINT32(&then, $5); WRITE_UINT32(&end, $6); (*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 tNLELSE stmtlist end tEND tIF { + | if cond tTHEN nl stmtlist end tNLELSE stmtlist end nl tENDIF { inst then = 0, else1 = 0, end = 0; WRITE_UINT32(&then, $5); WRITE_UINT32(&else1, $8); @@ -194,7 +195,7 @@ ifstmt: if cond tTHEN nl stmtlist end tEND tIF { (*g_lingo->_currentScript)[$1 + 2] = else1; /* elsepart */ (*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */ g_lingo->processIf(0, 0); } - | if cond tTHEN nl stmtlist end begin elseifstmt end nl tEND tIF { + | if cond tTHEN nl stmtlist end begin elseifstmt end nl tENDIF { inst then = 0, else1 = 0, end = 0; WRITE_UINT32(&then, $5); WRITE_UINT32(&else1, $7); @@ -292,9 +293,8 @@ begin: /* nothing */ { $$ = g_lingo->_currentScript->size(); } ; end: /* nothing */ { g_lingo->code1(STOP); $$ = g_lingo->_currentScript->size(); } ; -stmtlist: /* nothing */ { $$ = g_lingo->_currentScript->size(); } - | stmtlist nl - | stmtlist stmt +stmtlist: stmtlist nl stmt + | stmt ; expr: INT { @@ -426,7 +426,7 @@ gotomovie: tOF tMOVIE STRING { $$ = $3; } // See also: // on keyword defn: tMACRO ID { g_lingo->_indef = true; } - begin argdef nl argstore stmtlist { + begin argdef nl argstore stmtlist nl { g_lingo->code2(g_lingo->c_constpush, (inst)0); // Push fake value on stack g_lingo->code1(g_lingo->c_procret); g_lingo->define(*$2, $4, $5); @@ -435,7 +435,7 @@ defn: tMACRO ID { g_lingo->_indef = true; } argdef: /* nothing */ { $$ = 0; } | ID { g_lingo->codeArg($1); $$ = 1; } | argdef ',' ID { g_lingo->codeArg($3); $$ = $1 + 1; } - | argdef nl ',' ID { g_lingo->codeArg($4); $$ = $1 + 1; } + | argdef nl ',' ID { g_lingo->codeArg($4); $$ = $1 + 1; } ; argstore: /* nothing */ { g_lingo->codeArgStore(); } ; diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp index b419574cfcfe..737548ff33c3 100644 --- a/engines/director/lingo/lingo-lex.cpp +++ b/engines/director/lingo/lingo-lex.cpp @@ -364,8 +364,8 @@ static void yy_fatal_error (yyconst char msg[] ); *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; -#define YY_NUM_RULES 46 -#define YY_END_OF_BUFFER 47 +#define YY_NUM_RULES 47 +#define YY_END_OF_BUFFER 48 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -373,25 +373,25 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_accept[152] = +static yyconst flex_int16_t yy_accept[161] = { 0, - 0, 0, 47, 45, 3, 43, 43, 45, 45, 42, - 42, 42, 41, 42, 42, 39, 39, 39, 39, 39, - 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, - 39, 39, 2, 2, 3, 43, 0, 0, 43, 0, - 44, 38, 1, 40, 41, 37, 35, 36, 39, 39, - 39, 39, 39, 39, 39, 39, 39, 15, 7, 39, - 39, 39, 39, 39, 39, 39, 24, 25, 39, 39, - 39, 39, 39, 39, 32, 39, 39, 2, 2, 0, - 1, 40, 4, 39, 39, 39, 11, 39, 39, 39, - 39, 39, 39, 19, 39, 39, 23, 39, 27, 39, - - 29, 39, 39, 39, 39, 0, 39, 6, 10, 12, - 39, 39, 16, 17, 39, 39, 39, 22, 39, 39, - 39, 31, 39, 33, 0, 39, 13, 39, 18, 39, - 21, 39, 39, 39, 34, 9, 39, 14, 39, 39, - 28, 30, 0, 39, 20, 39, 0, 5, 26, 8, - 0 + 0, 0, 48, 46, 3, 44, 44, 46, 46, 43, + 43, 43, 42, 43, 43, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 2, 2, 3, 44, 0, 0, 44, 0, + 45, 39, 1, 41, 42, 38, 36, 37, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 16, 7, 40, + 40, 40, 40, 40, 40, 40, 25, 26, 40, 40, + 40, 40, 40, 40, 33, 40, 40, 2, 2, 0, + 1, 41, 4, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 20, 40, 40, 24, 40, 28, 40, + + 30, 40, 40, 40, 40, 0, 40, 6, 10, 0, + 13, 40, 40, 17, 18, 40, 40, 40, 23, 40, + 40, 40, 32, 40, 34, 0, 40, 0, 0, 14, + 40, 19, 40, 22, 40, 40, 40, 35, 9, 40, + 11, 0, 15, 40, 40, 29, 31, 0, 40, 0, + 21, 40, 0, 5, 0, 27, 8, 0, 12, 0 } ; static yyconst flex_int32_t yy_ec[256] = @@ -436,49 +436,51 @@ static yyconst flex_int32_t yy_meta[58] = 4, 4, 4, 4, 4, 4, 4 } ; -static yyconst flex_int16_t yy_base[155] = +static yyconst flex_int16_t yy_base[164] = { 0, - 0, 56, 186, 352, 60, 64, 68, 72, 173, 352, - 143, 141, 49, 65, 132, 53, 0, 53, 54, 58, + 0, 56, 249, 374, 60, 64, 68, 72, 187, 374, + 178, 170, 49, 65, 138, 53, 0, 53, 54, 58, 54, 61, 70, 59, 83, 95, 79, 62, 98, 105, - 103, 104, 138, 151, 157, 125, 161, 165, 169, 132, - 352, 352, 0, 108, 123, 352, 352, 352, 0, 117, + 103, 104, 138, 151, 157, 125, 161, 165, 169, 144, + 374, 374, 0, 134, 123, 374, 374, 374, 0, 117, 141, 134, 144, 158, 154, 163, 152, 0, 0, 149, 154, 166, 162, 153, 152, 159, 0, 0, 173, 162, 166, 165, 189, 191, 0, 188, 181, 217, 225, 192, - 0, 85, 0, 191, 197, 206, 0, 199, 209, 220, + 0, 127, 0, 191, 197, 206, 86, 199, 209, 220, 211, 211, 211, 207, 214, 211, 0, 212, 0, 229, - 0, 220, 224, 228, 232, 226, 240, 0, 0, 0, - 246, 251, 0, 0, 240, 254, 254, 0, 252, 264, - 249, 0, 263, 0, 264, 261, 0, 261, 0, 267, - 0, 264, 261, 263, 0, 86, 269, 0, 266, 266, - 0, 0, 298, 277, 0, 278, 290, 0, 0, 352, - 352, 343, 89, 347 + 0, 220, 224, 228, 232, 226, 240, 0, 0, 263, + 0, 247, 254, 0, 0, 245, 260, 260, 0, 257, + 266, 251, 0, 265, 0, 266, 264, 269, 271, 0, + 267, 0, 272, 0, 270, 267, 269, 0, 91, 278, + 374, 281, 0, 283, 283, 0, 0, 320, 287, 304, + 0, 296, 304, 0, 313, 0, 374, 298, 374, 374, + 365, 115, 369 } ; -static yyconst flex_int16_t yy_def[155] = +static yyconst flex_int16_t yy_def[164] = { 0, - 151, 1, 151, 151, 151, 151, 151, 151, 152, 151, - 151, 151, 151, 151, 151, 153, 153, 153, 153, 153, - 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, - 153, 153, 151, 151, 151, 151, 151, 151, 151, 152, - 151, 151, 154, 151, 151, 151, 151, 151, 153, 153, - 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, - 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, - 153, 153, 153, 153, 153, 153, 153, 151, 151, 151, - 154, 151, 153, 153, 153, 153, 153, 153, 153, 153, - 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, - - 153, 153, 153, 153, 153, 151, 153, 153, 153, 153, - 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, - 153, 153, 153, 153, 151, 153, 153, 153, 153, 153, - 153, 153, 153, 153, 153, 151, 153, 153, 153, 153, - 153, 153, 151, 153, 153, 153, 151, 153, 153, 151, - 0, 151, 151, 151 + 160, 1, 160, 160, 160, 160, 160, 160, 161, 160, + 160, 160, 160, 160, 160, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 160, 160, 160, 160, 160, 160, 160, 161, + 160, 160, 163, 160, 160, 160, 160, 160, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 160, 160, 160, + 163, 160, 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, + + 162, 162, 162, 162, 162, 160, 162, 162, 162, 160, + 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 160, 162, 160, 160, 162, + 162, 162, 162, 162, 162, 162, 162, 162, 160, 162, + 160, 160, 162, 162, 162, 162, 162, 160, 162, 160, + 162, 162, 160, 162, 160, 162, 160, 160, 160, 0, + 160, 160, 160 } ; -static yyconst flex_int16_t yy_nxt[410] = +static yyconst flex_int16_t yy_nxt[432] = { 0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 4, 13, 14, 10, 15, 16, 17, 18, 19, 20, 21, @@ -488,46 +490,49 @@ static yyconst flex_int16_t yy_nxt[410] = 29, 30, 31, 17, 17, 32, 17, 33, 44, 45, 34, 35, 36, 36, 37, 38, 39, 39, 38, 38, 39, 39, 38, 37, 36, 36, 37, 46, 47, 50, - 51, 52, 53, 56, 54, 57, 61, 143, 58, 59, - 143, 69, 49, 55, 70, 82, 60, 62, 67, 63, + 51, 52, 53, 56, 54, 57, 61, 110, 58, 59, + 110, 69, 148, 55, 70, 148, 60, 62, 67, 63, 50, 51, 52, 53, 56, 54, 57, 61, 68, 58, - 64, 59, 69, 65, 55, 70, 71, 60, 82, 62, + 64, 59, 69, 65, 55, 70, 71, 60, 49, 62, 67, 63, 66, 72, 74, 76, 77, 36, 36, 68, - 75, 64, 44, 45, 83, 65, 73, 41, 71, 78, - 36, 36, 79, 66, 48, 72, 74, 76, 77, 43, - 42, 75, 79, 36, 36, 79, 83, 73, 35, 36, + 75, 64, 44, 45, 83, 65, 73, 82, 71, 78, + 36, 36, 79, 66, 82, 72, 74, 76, 77, 41, + 48, 75, 79, 36, 36, 79, 83, 73, 35, 36, 36, 37, 37, 36, 36, 37, 38, 84, 85, 38, - 38, 39, 39, 38, 86, 87, 88, 89, 41, 90, - 91, 92, 93, 80, 94, 151, 95, 96, 84, 85, - 97, 98, 151, 99, 100, 86, 101, 87, 88, 89, + 38, 39, 39, 38, 86, 87, 88, 89, 43, 90, + 91, 92, 93, 80, 94, 42, 95, 96, 84, 85, + 97, 98, 41, 99, 100, 86, 101, 87, 88, 89, 90, 91, 92, 102, 93, 80, 94, 95, 96, 103, 104, 97, 105, 98, 99, 100, 106, 101, 78, 36, 36, 79, 107, 108, 109, 102, 79, 36, 36, 79, - 110, 103, 104, 105, 111, 112, 117, 106, 113, 114, - 115, 116, 118, 107, 108, 119, 109, 120, 151, 121, - 122, 110, 123, 124, 126, 111, 125, 112, 117, 113, - 114, 115, 116, 118, 127, 128, 119, 129, 130, 120, - 121, 122, 131, 123, 132, 124, 126, 125, 133, 151, - 134, 135, 136, 137, 151, 138, 127, 128, 129, 139, - 130, 140, 141, 142, 131, 144, 132, 145, 146, 143, - - 133, 134, 143, 135, 136, 137, 138, 148, 149, 150, - 151, 139, 140, 141, 142, 151, 144, 151, 145, 146, - 147, 151, 151, 151, 151, 151, 151, 151, 148, 149, - 151, 150, 151, 151, 151, 151, 151, 151, 151, 151, - 151, 151, 147, 40, 151, 40, 40, 81, 151, 151, - 81, 3, 151, 151, 151, 151, 151, 151, 151, 151, - 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, - 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, - 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, - 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, - - 151, 151, 151, 151, 151, 151, 151, 151, 151 + 111, 103, 104, 105, 112, 113, 118, 106, 114, 115, + 116, 117, 119, 107, 108, 120, 109, 121, 160, 122, + 123, 111, 124, 125, 127, 112, 126, 113, 118, 114, + 115, 116, 117, 119, 110, 130, 120, 110, 131, 121, + 122, 123, 132, 124, 133, 125, 127, 126, 134, 135, + 136, 160, 137, 138, 139, 128, 140, 130, 141, 142, + 131, 143, 129, 132, 144, 160, 133, 145, 146, 147, + + 134, 135, 136, 137, 149, 138, 139, 128, 140, 150, + 141, 142, 143, 129, 151, 152, 144, 154, 145, 146, + 147, 148, 155, 157, 148, 149, 156, 158, 160, 159, + 150, 160, 160, 160, 160, 151, 152, 160, 154, 160, + 160, 160, 153, 160, 155, 157, 160, 156, 160, 158, + 159, 160, 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 153, 40, 160, 40, 40, 81, + 160, 160, 81, 3, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, + + 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, + 160 } ; -static yyconst flex_int16_t yy_chk[410] = +static yyconst flex_int16_t yy_chk[432] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -537,43 +542,46 @@ static yyconst flex_int16_t yy_chk[410] = 1, 1, 1, 1, 1, 1, 1, 2, 13, 13, 2, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 14, 14, 16, - 18, 19, 20, 21, 20, 22, 24, 136, 22, 23, - 136, 28, 153, 20, 28, 82, 23, 25, 27, 25, + 18, 19, 20, 21, 20, 22, 24, 87, 22, 23, + 87, 28, 139, 20, 28, 139, 23, 25, 27, 25, 16, 18, 19, 20, 21, 20, 22, 24, 27, 22, - 25, 23, 28, 26, 20, 28, 29, 23, 44, 25, + 25, 23, 28, 26, 20, 28, 29, 23, 162, 25, 27, 25, 26, 30, 31, 32, 32, 36, 36, 27, - 31, 25, 45, 45, 50, 26, 30, 40, 29, 33, - 33, 33, 33, 26, 15, 30, 31, 32, 32, 12, - 11, 31, 34, 34, 34, 34, 50, 30, 35, 35, + 31, 25, 45, 45, 50, 26, 30, 82, 29, 33, + 33, 33, 33, 26, 44, 30, 31, 32, 32, 40, + 15, 31, 34, 34, 34, 34, 50, 30, 35, 35, 35, 35, 37, 37, 37, 37, 38, 51, 52, 38, - 39, 39, 39, 39, 53, 54, 55, 56, 9, 57, - 60, 61, 62, 38, 63, 3, 64, 65, 51, 52, - 66, 69, 0, 70, 71, 53, 72, 54, 55, 56, + 39, 39, 39, 39, 53, 54, 55, 56, 12, 57, + 60, 61, 62, 38, 63, 11, 64, 65, 51, 52, + 66, 69, 9, 70, 71, 53, 72, 54, 55, 56, 57, 60, 61, 73, 62, 38, 63, 64, 65, 74, 76, 66, 77, 69, 70, 71, 80, 72, 78, 78, 78, 78, 84, 85, 86, 73, 79, 79, 79, 79, 88, 74, 76, 77, 89, 90, 95, 80, 91, 92, - 93, 94, 96, 84, 85, 98, 86, 100, 0, 102, + 93, 94, 96, 84, 85, 98, 86, 100, 3, 102, 103, 88, 104, 105, 107, 89, 106, 90, 95, 91, - 92, 93, 94, 96, 111, 112, 98, 115, 116, 100, - 102, 103, 117, 104, 119, 105, 107, 106, 120, 0, - 121, 123, 125, 126, 0, 128, 111, 112, 115, 130, - 116, 132, 133, 134, 117, 137, 119, 139, 140, 143, - - 120, 121, 143, 123, 125, 126, 128, 144, 146, 147, - 0, 130, 132, 133, 134, 0, 137, 0, 139, 140, - 143, 0, 0, 0, 0, 0, 0, 0, 144, 146, - 0, 147, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 143, 152, 0, 152, 152, 154, 0, 0, - 154, 151, 151, 151, 151, 151, 151, 151, 151, 151, - 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, - 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, - 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, - 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, - - 151, 151, 151, 151, 151, 151, 151, 151, 151 + 92, 93, 94, 96, 110, 112, 98, 110, 113, 100, + 102, 103, 116, 104, 117, 105, 107, 106, 118, 120, + 121, 0, 122, 124, 126, 110, 127, 112, 128, 129, + 113, 131, 110, 116, 133, 0, 117, 135, 136, 137, + + 118, 120, 121, 122, 140, 124, 126, 110, 127, 142, + 128, 129, 131, 110, 144, 145, 133, 149, 135, 136, + 137, 148, 150, 153, 148, 140, 152, 155, 0, 158, + 142, 0, 0, 0, 0, 144, 145, 0, 149, 0, + 0, 0, 148, 0, 150, 153, 0, 152, 0, 155, + 158, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 148, 161, 0, 161, 161, 163, + 0, 0, 163, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, + + 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, + 160 } ; static yy_state_type yy_last_accepting_state; @@ -636,7 +644,7 @@ static void countnl() { Director::g_lingo->_colnumber = strlen(p); } -#line 640 "engines/director/lingo/lingo-lex.cpp" +#line 648 "engines/director/lingo/lingo-lex.cpp" #define INITIAL 0 @@ -824,7 +832,7 @@ YY_DECL #line 58 "engines/director/lingo/lingo-lex.l" -#line 828 "engines/director/lingo/lingo-lex.cpp" +#line 836 "engines/director/lingo/lingo-lex.cpp" if ( !(yy_init) ) { @@ -878,13 +886,13 @@ YY_DECL while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 152 ) + if ( yy_current_state >= 161 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } - while ( yy_base[yy_current_state] != 352 ); + while ( yy_base[yy_current_state] != 374 ); yy_find_action: yy_act = yy_accept[yy_current_state]; @@ -963,146 +971,151 @@ YY_RULE_SETUP case 11: YY_RULE_SETUP #line 71 "engines/director/lingo/lingo-lex.l" -{ count(); return tEND; } +{ count(); return tENDIF; } YY_BREAK case 12: YY_RULE_SETUP #line 72 "engines/director/lingo/lingo-lex.l" -{ count(); return tEXIT; } +{ count(); return tENDREPEAT; } YY_BREAK case 13: YY_RULE_SETUP #line 73 "engines/director/lingo/lingo-lex.l" -{ count(); return tFRAME; } +{ count(); return tEXIT; } YY_BREAK case 14: YY_RULE_SETUP #line 74 "engines/director/lingo/lingo-lex.l" -{ count(); return tGLOBAL; } +{ count(); return tFRAME; } YY_BREAK case 15: YY_RULE_SETUP #line 75 "engines/director/lingo/lingo-lex.l" -{ count(); return tGO; } +{ count(); return tGLOBAL; } YY_BREAK case 16: YY_RULE_SETUP #line 76 "engines/director/lingo/lingo-lex.l" -{ count(); return tINTO; } +{ count(); return tGO; } YY_BREAK case 17: YY_RULE_SETUP #line 77 "engines/director/lingo/lingo-lex.l" -{ count(); return tLOOP; } +{ count(); return tINTO; } YY_BREAK case 18: YY_RULE_SETUP #line 78 "engines/director/lingo/lingo-lex.l" -{ count(); return tMACRO; } +{ count(); return tLOOP; } YY_BREAK case 19: YY_RULE_SETUP #line 79 "engines/director/lingo/lingo-lex.l" -{ count(); return tMCI; } +{ count(); return tMACRO; } YY_BREAK case 20: YY_RULE_SETUP #line 80 "engines/director/lingo/lingo-lex.l" -{ count(); return tMCIWAIT; } +{ count(); return tMCI; } YY_BREAK case 21: YY_RULE_SETUP #line 81 "engines/director/lingo/lingo-lex.l" -{ count(); return tMOVIE; } +{ count(); return tMCIWAIT; } YY_BREAK case 22: YY_RULE_SETUP #line 82 "engines/director/lingo/lingo-lex.l" -{ count(); return tNEXT; } +{ count(); return tMOVIE; } YY_BREAK case 23: YY_RULE_SETUP #line 83 "engines/director/lingo/lingo-lex.l" -{ count(); return tNOT; } +{ count(); return tNEXT; } YY_BREAK case 24: YY_RULE_SETUP #line 84 "engines/director/lingo/lingo-lex.l" -{ count(); return tOF; } +{ count(); return tNOT; } YY_BREAK case 25: YY_RULE_SETUP #line 85 "engines/director/lingo/lingo-lex.l" -{ count(); return tOR; } +{ count(); return tOF; } YY_BREAK case 26: YY_RULE_SETUP #line 86 "engines/director/lingo/lingo-lex.l" -{ count(); return tPREVIOUS; } +{ count(); return tOR; } YY_BREAK case 27: YY_RULE_SETUP #line 87 "engines/director/lingo/lingo-lex.l" -{ count(); return tPUT; } +{ count(); return tPREVIOUS; } YY_BREAK case 28: YY_RULE_SETUP #line 88 "engines/director/lingo/lingo-lex.l" -{ count(); return tREPEAT; } +{ count(); return tPUT; } YY_BREAK case 29: YY_RULE_SETUP #line 89 "engines/director/lingo/lingo-lex.l" -{ count(); return tSET; } +{ count(); return tREPEAT; } YY_BREAK case 30: YY_RULE_SETUP #line 90 "engines/director/lingo/lingo-lex.l" -{ count(); return tSTARTS; } +{ count(); return tSET; } YY_BREAK case 31: YY_RULE_SETUP #line 91 "engines/director/lingo/lingo-lex.l" -{ count(); return tTHEN; } +{ count(); return tSTARTS; } YY_BREAK case 32: YY_RULE_SETUP #line 92 "engines/director/lingo/lingo-lex.l" -{ count(); return tTO; } +{ count(); return tTHEN; } YY_BREAK case 33: YY_RULE_SETUP #line 93 "engines/director/lingo/lingo-lex.l" -{ count(); return tWITH; } +{ count(); return tTO; } YY_BREAK case 34: YY_RULE_SETUP #line 94 "engines/director/lingo/lingo-lex.l" -{ count(); return tWHILE; } +{ count(); return tWITH; } YY_BREAK case 35: YY_RULE_SETUP -#line 96 "engines/director/lingo/lingo-lex.l" -{ count(); return tNEQ; } +#line 95 "engines/director/lingo/lingo-lex.l" +{ count(); return tWHILE; } YY_BREAK case 36: YY_RULE_SETUP #line 97 "engines/director/lingo/lingo-lex.l" -{ count(); return tGE; } +{ count(); return tNEQ; } YY_BREAK case 37: YY_RULE_SETUP #line 98 "engines/director/lingo/lingo-lex.l" -{ count(); return tLE; } +{ count(); return tGE; } YY_BREAK case 38: YY_RULE_SETUP #line 99 "engines/director/lingo/lingo-lex.l" -{ count(); return tCONCAT; } +{ count(); return tLE; } YY_BREAK case 39: YY_RULE_SETUP -#line 101 "engines/director/lingo/lingo-lex.l" +#line 100 "engines/director/lingo/lingo-lex.l" +{ count(); return tCONCAT; } + YY_BREAK +case 40: +YY_RULE_SETUP +#line 102 "engines/director/lingo/lingo-lex.l" { count(); yylval.s = new Common::String(yytext); @@ -1113,43 +1126,43 @@ YY_RULE_SETUP return ID; } YY_BREAK -case 40: -YY_RULE_SETUP -#line 110 "engines/director/lingo/lingo-lex.l" -{ count(); yylval.f = atof(yytext); return FLOAT; } - YY_BREAK case 41: YY_RULE_SETUP #line 111 "engines/director/lingo/lingo-lex.l" -{ count(); yylval.i = strtol(yytext, NULL, 10); return INT; } +{ count(); yylval.f = atof(yytext); return FLOAT; } YY_BREAK case 42: YY_RULE_SETUP #line 112 "engines/director/lingo/lingo-lex.l" -{ count(); return *yytext; } +{ count(); yylval.i = strtol(yytext, NULL, 10); return INT; } YY_BREAK case 43: -/* rule 43 can match eol */ YY_RULE_SETUP #line 113 "engines/director/lingo/lingo-lex.l" -{ return '\n'; } +{ count(); return *yytext; } YY_BREAK case 44: +/* rule 44 can match eol */ YY_RULE_SETUP #line 114 "engines/director/lingo/lingo-lex.l" -{ count(); yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; } +{ return '\n'; } YY_BREAK case 45: YY_RULE_SETUP #line 115 "engines/director/lingo/lingo-lex.l" - +{ count(); yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; } YY_BREAK case 46: YY_RULE_SETUP -#line 117 "engines/director/lingo/lingo-lex.l" +#line 116 "engines/director/lingo/lingo-lex.l" + + YY_BREAK +case 47: +YY_RULE_SETUP +#line 118 "engines/director/lingo/lingo-lex.l" ECHO; YY_BREAK -#line 1153 "engines/director/lingo/lingo-lex.cpp" +#line 1166 "engines/director/lingo/lingo-lex.cpp" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -1442,7 +1455,7 @@ static int yy_get_next_buffer (void) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 152 ) + if ( yy_current_state >= 161 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; @@ -1470,11 +1483,11 @@ static int yy_get_next_buffer (void) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 152 ) + if ( yy_current_state >= 161 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 151); + yy_is_jam = (yy_current_state == 160); return yy_is_jam ? 0 : yy_current_state; } @@ -2149,7 +2162,7 @@ void yyfree (void * ptr ) #define YYTABLES_NAME "yytables" -#line 117 "engines/director/lingo/lingo-lex.l" +#line 118 "engines/director/lingo/lingo-lex.l" diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l index 6a78a3f160c6..4b0f8fe431a1 100644 --- a/engines/director/lingo/lingo-lex.l +++ b/engines/director/lingo/lingo-lex.l @@ -68,7 +68,8 @@ whitespace [\t ] (?i:[\n\r]+[\t ]+else[\t ]+if) { countnl(); return tNLELSIF; } (?i:[\n\r]+[\t ]+else) { countnl(); return tNLELSE; } (?i:else) { count(); return tELSE; } -(?i:end) { count(); return tEND; } +(?i:end[\t ]+if) { count(); return tENDIF; } +(?i:end[\t ]+repeat) { count(); return tENDREPEAT; } (?i:exit) { count(); return tEXIT; } (?i:frame) { count(); return tFRAME; } (?i:global) { count(); return tGLOBAL; } diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp index dd3d0cde194f..09e3805426d1 100644 --- a/engines/director/lingo/lingo.cpp +++ b/engines/director/lingo/lingo.cpp @@ -91,6 +91,8 @@ Lingo::Lingo(DirectorEngine *vm) : _vm(vm) { _linenumber = _colnumber = 0; + _hadError = false; + _floatPrecision = 4; _floatPrecisionFormat = "%.4f"; @@ -112,6 +114,7 @@ void Lingo::addCode(const char *code, ScriptType type, uint16 id) { _scripts[type][id] = _currentScript; _linenumber = _colnumber = 1; + _hadError = false; const char *begin, *end; @@ -126,7 +129,9 @@ void Lingo::addCode(const char *code, ScriptType type, uint16 id) { begin = code; first = false; } - Common::String chunk(begin, end); + Common::String chunk(begin, end + 1); + + debug(2, "Code chunk\n#####\n%s#####", chunk.c_str()); parse(chunk.c_str()); @@ -135,6 +140,7 @@ void Lingo::addCode(const char *code, ScriptType type, uint16 id) { begin = end + 1; } + _hadError = false; parse(begin); } else { parse(code); @@ -315,8 +321,13 @@ void Lingo::runTests() { warning("Executing file %s of size %d", m.getName().c_str(), size); + _hadError = false; addCode(script, kMovieScript, counter); - executeScript(kMovieScript, counter); + + if (!_hadError) + executeScript(kMovieScript, counter); + else + warning("Skipping execution"); free(script); diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h index 1509c1d36e2b..9e8e6f12808b 100644 --- a/engines/director/lingo/lingo.h +++ b/engines/director/lingo/lingo.h @@ -270,6 +270,8 @@ class Lingo { Common::String _floatPrecisionFormat; + bool _hadError; + private: int parse(const char *code); void push(Datum d); diff --git a/engines/director/lingo/tests/macros.lingo b/engines/director/lingo/tests/macros.lingo index a75dc4c8f980..7ffa557cb724 100644 --- a/engines/director/lingo/tests/macros.lingo +++ b/engines/director/lingo/tests/macros.lingo @@ -3,7 +3,7 @@ macro SHIPX global x, y set x = Random(5) if x = 1 then -go \"Zoom\" +go "Zoom" exit end if if x >1 then @@ -16,7 +16,7 @@ put 100 macro ZIPX set x = Random(5) if x = 1 then -go \"ZIP\" +go "ZIP" exit end if if x >1 then